parent
86b373dc6a
commit
347ee76cf0
1 changed files with 12 additions and 6 deletions
|
@ -26,6 +26,13 @@ r=.4; // speed in s/beat
|
|||
l=1; // note length in beats
|
||||
T=[]; // elapsed beats per channel
|
||||
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(
|
||||
i=o=k=t=Z=0;
|
||||
// loop over input, look ahead one character for sharp/flat
|
||||
|
@ -33,14 +40,13 @@ for(
|
|||
c=v[i++],d=v[i],c;
|
||||
|
||||
z<0?0: // unknown character, ignore
|
||||
z>29?k=1: // start of comment. P, O, V, U, K, R, not implemented.
|
||||
z>28?k=0: // end of comment
|
||||
!z?(o=0,l=1/8): // @ reset
|
||||
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
|
||||
z>27?(T[Z]=t,Z=+v.slice(i,i+=2),t=T[Z]||0): // change channel
|
||||
z>17?t+=l: // rest
|
||||
z<3?
|
||||
z?o+=g: // -+ change octave
|
||||
(o=0,l=1/8): // @ reset
|
||||
z>18?(w.start(t*r),t+=l,w.stop(t*r)):
|
||||
z>17?t+=l: // rest. 012456789 percussion not implemented.
|
||||
z&1?l=g: // change note length
|
||||
( // play note
|
||||
a=new OscillatorNode(A,{
|
||||
|
|
Loading…
Add table
Reference in a new issue