From 6f6ed6fe47e695dbe18478d0f6cb9591dc9c5fb5 Mon Sep 17 00:00:00 2001 From: nycki Date: Thu, 10 Jul 2025 02:18:30 -0700 Subject: [PATCH] temp percussion --- static/qrplay/v2c.html | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/static/qrplay/v2c.html b/static/qrplay/v2c.html index f56ce02..3973543 100644 --- a/static/qrplay/v2c.html +++ b/static/qrplay/v2c.html @@ -31,14 +31,14 @@ s=`@`+f.value.toLowerCase(); f.A?.close(); A=f.A=new AudioContext; -// time per-channel -T=[]; +// per-channel data +T=[];L=[]; // tempo in beats per minute u=137; // volume. 40 is default, 35 is half, 30 is half again. v=40; // percussion can be approximated as 1024th notes. -P=x=>(s=`z99l-5${x}o${o+4} l${Math.log2(l)} z${Z} x`+s.slice(c),c=0,T[99]=t); +P=x=>(s=`z99${x}z${Z} o${o+4} x`+s.slice(c),c=0,T[99]=t,L[99]=2**-5); for( c=t=k=Z=0;D=s[c+1],E=D+s[c+2],C=s[c++]; // no match @@ -54,7 +54,12 @@ for( C==`0`?P(`o07g`): C==`1`?P(`o05b+c#deff#gg#aa#b+cc#d`): C==`2`?P(`o06g++ddb--g++ddb--g++ddb--g++ddb`): + C==`4`?P(`o07g`): // todo + C==`5`?P(`o07g`): // todo C==`6`?P(`o05a++c#-aae+e--a++c#-aae+e--a++c#`): + C==`7`?P(`o07g`): // todo + C==`8`?P(`o07g`): // todo + C==`9`?P(`o04a++c#-aae+e--a++c#-aae+e--a++c#`): // todo // note or rest z<23?( z-=6, @@ -73,16 +78,18 @@ for( // set note length z<31?l=2**(z-25): // change channel - z<32?(T[Z]=t,t=T[Z=E|0]||0,c+=2): + z<32?( + T[Z]=t,L[Z]=l, + t=T[Z=E|0]||0,l=L[Z]||l, + c+=2 + ): // change tempo z<33?u=E+s[c+=2,c++]: // change volume z<34?(v=E,c+=2): // set octave - z<35?(o=E-4,c+=2): - // set length - (l=2**E,c+=2) -)z=`\n;-+.3cdefgab012456789x@jtsiqhwzuvol`.indexOf(C) + (o=E-4,c+=2) +)z=`\n;-+.3cdefgab012456789x@jtsiqhwzuvo`.indexOf(C) '>#play