This commit is contained in:
parent
92ef5b7e64
commit
c2b4088a6c
1 changed files with 102 additions and 0 deletions
102
static/qrplay/v3b.min.html
Normal file
102
static/qrplay/v3b.min.html
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
<META NAME=VIEWPORT CONTENT=INITIAL=SCALE=1>
|
||||||
|
<CENTER>
|
||||||
|
<P><A HREF=http://nycki.net/qrplay>qrplay v3b</A></P>
|
||||||
|
<TEXTAREA ID=F STYLE=WIDTH:MIN(40EM,99%);HEIGHT:9LH>; drum samples!
|
||||||
|
i 0000 1111 2222 4444 5555 6666 7777 8888 9999
|
||||||
|
|
||||||
|
hx@
|
||||||
|
|
||||||
|
; you can overwrite samples
|
||||||
|
0[-c+c]
|
||||||
|
00000000
|
||||||
|
|
||||||
|
hx@
|
||||||
|
|
||||||
|
; state is NOT preserved when playing samples
|
||||||
|
0[cdefgab+]
|
||||||
|
0000
|
||||||
|
|
||||||
|
; state IS preserved during parallel play
|
||||||
|
@q {-ggeec}
|
||||||
|
cdefg
|
||||||
|
|
||||||
|
hx@
|
||||||
|
|
||||||
|
; infinite loop
|
||||||
|
0[i9x9x6xxx0]
|
||||||
|
0
|
||||||
|
</textarea><p>
|
||||||
|
<button onclick="
|
||||||
|
F.A?.close();
|
||||||
|
F.A=A=new AudioContext;
|
||||||
|
S='@'+F.value;
|
||||||
|
// stack
|
||||||
|
B=[];
|
||||||
|
// stack variables
|
||||||
|
K=O=T=Z=L=0;
|
||||||
|
U=137;
|
||||||
|
V=40;
|
||||||
|
// samples
|
||||||
|
C=[];
|
||||||
|
|
||||||
|
// main loop
|
||||||
|
M=()=>{
|
||||||
|
[a,b,c]=S;
|
||||||
|
// next index into S
|
||||||
|
s=1;
|
||||||
|
// opcode
|
||||||
|
z='\n;+-@.3cdefgabx012456789jtsiqhwmuvo{}'.indexOf(a);
|
||||||
|
|
||||||
|
// no match
|
||||||
|
z<0?0:
|
||||||
|
|
||||||
|
// comment
|
||||||
|
z<2?K=z:K?0:
|
||||||
|
|
||||||
|
// octave
|
||||||
|
z<4?O+=a+1|0:
|
||||||
|
|
||||||
|
// reset octave and length
|
||||||
|
z<5?(O=0,L=1):
|
||||||
|
|
||||||
|
// dots and triplets
|
||||||
|
z<6?L*=3/2:
|
||||||
|
z<7?L/=3:
|
||||||
|
|
||||||
|
// note or rest
|
||||||
|
z<13?(
|
||||||
|
z-=7,
|
||||||
|
o=new OscillatorNode(A,{
|
||||||
|
type:'square',
|
||||||
|
detune:100*(z*2-(z>2)-(b=='!')+(b=='#')+12*O-9)
|
||||||
|
}),
|
||||||
|
g=new GainNode(A,{gain:z<7&&.5**(12-V/5)}),
|
||||||
|
o.connect(g),
|
||||||
|
g.connect(A.destination),
|
||||||
|
o.start(T),
|
||||||
|
o.stop(T+=7.5*L/U)
|
||||||
|
):
|
||||||
|
|
||||||
|
// store sample
|
||||||
|
z<22&&b=='['?(
|
||||||
|
m=0,
|
||||||
|
d=B.findIndex.call(S,c=>
|
||||||
|
c=='['?!++m:
|
||||||
|
c==']'?!--m:
|
||||||
|
0
|
||||||
|
),
|
||||||
|
C[a]=S.slice(s,d),
|
||||||
|
s=d+1
|
||||||
|
):
|
||||||
|
|
||||||
|
// play sample
|
||||||
|
z<22?S=C[a]+S.slice(s):
|
||||||
|
|
||||||
|
// do nothing
|
||||||
|
0;
|
||||||
|
|
||||||
|
// loop
|
||||||
|
S=S.slice(s);
|
||||||
|
S&&setTimeout(M)
|
||||||
|
};M()
|
||||||
|
">#play</BUTTON>
|
Loading…
Add table
Reference in a new issue