diff --git a/static/qrplay/v2c.html b/static/qrplay/v2c.html index f46b1fc..e3eb5a1 100644 --- a/static/qrplay/v2c.html +++ b/static/qrplay/v2c.html @@ -38,22 +38,23 @@ u=137; // volume. 50 is max, 45 is half, 40 is half again... v=40; for( - c=t=o=k=Z=0,l=3;E=s[c+2],D=s[c+1],C=s[c++]; + c=t=o=k=Z=0,l=3;D=s[c+1],E=D+s[c+2],C=s[c++]; // no match z<0?0: // comments z<2?k=z:k?0: // - + octave - z<4?o+=12*--d: + z<4?o+=C+12|0: // triplets and dots z<6?l*=3/d: // note or rest (percussion not implemented) z<23?( + z-=6, O=new OscillatorNode(A,{ type:`square`, - detune:100*(d?`0x`+d-(D==`!`)+(D==`#`)+o-9:-9e9) + detune:100*(z*2-(z>3)-(D==`!`)+(D==`#`)+o-9) }), - G=new GainNode(A,{gain:.5**(11-v/5)}), + G=new GainNode(A,{gain:z<7&&.5**(11-v/5)}), O.connect(G), G.connect(A.destination), O.start(t), @@ -64,17 +65,17 @@ for( // set note length z<31?l=3<<(z-25): // change channel - z<32?(T[Z]=t,t=T[Z=D+E]|0,c+=2): + z<32?(T[Z]=t,t=T[Z=E]|0,c+=2): // change tempo - z<33?u=s.slice(c,c+=3): + z<33?u=E+s[c+=2,c++]: // change volume - (v=D+E,c+=2) + (v=E,c+=2) // TODO combine all these slice operations into one branch // d is additional data that varies with the operation. -)d=`--0229024579b`[z=`\n;-+.3cdefgab012456789x@jtsiqhwzuv`.indexOf(C)] -'>#play +)z=`\n;-+.3cdefgab012456789x@jtsiqhwzuv`.indexOf(C) +'>#play - +