27 lines
No EOL
602 B
HTML
27 lines
No EOL
602 B
HTML
<!-- https://bark.lgbt/@SArpnt@fe.disroot.org/114810256295973439 -->
|
|
<textarea onblur='
|
|
v=this.value;
|
|
A=new AudioContext;
|
|
for(
|
|
i=t=o=0,l=1;
|
|
c=v[i++],d=v[i],c;
|
|
|
|
z<0?0: // no match
|
|
z>17?t+=l: // rest
|
|
z<4? // @-+
|
|
z?o+=g: // change octave
|
|
(o=0,l=1/8): // @
|
|
z&1?l=g: // change speed
|
|
( // note
|
|
a=new OscillatorNode(A,{
|
|
type:`square`,
|
|
detune:100*(g+o+(d==`#`)-(d==`!`)) // # sharp or ! flat
|
|
}),
|
|
a.connect(A.destination),
|
|
a.start(t*.4),
|
|
t+=l,
|
|
a.stop(t*.4)
|
|
)
|
|
)
|
|
g=[,-12,12,4,-9,2,-7,1,-5,.5,-4,.25,-2,1/8,0,l/3,2,l*1.5][z=`@-+wchdqeifsgta3b.x012456789`.indexOf(c.toLowerCase())]
|
|
'> |