percussion
All checks were successful
/ build (push) Successful in 40s

This commit is contained in:
Nycki 2025-07-07 16:46:56 -07:00
parent 86b373dc6a
commit 347ee76cf0

View file

@ -26,6 +26,13 @@ r=.4; // speed in s/beat
l=1; // note length in beats l=1; // note length in beats
T=[]; // elapsed beats per channel T=[]; // elapsed beats per channel
v=f.value; // input text v=f.value; // input text
s=A.sampleRate;
W=A.createBuffer(1,2*s,s);
for(i=0;i++<2*s;W.getChannelData(0)[i]=Math.random()*3-1);
w=A.createBufferSource();
w.buffer=W;
w.loop=true;
w.connect(B);
for( for(
i=o=k=t=Z=0; i=o=k=t=Z=0;
// loop over input, look ahead one character for sharp/flat // loop over input, look ahead one character for sharp/flat
@ -33,14 +40,13 @@ for(
c=v[i++],d=v[i],c; c=v[i++],d=v[i],c;
z<0?0: // unknown character, ignore z<0?0: // unknown character, ignore
z>29?k=1: // start of comment. P, O, V, U, K, R, not implemented. !z?(o=0,l=1/8): // @ reset
z>28?k=0: // end of comment z<3?o+=g: // -+ change octave
z>28?k=z-29:// start or end of comment. POVUKR multi-character codes not implemented.
k?0: // middle of comment k?0: // middle of comment
z>27?(T[Z]=t,Z=+v.slice(i,i+=2),t=T[Z]||0): // change channel z>27?(T[Z]=t,Z=+v.slice(i,i+=2),t=T[Z]||0): // change channel
z>17?t+=l: // rest z>18?(w.start(t*r),t+=l,w.stop(t*r)):
z<3? z>17?t+=l: // rest. 012456789 percussion not implemented.
z?o+=g: // -+ change octave
(o=0,l=1/8): // @ reset
z&1?l=g: // change note length z&1?l=g: // change note length
( // play note ( // play note
a=new OscillatorNode(A,{ a=new OscillatorNode(A,{