This commit is contained in:
parent
1ec70b5c1d
commit
6f6ed6fe47
1 changed files with 15 additions and 8 deletions
|
@ -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</button> <button onclick=f.A.close()>#stop</button>
|
||||
<!-- stop snipping here -->
|
||||
</center>
|
||||
|
|
Loading…
Add table
Reference in a new issue