nycki.net/static/qrplay/v3e.html
2025-07-13 02:15:41 -07:00

94 lines
No EOL
1.8 KiB
HTML

<META NAME=VIEWPORT CONTENT=initial-scale=1>
<CENTER>
<P><A HREF=http://nycki.net/qrplay>qrplay v3e</A><br>by nycki and SArpnt</P>
<TEXTAREA ID=H STYLE=WIDTH:MIN(40EM,99%);HEIGHT:9LH>; @title nupa's theme
; @authors nycki bsp
; single channel version
1[@0000]
2[
0[c-c+]1 1
0[e-c+]1 0[g-c+]1
0[c-b!+]1 1
0[e-b!+]1 0[g-b!+]1
0[d-a+]1 0[c-a+]1
]
2
0[d-a+]1 0[c-a+]1
0[d#-a!+]1 0[d-a!+]1
1 1
2
0[d#-a!+]1 0[d-g+]1
0[c--c++]1 1
1 1
</TEXTAREA><P>
<BUTTON onclick="
H.A=A=new AudioContext;
W=Date.now();
F=(
M='',
T=0,
L,
N,
I=0,
K=0,
S=D=>D?S(D+(M[++I]==C)-(M[I]=='/')):I
)=>{console.log(T);for(;
C=M[I++];
D=M[I],
J=E=>E.indexOf(D)>=0,
// start of comment
Q>21?K=1:
Q>20?(L=N=4,K=0):
// check comment mode
K?0:
Q>7?
// DECREMENT Q, and then...
(Q-=9)?
// triplet or dotted rhythm, C is 3 or .
Q>9?L/=+C||2/3:
Q>7?
// extended command. read two digits, then...
(D=D+M[++I,I++]|0)?
// set bpm (U)
Q>8?U=D+M[I++]:
// set volume (V)
G=new GainNode(A,{gain:2**(D/5-11)}):
0:
// else, set length to...
L=
// fixed length (JTSIQHW)
~Q?1<<Q:
// reset L=N=4
(K=0,N=4):
// save sample ($x.../)
F[D]=M.slice(++I,S(1)):
~Q?(
// play note or rest
O=new OscillatorNode(A,{
type: 'square',
// !: are flat, #* are sharp
detune:100*(Q*2-(Q>3)-J('!:')+J('#*')-N-7)
}),
Q&&O.connect(G),
G.connect(A.destination),
O.start(T),
O.stop(T+=L/U*15/8)
):
// any unused letter or number
C>'/'?((M,T,L,N)=>(
console.log(M),
setTimeout(_=>F(M,T,L,N))
))(F[C],T,L,N):
// change octave, or noop
+C&&(N-=C+12|0)
)Q='XCDEFGABR$JTSIQHWVU3.\n;:'.indexOf(C)},
F('\nU137V40'+H.value.toUpperCase())
">#play</BUTTON> <BUTTON onclick=H.A.close()>#stop
<!-- snip -->
</BUTTON></P>
<img src="qrplay-v3d-nupas-theme.png">
</center>