real-time feedback loop
This commit is contained in:
parent
7ff9024ba5
commit
07e22cd90f
1 changed files with 6 additions and 6 deletions
|
@ -27,12 +27,12 @@
|
||||||
<BUTTON onclick="
|
<BUTTON onclick="
|
||||||
F.A?.close();
|
F.A?.close();
|
||||||
F.A=A=new AudioContext;
|
F.A=A=new AudioContext;
|
||||||
// kill some time for the audio context to start
|
D=Date.now();
|
||||||
S='@qx@'+F.value.toLowerCase();
|
S='@'+F.value.toLowerCase();
|
||||||
// stack
|
// stack
|
||||||
B=[];
|
B=[];
|
||||||
// stack variables
|
// stack variables
|
||||||
K=O=T=Z=L=0;
|
K=L=O=T=Z=0;
|
||||||
U=137;
|
U=137;
|
||||||
V=40;
|
V=40;
|
||||||
// samples
|
// samples
|
||||||
|
@ -63,7 +63,7 @@ M=_=>{
|
||||||
type:'square',
|
type:'square',
|
||||||
detune:100*(z*2-(z>2)-(b=='!')+(b=='#')+12*O-9)
|
detune:100*(z*2-(z>2)-(b=='!')+(b=='#')+12*O-9)
|
||||||
}),
|
}),
|
||||||
g=new GainNode(A,{gain:z<7&&.5**(14-V/5)}),
|
g=new GainNode(A,{gain:z<7&&.5**(13-V/5)}),
|
||||||
o.connect(g),
|
o.connect(g),
|
||||||
g.connect(A.destination),
|
g.connect(A.destination),
|
||||||
o.start(T),
|
o.start(T),
|
||||||
|
@ -94,7 +94,7 @@ M=_=>{
|
||||||
// play sample
|
// play sample
|
||||||
S=C[a]+S.slice(s--);
|
S=C[a]+S.slice(s--);
|
||||||
|
|
||||||
// loop
|
// loop (but don't get too far ahead)
|
||||||
(S=S.slice(s))&&setTimeout(M,50)
|
A.state!='closed'&&(S=S.slice(s))&&setTimeout(M,1e3*T-Date.now()+D);
|
||||||
};M()
|
};M()
|
||||||
">#play</BUTTON> <BUTTON ONCLICK=F.A.close()>#stop
|
">#play</BUTTON> <BUTTON ONCLICK=F.A.close()>#stop
|
||||||
|
|
Loading…
Add table
Reference in a new issue