Compare commits
2 commits
164aea2eae
...
bfd199e414
Author | SHA1 | Date | |
---|---|---|---|
bfd199e414 | |||
07e22cd90f |
1 changed files with 6 additions and 6 deletions
|
@ -28,7 +28,6 @@
|
||||||
F.A?.close();
|
F.A?.close();
|
||||||
F.A=A=new AudioContext;
|
F.A=A=new AudioContext;
|
||||||
D=Date.now();
|
D=Date.now();
|
||||||
// kill some time for the audio context to start
|
|
||||||
S='@'+F.value.toLowerCase();
|
S='@'+F.value.toLowerCase();
|
||||||
// stack
|
// stack
|
||||||
B=[];
|
B=[];
|
||||||
|
@ -45,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:
|
||||||
|
@ -64,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),
|
||||||
|
@ -79,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,
|
||||||
|
@ -96,6 +96,6 @@ M=_=>{
|
||||||
S=C[a]+S.slice(s--);
|
S=C[a]+S.slice(s--);
|
||||||
|
|
||||||
// loop (but don't get too far ahead)
|
// loop (but don't get too far ahead)
|
||||||
A.state!='closed'&&(S=S.slice(s))&&setTimeout(M,1000*T-Date.now()+D);
|
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue