Compare commits

...

2 commits

Author SHA1 Message Date
bfd199e414 comments
All checks were successful
/ build (push) Successful in 33s
2025-07-12 12:11:15 -07:00
07e22cd90f real-time feedback loop 2025-07-12 11:53:23 -07:00

View file

@ -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
@ -44,7 +44,7 @@ M=_=>{
// next index into S // next index into S
s=1; s=1;
// opcode // opcode
z='\n;+-@.3cdefgabxjtsiqhwmuv{}012456789'.indexOf(a); z='\n;+-@.3cdefgabxjtsiqhwmuv{}z012456789'.indexOf(a);
// do nothing // do nothing
z<0?0: z<0?0:
@ -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),
@ -78,8 +78,9 @@ M=_=>{
// change volume // change volume
z<25?(V=b+c,s+=2): z<25?(V=b+c,s+=2):
// play simultaneously // play simultaneously
z<26?B[Z++]={L,O,T,U,V}: z<26?B[Z++]=[L,O,T,U,V]:z<27?[L,O,T,U,V]=B[--Z]:
z<27?{L,O,T,U,V}=B[--Z]: // play on channel
z<28?B[B[Z]=[L,O,T,U,V],s=3,Z=b+c]=[L,O,T,U,V]=[1,0,0,U,V]:
// store sample // store sample
b=='['?( b=='['?(
m=0, m=0,
@ -94,7 +95,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-5e3);
};M() };M()
">#play</BUTTON> <BUTTON ONCLICK=F.A.close()>#stop ">#play</BUTTON> <BUTTON ONCLICK=F.A.close()>#stop