This commit is contained in:
parent
f3a44e05e1
commit
89ded5295e
3 changed files with 29 additions and 14 deletions
18
static/qrplay/golf2.html
Normal file
18
static/qrplay/golf2.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<textarea onblur='
|
||||
v=this.value.toLowerCase();
|
||||
for(
|
||||
c=t=o=0,l=2;C=v[c++];
|
||||
z>9?l=1<<z-9:
|
||||
z>1|C-3?1+C<9||(
|
||||
O=new OscillatorNode(A=new AudioContext,{
|
||||
type:`square`,
|
||||
detune:100*(d?`0x`+d-(v[c]==`!`)+(v[c]==`%23`)+o-9:-9e9)
|
||||
}),
|
||||
O.connect(A.destination),
|
||||
O.start(t),
|
||||
O.stop(t+=l*7/256)
|
||||
):
|
||||
z<0?o+=C+12|0:
|
||||
l*=3/d
|
||||
)d=`29024579b`[z=`.3cdefgabxtsiqhw`.indexOf(C)]
|
||||
'></textarea>
|
|
@ -26,7 +26,7 @@
|
|||
<meta name=viewport content=initial-scale=1>
|
||||
<center>
|
||||
<p><a href=http://nycki.net/qrplay>qrplay</a></p>
|
||||
<textarea id=f style=width:30em;height:6rem></textarea><p>
|
||||
<textarea id=f></textarea><p>
|
||||
<button onclick='
|
||||
v=f.value.toLowerCase();
|
||||
f.A?.close();
|
||||
|
@ -34,17 +34,14 @@ A=f.A=new AudioContext;
|
|||
T=[];
|
||||
for(
|
||||
c=t=o=k=Z=0,l=2;C=v[c++];
|
||||
// no match
|
||||
z<0?0:
|
||||
// - + octave, or no match
|
||||
z<0?o+=C+12|0:
|
||||
// comments
|
||||
z<2?k=z:
|
||||
k?0:
|
||||
// change octave
|
||||
z<4?o+=12*--d:
|
||||
z<2?k=z:k?0:
|
||||
// triplets and dots
|
||||
z<6?l*=3/d:
|
||||
z<4?l*=3/d:
|
||||
// note
|
||||
z<13?(
|
||||
z<11?(
|
||||
O=new OscillatorNode(A,{
|
||||
type:`square`,
|
||||
detune:100*(`0x`+d-(v[c]==`!`)+(v[c]==`#`)+o-9)
|
||||
|
@ -56,15 +53,15 @@ for(
|
|||
O.stop(t+=l*7/256)
|
||||
):
|
||||
// rest, also skip percussion
|
||||
z<23?t+=l*7/256:
|
||||
z<21?t+=l*7/256:
|
||||
// reset octave and duration
|
||||
z<24?(o=0,l=2):
|
||||
z<22?(o=0,l=2):
|
||||
// set note length
|
||||
z<31?l=1<<(z-24):
|
||||
z<29?l=1<<(z-22):
|
||||
// change channel
|
||||
(T[Z]=t,Z=+v.slice(c,c+=2),t=T[Z]|0)
|
||||
// d is additional data that varies with the operation.
|
||||
)d=`--0229024579b`[z=`\n;-+.3cdefgab012456789x@jtsiqhwz`.indexOf(C)]
|
||||
)d=`--0229024579b`[z=`\n;.3cdefgab012456789x@jtsiqhwz`.indexOf(C)]
|
||||
'>#play</button> <button onclick=f.A.close()>#stop</button></center>
|
||||
<!-- stop snipping here -->
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
<meta name=viewport content=initial-scale=1><center><p><a href=http://nycki.net/qrplay>qrplay</a></p><textarea id=f style=width:30em;height:6rem></textarea><p><button onclick='v=f.value.toLowerCase();f.A?.close();A=f.A=new AudioContext;T=[];for(c=t=o=k=Z=0,l=2;C=v[c++];z<0?0:z<2?k=z:k?0:z<4?o+=12*--d:z<6?l*=3/d:z<13?(O=new OscillatorNode(A,{type:`square`,detune:100*(`0x`+d-(v[c]==`!`)+(v[c]==`#`)+o-9)}),G=new GainNode(A,{gain:1/20}),O.connect(G),G.connect(A.destination),O.start(t),O.stop(t+=l*7/256)):z<23?t+=l*7/256:z<24?(o=0,l=2):z<31?l=1<<(z-24):(T[Z]=t,Z=+v.slice(c,c+=2),t=T[Z]|0))d=`--0229024579b`[z=`\n;-+.3cdefgab012456789x@jtsiqhwz`.indexOf(C)]'>#play</button> <button onclick=f.A.close()>#stop</button></center>
|
||||
<meta name=viewport content=initial-scale=1><center><p><a href=http://nycki.net/qrplay>qrplay</a></p><textarea id=f></textarea><p><button onclick='v=f.value.toLowerCase();f.A?.close();A=f.A=new AudioContext;T=[];for(c=t=o=k=Z=0,l=2;C=v[c++];z<0?o+=C+12|0:z<2?k=z:k?0:z<4?l*=3/d:z<11?(O=new OscillatorNode(A,{type:`square`,detune:100*(`0x`+d-(v[c]==`!`)+(v[c]==`#`)+o-9)}),G=new GainNode(A,{gain:1/20}),O.connect(G),G.connect(A.destination),O.start(t),O.stop(t+=l*7/256)):z<21?t+=l*7/256:z<22?(o=0,l=2):z<29?l=1<<(z-22):(T[Z]=t,Z=+v.slice(c,c+=2),t=T[Z]|0))d=`--0229024579b`[z=`\n;.3cdefgab012456789x@jtsiqhwz`.indexOf(C)]'>#play</button> <button onclick=f.A.close()>#stop</button></center>
|
Loading…
Add table
Reference in a new issue