Skip to content

Commit

Permalink
Fix code-loading buttons (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
SthephanShinkufag committed Dec 23, 2024
1 parent d46166e commit 49e1335
Show file tree
Hide file tree
Showing 41 changed files with 21,548 additions and 4 deletions.
Binary file modified data/library/all.gz
Binary file not shown.
Binary file modified data/library/classic.gz
Binary file not shown.
Binary file modified data/library/floatbeat-big.gz
Binary file not shown.
Binary file modified data/library/floatbeat.gz
Binary file not shown.
Binary file modified data/library/funcbeat.gz
Binary file not shown.
Binary file modified data/library/js-1k.gz
Binary file not shown.
Binary file modified data/library/js-256.gz
Binary file not shown.
Binary file modified data/library/js-big.gz
Binary file not shown.
72 changes: 72 additions & 0 deletions data/songs/formatted/320dbf59c491e303445ffb29dc4364e0.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
songSpeed = 6.4,
T = t * songSpeed / 48000 /* sampleRate */,
b = T / 8 % 88 /* Song length */,
notesTri = '9 9 9 9 9 9 9 997 7 7 7 7 7 7 775 5 5 5 5 5 5 5 4 4 4 445 5 5 55',
notesSqr = [[
'9 9 9997 7 7775 5 77 99' + (b < 16 ? ' 99AC' : 'CEC9CE'),
'9 9 999A A AAAC A AA 99' + (b < 16 ? ' AA77' : 'CEC9CE')], [
'4 4 4440 2 2220 0 22 44' + (b < 16 ? ' 4457' : '797479'),
'4 4 4445 5 5557 5 55 44' + (b < 16 ? ' 5522' : '797479')], [
'C4797479E4797479C479747924797479'], [
'CC797479EE797479CC79747977797479'], [
'77242024992420247724202422242024']],
fxSqr = [[
'5 5 5T 5 5 5T 5 5 5T 5' + (b < 16 ? 'T 1T55' : 'SS4SSSS')], [
'5 5 55D5 5 1DD5 5 5T 5SOCSSSS'], [
'4SSSSSSS4SSSSSSS4SSSSSSSSSSSSSSS'], [
'4CSSS0444CSSS4444CSSS0444CSSS444'], [
'4C 0444C 4444C 0444C 444']],
gen = (char, octave) => 2112E4 * T / songSpeed * 2 ** ((parseInt(char, 36) + 12 * octave) / 12),
tri = x => ((x ^ -(x >> 8 & 1)) & 240) * (
// Clicks remover
i = 32 * T % 32,
j = 32 * T % 1,
i < 1 || i >= 16 && i < 17 ? j : i > 31 || i > 15 && i < 16 ? 1 - j : 1),
getChar = (arr, T) => arr[T >> 5 & arr.length - 1][T & 31],
sqr = (notesArr, fxArr, octave = 1, delay) => (
/* FX table:
87% 75% 50% Arpeggio
0 1 2 3 - Attack
4 5 6 7 - Clean
8 9 A B - Vibrato & Attack
C D E F - Vibrato
G H I J - Muted 1st half & Attack
K L M N - Muted 1st half
O P Q R - Muted 2nd half & Attack
S T U V - Muted 2nd half */
fx = parseInt(getChar(fxSqr[fxArr], T - delay), 36),
note = getChar(notesSqr[notesArr], T - delay),
isNaN(fx) || note === ' ' ? 0 : (
out = gen(note, octave - 2) *
/* 012389ABGHIJOPQR */ ((4 * T & 3) || (fx / 4 & 1) ? 1 : 2 ** (-1 / 12)) >> 8, // Attack
e = fx >> 3 & 3,
d = fx & 3,
128 * (((
/* 89ABCDEF */ e == 1 ? out + 64 * sin(2 * PI * T) : // Vibrato effect
/* GHIJKLMN */ e == 2 && !(2 * T & 1) || // Muted 1st half
/* OPQRSTUV */ e == 3 && (2 * T & 1) ? 0 : // Muted 2nd half
/* 01234567 */ out // No effect
) & 255) > (
/* 048CGKOS */ d == 0 ? 224 : // 87.5% duty cycle
/* 159DHLPT */ d == 1 ? 192 : // 75% duty cycle
/* 26AEIMQU */ d == 2 ? 128 : // 50% duty cycle
/* 37BFJNRV */ (8 * T & 3) < 2 ? 64 : 128))) // Arpeggio (25% + 50%)
),
lead = (n, f, o) => sqr(n, f, o, 0) + sqr(n, f, o, 1.5) / 2 + sqr(n, f, o, 3) / 3,
drum = (pitch, pattern, speed) =>
(1E5 * sin(pitch * T | 0) & 64) * (1 - 2 * T % 2 / 3) * (pattern >> (2 * T >> speed) & 1),
min(255,
// Ch1 Pulse Wave
(b < 32 ? lead(0, 0, 0) : b < 48 ? lead(0, 1) : b < 56 ? lead(2, 2) : lead(3, b < 80 ? 3 : 4)) / 3 +
// Ch2 Pulse Wave
(b < 32 ? lead(1, 0, 0) : b < 48 ? lead(1, 1) : b < 64 ? 0 : lead(4, 4, b < 72 || b > 80 ? 1 : 2)) / 3 +
// Ch3 Triangle Wave
.6 * tri(gen(notesTri[2 * T & 63], -3) / 64) +
(b < 80 &&
// Ch4 Noise Snare
drum(290, b < 15.5 ? 0x31111111 : 0xE4444444, 1) +
// Ch4 Noise Hats
(b < 15.5 ? drum(1E6, 0xC4A4A4A4, 1) : drum(1E6, 0xD4445444, 0)) / 3 +
// Ch5 Kick
(b > 16 && 50 * (sin(150 * (T % 4) ** .4) + 1) * (1 - T / 4 % 1)))
);
1 change: 1 addition & 0 deletions data/songs/minified/320dbf59c491e303445ffb29dc4364e0.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions data/songs/minified/6391726434fd5cfb0caa6389cedeb2b2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions data/songs/original/12d9714481c8d5f3edb5a0ffa90a21d5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
t?0:a=Array(nn=12288).fill(0),
SAMP_RATE = 44100,
ts = t/SAMP_RATE,
d = 261.63,
rb = 277.18,
r = 293.66,
mb = 311.13,
m = 329.63,
f = 349.23,
sb = 369.99,
s = 392.00,
lb = 415.30,
l = 440.00,
sib = 466.16,
si = 493.88,
n=x=>(ts*x*128),
bass=x=>n([l/2,l,l/2,[l,s,m,f][t/1.7>>12&3],s/2,s,s/2,[s,l,d*2,si][t/1.7>>12&3],sb/2,sb,sb/2,[sb,m,rb,mb][t/1.7>>12&3],s/2,s,[m,r][t/1.7>>13&1],[si/2,d][t/1.7>>13&1]][t/1.7>>14&15]*x/2),
wavb=(bass(1)%256+bass(1.01)%256+bass(0.99)%256)/6,
vib=t=>((t+30+sin(t/16384)&t+30*sin(t/8198)%255&64)+(t-5+30*sin(t/8198)+64&64)<64)*64,
wavv=vib(n([l,l,l,l,s,s,si,l,l,l,l,l,s,s,s,s,l,l,l,l,s,s,f,f,m,r,si/2,d,f,m,f,s][t/1.7>>13&31]))/2,
dr= (sin(20*log(t/1.7&16383))*(~t/1.7/2&4095)/16383*128),
ran= (random()*(~t/1.7/2&4095)/16383*128),
bass1=x=> n([l,s,sb,m][t/1.7>>16&3]/2*x)%256/6,
rbass=(bass1(1)+bass1(1.01)+bass1(0.99)+bass1(0.98)+bass1(1.02))/2+wavb,

ev=((dr+wavv+rbass/1.5+ran)/1.5-64)+a[t%nn], a[t%nn]= ev/2,ev
12 changes: 12 additions & 0 deletions data/songs/original/180264524874abd53cc27db9a0999764.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kick = 128 + 32 * sin(20 * cbrt(t % 32767 / 40)),
snare = random() * (-t & 8191) / 256,

j = t/4,

drum = ((t * sin(t >> 2) & 255) * (-t & 16383) / 6e4) * "01"[(t >> 14) % 2],

melody = (j * (j & 16384 ? 7 : 5) * (3 - (3 & j >> 9) +(3 & j >> 8)) >> (3 & -j >> (j & 4096 ? 12 : 16)) | j >> 3) % 256 / 4,

vibrato = (2 * j * (j & 16384 ? 7 : 5) * (3 - (3 & j >> 7) +(3 & j >> 12)) >> (3 & -j >> (j & 4096 ? 11 : 16)) & 128) % 256 * (-t & 8191) / 1e4 * "01" [(t >> 14) % 2],

64 - ((drum + snare + kick) + (vibrato + melody * 2) / 3)
29 changes: 29 additions & 0 deletions data/songs/original/20505c564f90dfe578635251a08b845d.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
r=t*1.25,l=16384,u=8192,c=4096,

mn=(k,x,y)=>min(max(k,x),y),

x=j=>mn((s=(a,b)=>t*2**(parseInt(a,36)/12)/b*.554%64-32,

mn(r>0&&(e=a=>s(['1358','79AE','0247','468B'][3&r>>18][3&(r>>11)>>(w='55443321'[7&r>>16])],a),

e(1)+e(j))*(1-r/(c<<w)%1)*8,-32,31)*(r/l/2%1)**.25

+(L=a=>(
s((G='1704')[K=3&r>>18],a)
+s('5A48'[K],a)
+s('8E7B'[K],a))*(r/32768%1)*(1-r/u%1*.75),L(.5)-L(j))

+mn(-(b=a=>s(G[3&r>>18],a)*8,b(8)+b(4/j))*(r/l%2)*(1-r%u/1E4)**2

+1E4*sin(6*cbrt(r%l))*(1-r/l%1/2)**14*!(r&l)/'14'[1&r>>15]

+((t*sin(t>>2)&64)-32)*(1-r/l/2%1)**6*14*!(~r&2*l)

,-64,63)

+(64*random()-32)*(1-r/u%1)**4

),-128,127)/2

*(r/l/2%1)**.25*(1-r/u%1*.5)**.25
,[x(1.005),x(.995)]
51 changes: 51 additions & 0 deletions data/songs/original/24d92502f2c20b00823993c97de81914.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
t || (
fx = Array(3e6).fill(0)
),

Z = t/1.4,
b = Z>>13,
B = b>>3,

fxi = 0, // iterates over the fx array
// inp - input
lp = (inp,w) => { // lowpass function (w - strength of effect (0 is the minimum value))
if (w == 0) return inp
out = inp + fx[fxi] // remove the "%256" if you are using floatbeat
fx[fxi] = out / (1+1/w)
fxi++
return fx[fxi-1] / w
},

dly = (inp,ti,fb) => { // delay function but stereo (ti - time (must be an integer), fb - feedback (min - 0, max - 1))
this.dl ??= Array(ti).fill(0)
this.dr ??= Array(ti).fill(0)
if (fb == 0) return inp
out = [(inp%256)+dl.shift(),(inp%256)+dr.shift()]
dl.push(out[0]*fb)
dr.push(dl[0])
return out
},

// envelope function gergerhgkerjfvkdsahfsakfdlnk
env = (a,r,t) => ( // attack, release, time
a_ = min(1,t/a),
r_ = 1-(t-a)/r,
max(0,(t>a?r_:a_))
),

BBtFB = (x) => x%256/128-1, // bytebeat to floatbeat
noise = t => sin(t**7),

sidechain = min(1,2*(Z/16384%1)),
T=(n,p=600,a=5)=>.08*(1<<(n+=4)/7)*1.0594**(2*n%14-(3<n%7))*(t+a*sin(t/p))%128,
c=n=>T(n)+T(n+2)+T(n+4)+T(n+6),
m=(b^B+3)%12+14,
r=17-B%4,+T(m,450,2)+.3*c(r)+T(r-14)/2,
mel = dly(BBtFB(lp(T(m+7),5/max(.1,env(1e3,7192,Z%8192))))+.5,D=12288*1.4|0,.5),
noi = lp(random()-.5,50)*2,
bas = dly((lp(BBtFB(T(r-7))/2,10)+.25)*2,D,.5),
chords = dly(lp(BBtFB(c(r)/2),5)*env(16284,100,Z%16384),D,.5),
kick = tanh(sin(sqrt(Z/16384%1)*150))*3*(1-Z/16384%1)**5*!(b/2&1),
snr = sin(sqrt(Z/16384%1+noise(t>>1)/1500)*400)*(1-Z/16384%1)**3*(b&2),
hat = noise(t)*(1-Z/8192%1)**2/7,
[(mel[0]+bas[0]+chords[0])*sidechain+noi+kick+snr+hat,(mel[1]+bas[1]+chords[1])*sidechain+noi+kick+snr+hat].map(x=>x/2)
20 changes: 20 additions & 0 deletions data/songs/original/38019eb7c69c6129ad15038e784305a0.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
l = 0
rm = 0

return t => {
T = t * 1.2
// chords
s = 0
for (let i = 0; i < 5; i++) {
s += 30**cbrt(sin(t*PI*(1.5**i)*(m=300-((T>>2&3)*50))))*(1-T%1)/200*(i&1?-1:1)
}

p = t/128*m*(T*2&1?128:64)&1
l += rm += (p-l-rm*2) / (170*sin(t)+200)
b = (l+p) / 10 * (1-T%.5*2)

k = sin(100*(z=(T+(T&1?-.25:0))%1)**.5)/2*(1-z)**20
h = (random()*(1-(1+T+(T*2&1?.25:-.25))%1)**200)/4
c = (random()*(1-(T+.5)%1)**500+sin(t*PI*5000)*(1-(T+.5)%1)**150)/2
return s+k+h+c+b
}
Loading

0 comments on commit 49e1335

Please sign in to comment.