This commit is contained in:
parent
67a203d7ea
commit
afeba7d643
1 changed files with 11 additions and 20 deletions
|
@ -1,22 +1,13 @@
|
|||
<!doctype html>
|
||||
<meta name="viewport" content="initial-scale=1.0">
|
||||
<script>
|
||||
var m=[147, 2, 147, 2, 294, 4, 220, 6, 208, 4, 196, 4, 175, 4, 147, 2, 175, 2, 196, 2];
|
||||
var r=.08;
|
||||
function n(c,f,t,u) {
|
||||
var o=c.createOscillator();
|
||||
var g=c.createGain();
|
||||
o.connect(g);
|
||||
g.connect(c.destination);
|
||||
<html onclick="
|
||||
c=new AudioContext();
|
||||
r=.08;
|
||||
n=(f,t,u)=>{
|
||||
o=c.createOscillator();
|
||||
o.connect(c.destination);
|
||||
o.frequency.value=f;
|
||||
o.start(t*r);
|
||||
o.stop(u*r-r);
|
||||
}
|
||||
function p() {
|
||||
var c=new AudioContext();
|
||||
for(i=0,t=0;i<m.length;i+=2) {
|
||||
n(c,m[i],t,t+=m[i+1]);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<button onclick="p()">play</button>
|
||||
};
|
||||
m=[147, 2, 147, 2, 294, 4, 220, 6, 208, 4, 196, 4, 175, 4, 147, 2, 175, 2, 196, 2];
|
||||
for(i=0,t=0;i<m.length;i+=2)n(m[i],t,t+=m[i+1]);
|
||||
">click anywhere
|
||||
|
|
Loading…
Add table
Reference in a new issue