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();
|
s=`@`+f.value.toLowerCase();
|
||||||
f.A?.close();
|
f.A?.close();
|
||||||
A=f.A=new AudioContext;
|
A=f.A=new AudioContext;
|
||||||
// time per-channel
|
// per-channel data
|
||||||
T=[];
|
T=[];L=[];
|
||||||
// tempo in beats per minute
|
// tempo in beats per minute
|
||||||
u=137;
|
u=137;
|
||||||
// volume. 40 is default, 35 is half, 30 is half again.
|
// volume. 40 is default, 35 is half, 30 is half again.
|
||||||
v=40;
|
v=40;
|
||||||
// percussion can be approximated as 1024th notes.
|
// 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(
|
for(
|
||||||
c=t=k=Z=0;D=s[c+1],E=D+s[c+2],C=s[c++];
|
c=t=k=Z=0;D=s[c+1],E=D+s[c+2],C=s[c++];
|
||||||
// no match
|
// no match
|
||||||
|
@ -54,7 +54,12 @@ for(
|
||||||
C==`0`?P(`o07g`):
|
C==`0`?P(`o07g`):
|
||||||
C==`1`?P(`o05b+c#deff#gg#aa#b+cc#d`):
|
C==`1`?P(`o05b+c#deff#gg#aa#b+cc#d`):
|
||||||
C==`2`?P(`o06g++ddb--g++ddb--g++ddb--g++ddb`):
|
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==`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
|
// note or rest
|
||||||
z<23?(
|
z<23?(
|
||||||
z-=6,
|
z-=6,
|
||||||
|
@ -73,16 +78,18 @@ for(
|
||||||
// set note length
|
// set note length
|
||||||
z<31?l=2**(z-25):
|
z<31?l=2**(z-25):
|
||||||
// change channel
|
// 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
|
// change tempo
|
||||||
z<33?u=E+s[c+=2,c++]:
|
z<33?u=E+s[c+=2,c++]:
|
||||||
// change volume
|
// change volume
|
||||||
z<34?(v=E,c+=2):
|
z<34?(v=E,c+=2):
|
||||||
// set octave
|
// set octave
|
||||||
z<35?(o=E-4,c+=2):
|
(o=E-4,c+=2)
|
||||||
// set length
|
)z=`\n;-+.3cdefgab012456789x@jtsiqhwzuvo`.indexOf(C)
|
||||||
(l=2**E,c+=2)
|
|
||||||
)z=`\n;-+.3cdefgab012456789x@jtsiqhwzuvol`.indexOf(C)
|
|
||||||
'>#play</button> <button onclick=f.A.close()>#stop</button>
|
'>#play</button> <button onclick=f.A.close()>#stop</button>
|
||||||
<!-- stop snipping here -->
|
<!-- stop snipping here -->
|
||||||
</center>
|
</center>
|
||||||
|
|
Loading…
Add table
Reference in a new issue