This commit is contained in:
parent
35bafd8535
commit
74257cf725
2 changed files with 135 additions and 0 deletions
112
static/qrplay/v3c.html
Normal file
112
static/qrplay/v3c.html
Normal file
|
@ -0,0 +1,112 @@
|
|||
<META NAME=VIEWPORT CONTENT=INITIAL=SCALE=1>
|
||||
<CENTER>
|
||||
<P><A HREF=http://nycki.net/qrplay>qrplay v3b</A><br>by nycki and SArpnt</P>
|
||||
<TEXTAREA ID=F 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="
|
||||
F.A?.close();
|
||||
F.A=A=new AudioContext;
|
||||
// kill some time for the audio context to start
|
||||
S='hx@'+F.value;
|
||||
// stack
|
||||
B=[];D=[[]];
|
||||
// stack variables
|
||||
K=O=T=Y=Z=L=0;
|
||||
U=137;
|
||||
V=40;
|
||||
// samples
|
||||
C=[
|
||||
'+g',
|
||||
'-b+c#deff#g',
|
||||
'g++ddb--g++ddb',
|
||||
,
|
||||
'+ea-g--b++g++c#',
|
||||
'a#ga#g-a#+g-b+g',
|
||||
'-a++c#-aae+e--a',
|
||||
'-ffed#ddc#',
|
||||
'dddddd#e',
|
||||
'--ba#bb-a+a#-b'
|
||||
].map(c=>`{@++m${c}}x`);
|
||||
|
||||
// main loop
|
||||
M=_=>{
|
||||
[a,b,c,d]=S;
|
||||
// next index into S
|
||||
s=1;
|
||||
// opcode
|
||||
z='\n;]+-@.3cdefgabx012456789jtsiqhwmuv{}'.indexOf(a);
|
||||
|
||||
// recording
|
||||
D[Y][1]+=a;
|
||||
|
||||
// no match
|
||||
z<0?0:
|
||||
// comment
|
||||
z<2?K=z:K?0:
|
||||
// recording
|
||||
b=='['?D[s++,++Y]=[a,a+b]:
|
||||
z<3?(
|
||||
[a,c]=D[Y--],
|
||||
C[a]=c.slice(2,-1),
|
||||
D[Y][1]+=c
|
||||
):
|
||||
Y?0:
|
||||
// octave
|
||||
z<5?O+=a+1|0:
|
||||
// reset octave and length
|
||||
z<6?(O=0,L=1):
|
||||
// dots and triplets
|
||||
z<8?L*=3/(z<7?2:9):
|
||||
// note or rest
|
||||
z<16?(
|
||||
z-=8,
|
||||
o=new OscillatorNode(A,{
|
||||
type:'square',
|
||||
detune:100*(z*2-(z>2)-(b=='!')+(b=='#')+12*O-9)
|
||||
}),
|
||||
g=new GainNode(A,{gain:z<7&&.5**(14-V/5)}),
|
||||
o.connect(g),
|
||||
g.connect(A.destination),
|
||||
o.start(T),
|
||||
o.stop(T+=7.5*L/U)
|
||||
):
|
||||
// play sample
|
||||
z<25?S=C[a]+S.slice(s--):
|
||||
// set note length
|
||||
z<32?L=2**(z-26):
|
||||
// set note length (microtone)
|
||||
z<33?L=U/2**11:
|
||||
// change tempo in bpm
|
||||
z<34?(U=b+c+d,s+=3):
|
||||
// change volume
|
||||
z<35?(V=b+c,s+=2):
|
||||
// play simultaneously
|
||||
z<36?B[Z++]={L,O,T,U,V}:
|
||||
{L,O,T,U,V}=B[--Z];
|
||||
|
||||
// loop
|
||||
(S=S.slice(s))&&setTimeout(M)
|
||||
};M()
|
||||
">#play</BUTTON> <BUTTON ONCLICK=F.A.close()>#stop
|
23
static/qrplay/v3c.min.html
Normal file
23
static/qrplay/v3c.min.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<META NAME=VIEWPORT CONTENT=INITIAL=SCALE=1><CENTER><P><A HREF=http://nycki.net/qrplay>qrplay v3b</A><br>by nycki and SArpnt</P><TEXTAREA ID=F 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="F.A?.close();F.A=A=new AudioContext;S='hx@'+F.value;B=[];D=[[]];K=O=T=Y=Z=L=0;U=137;V=40;C=['+g','-b+c#deff#g','g++ddb--g++ddb',,'+ea-g--b++g++c#','a#ga#g-a#+g-b+g','-a++c#-aae+e--a','-ffed#ddc#','dddddd#e','--ba#bb-a+a#-b'].map(c=>`{@++m${c}}x`);M=_=>{[a,b,c,d]=S;s=1;z='\n;]+-@.3cdefgabx012456789jtsiqhwmuv{}'.indexOf(a);D[Y][1]+=a;z<0?0:z<2?K=z:K?0:b=='['?D[s++,++Y]=[a,a+b]:z<3?([a,c]=D[Y--],C[a]=c.slice(2,-1),D[Y][1]+=c):Y?0:z<5?O+=a+1|0:z<6?(O=0,L=1):z<8?L*=3/(z<7?2:9):z<16?(z-=8,o=new OscillatorNode(A,{type:'square',detune:100*(z*2-(z>2)-(b=='!')+(b=='#')+12*O-9)}),g=new GainNode(A,{gain:z<7&&.5**(14-V/5)}),o.connect(g),g.connect(A.destination),o.start(T),o.stop(T+=7.5*L/U)):z<25?S=C[a]+S.slice(s--):z<32?L=2**(z-26):z<33?L=U/2**11:z<34?(U=b+c+d,s+=3):z<35?(V=b+c,s+=2):z<36?B[Z++]={L,O,T,U,V}:{L,O,T,U,V}=B[--Z];(S=S.slice(s))&&setTimeout(M)};M()">#play</BUTTON> <BUTTON ONCLICK=F.A.close()>#stop
|
Loading…
Add table
Reference in a new issue