This commit is contained in:
parent
8cc517fc9c
commit
968ec59529
1 changed files with 7 additions and 3 deletions
|
@ -9,16 +9,20 @@
|
||||||
@i+ge!dc-ge!dh.c
|
@i+ge!dc-ge!dh.c
|
||||||
</textarea><br>
|
</textarea><br>
|
||||||
<button onclick="
|
<button onclick="
|
||||||
A=new AudioContext();
|
const A=new AudioContext();
|
||||||
// tempo
|
// tempo
|
||||||
r=.4;
|
r=.4;
|
||||||
|
e='exponentialRampToValueAtTime';
|
||||||
// play note with pitch and duration
|
// play note with pitch and duration
|
||||||
p=(h,t,u)=>{
|
p=(h,t,u)=>{
|
||||||
a=A.createOscillator();
|
a=A.createOscillator();
|
||||||
a.connect(A.destination);
|
const b=A.createGain();
|
||||||
|
a.connect(b);
|
||||||
|
b.connect(A.destination);
|
||||||
a.frequency.value=h;
|
a.frequency.value=h;
|
||||||
a.start(t*r);
|
a.start(t*r);
|
||||||
a.stop(u*r);
|
b.gain[e](1,t*r+.1);
|
||||||
|
b.gain[e](0.001,u*r);
|
||||||
};
|
};
|
||||||
// read text from input
|
// read text from input
|
||||||
v=window.location.search.slice(1)||f.value;f.value=v;
|
v=window.location.search.slice(1)||f.value;f.value=v;
|
||||||
|
|
Loading…
Add table
Reference in a new issue