From 657cc8f47c208f58161f7dae6ef4a23b6fcc8d97 Mon Sep 17 00:00:00 2001 From: nycki Date: Wed, 9 Jul 2025 22:19:51 -0700 Subject: [PATCH] precompute D and E --- static/qrplay/v2c.html | 10 +++++----- static/qrplay/v2c.min.html | 11 +++-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/static/qrplay/v2c.html b/static/qrplay/v2c.html index 86e3d5c..f46b1fc 100644 --- a/static/qrplay/v2c.html +++ b/static/qrplay/v2c.html @@ -38,7 +38,7 @@ u=137; // volume. 50 is max, 45 is half, 40 is half again... v=40; for( - c=t=o=k=Z=0,l=3;C=s[c++]; + c=t=o=k=Z=0,l=3;E=s[c+2],D=s[c+1],C=s[c++]; // no match z<0?0: // comments @@ -51,9 +51,9 @@ for( z<23?( O=new OscillatorNode(A,{ type:`square`, - detune:100*(d?`0x`+d-(s[c]==`!`)+(s[c]==`#`)+o-9:-9e9) + detune:100*(d?`0x`+d-(D==`!`)+(D==`#`)+o-9:-9e9) }), - G=new GainNode(A,{gain:.5**(14-v/5)}), + G=new GainNode(A,{gain:.5**(11-v/5)}), O.connect(G), G.connect(A.destination), O.start(t), @@ -64,11 +64,11 @@ for( // set note length z<31?l=3<<(z-25): // change channel - z<32?(T[Z]=t,t=T[Z=s[c++]+s[c++]|0]|0): + z<32?(T[Z]=t,t=T[Z=D+E]|0,c+=2): // change tempo z<33?u=s.slice(c,c+=3): // change volume - v=s[c++]+s[c++] + (v=D+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)] diff --git a/static/qrplay/v2c.min.html b/static/qrplay/v2c.min.html index c82e84e..73a8e62 100644 --- a/static/qrplay/v2c.min.html +++ b/static/qrplay/v2c.min.html @@ -1,8 +1,3 @@ -

qrplay v2c

\ No newline at end of file +

qrplay v2c

+ +783 \ No newline at end of file