This commit is contained in:
parent
a78ebf2e2a
commit
e6e31eeb0a
1 changed files with 21 additions and 0 deletions
21
static/abc/index.html
Normal file
21
static/abc/index.html
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<meta name="viewport" content="initial-scale=1.0">
|
||||||
|
<script>
|
||||||
|
var c=new AudioContext();
|
||||||
|
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(f,t,u) {
|
||||||
|
var o=c.createOscillator();
|
||||||
|
var g=c.createGain();
|
||||||
|
o.connect(g);
|
||||||
|
g.connect(c.destination);
|
||||||
|
o.frequency.value = f;
|
||||||
|
o.start(t*r);
|
||||||
|
o.stop(u*r-r);
|
||||||
|
}
|
||||||
|
function p() {
|
||||||
|
for(i=0,t=0;i<m.length;i+=2) {
|
||||||
|
n(m[i],t,t+=m[i+1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.write('<button onclick="p()">play</button>');
|
||||||
|
</script>
|
Loading…
Add table
Reference in a new issue