Bass Boosted
của MusicBar, visualizer
Cột nhạc chiên giòn kiểu meme bass boosted, bass vặn lố tới rè, màu cháy gắt vỡ khối như ảnh nén nát, cứ tới nhịp là cả thanh giật bần bật và lóe tia đỏ như mắt laser.
Cách cài, mã SHA-256 và mã nguồn
Bấm Áp dụng: MusicBar tự tải về, kiểm tra mã SHA-256 rồi mặc lên taskbar; có rồi thì mặc luôn. Cần MusicBar 1.8 trở lên.
SHA-256 e44e51689fc21b12f63bc365ec11e1036dd9a09af62c08f5225610985bc22d5a
//! name: Bass Boosted
//! author: MusicBar
//! kind: visualizer
//! description: A deep-fried spectrum with the bass cranked way past the limit clips and crunches into blocky, oversaturated columns, jolting and bulging on every kick while red lens-flare glints flash like laser eyes.
// A steady random number for a whole number.
float hash1(float n) { n = frac(n * 0.1031); n *= n + 33.33; n *= n + n; return frac(n); }
// The column height at x (pixels): the spectrum mirrored round the middle, with the bass boosted far too much.
float tower(float x)
{
float xn = abs(x / size.x - 0.5) * 2.0;
float s = spectrum(xn * 0.85);
return s * (0.42 + 0.25 * level) * (1.0 + 1.9 * exp(-xn * 3.0)) * (1.0 + 0.3 * beat) * size.y;
}
// A red lens flare: hot core, a long sideways streak, a short spike, thin diagonals and a faint ring.
float flare(float2 d, float u)
{
float r = length(d);
float2 dr = float2(d.x + d.y, d.x - d.y) * 0.7071;
float f = exp(-r / (0.06 * u)) * 1.6;
f += exp(-abs(d.y) / (0.02 * u) - abs(d.x) / (1.8 * u)) * 1.1;
f += exp(-abs(d.x) / (0.018 * u) - abs(d.y) / (0.35 * u)) * 0.7;
f += (exp(-abs(dr.x) / (0.014 * u) - abs(dr.y) / (0.22 * u)) + exp(-abs(dr.y) / (0.014 * u) - abs(dr.x) / (0.22 * u))) * 0.5;
return f + exp(-abs(r - 0.32 * u) / (0.025 * u)) * 0.3;
}
// The palette ramp up a column: second color at the foot, main color in the middle, accent near the top.
float3 ramp(float t) { return lerp(lerp(colorB.rgb, colorA.rgb, saturate(t / 0.35)), colorC.rgb, saturate((t - 0.35) / 0.4)); }
// Lays a color over what is there (premultiplied light, and how much of the pixel it covers).
void layer(inout float3 acc, inout float cover, float3 rgb, float a)
{
a = saturate(a);
acc = rgb * a + acc * (1.0 - a);
cover = a + cover * (1.0 - a);
}
float4 main(float2 uv : TEXCOORD) : COLOR
{
float u = size.y;
float frame = floor(time * 15.0); // the crunch re-rolls at a choppy 15 frames a second
float2 scr = float2(uv.x * size.x, rise(uv) * u); // pixels, up from the screen edge
// Kick shake: the picture jolts to a new spot every frame while the beat lasts, and the middle bulges out.
float2 jolt = (float2(hash1(frame * 1.7 + 0.3), hash1(frame * 2.9 + 5.1)) - 0.5) * u * (0.2 * beat + 0.03 * level);
float2 dc = scr + jolt - float2(size.x * 0.5, 0.0);
float2 p = float2(size.x * 0.5, 0.0) + dc * (1.0 - 0.3 * beat * exp(-dot(dc, dc) / (9.0 * u * u)));
// Chunky columns two JPEG blocks wide with a gap between; tops past the limit clip flat and fizz.
float B = max(floor(u / 5.0 + 0.5), 3.0), cw = 2.0 * B, gap = max(floor(B * 0.3), 1.0);
float ci = floor(p.x / cw), fx = p.x - ci * cw;
float clipH = 0.82 * u;
float raw = tower((ci + 0.5) * cw);
float hot = step(clipH, raw);
float H = max(min(raw, clipH) + (hash1(ci * 3.1 + frame * 7.7) - 0.5) * 0.12 * u * hot, 0.06 * u);
float y = p.y;
float2 e = float2(abs(fx - cw * 0.5) - (cw - gap) * 0.5, y - H);
float d = length(max(e, 0.0)) + min(max(e.x, e.y), 0.0); // signed distance to the column, pixels
// Louder columns get crunchier: fewer color levels, flatter blocks, more ringing and grain.
float crunch = saturate(0.15 + 1.2 * (raw / u - 0.35) + 0.5 * beat + 0.4 * (level - 0.5));
// The deep-fried fill: palette ramp, pulled flat per JPEG block, oversaturated, contrast blown out.
float blockY = (floor(y / B) + 0.5) * B;
float3 col = lerp(ramp(y / clipH), ramp(blockY / clipH), 0.8 * crunch);
col = lerp(col, float3(1.0, 0.97, 0.85), hot * smoothstep(clipH - 0.2 * u, clipH, y));
col = lerp(col, float3(1.0, 0.0, 0.08), 0.35 * beat); // every kick floods it red
col = saturate(lerp(dot(col, float3(0.3, 0.59, 0.11)), col, 1.7 + 0.8 * crunch));
col = saturate((col - 0.5) * (1.3 + 0.5 * crunch) + 0.56);
// JPEG ringing: the blocks the column top runs through get a checkery cosine pattern.
float2 bc = floor(float2(fx, y) / B), bi = floor(frac(float2(fx, y) / B) * 8.0);
float bh = hash1(ci * 2.31 + bc.x * 1.7 + bc.y * 57.7 + floor(time * 4.0) * 0.37);
float basis = cos(3.1416 * (2.0 * bi.x + 1.0) * (1.0 + floor(bh * 4.0)) / 16.0) * cos(3.1416 * (2.0 * bi.y + 1.0) * (1.0 + floor(frac(bh * 7.3) * 4.0)) / 16.0);
float edgeBlock = step(bc.y * B - 0.5 * B, H) * step(H, bc.y * B + 1.5 * B);
col += basis * (0.15 + 0.35 * crunch) * edgeBlock;
// Grain, then posterize with a coarse ordered dither.
float dp = max(floor(u / 24.0), 1.0);
float2 gq = floor(scr / dp);
col += (hash1(gq.x * 0.71 + gq.y * 13.3 + frame * 3.7) - 0.5) * (0.08 + 0.2 * crunch);
float levels = lerp(6.0, 2.5, crunch);
col = saturate(floor(col * levels + frac(gq.x * 0.5 + gq.y * 0.75)) / levels);
float glitch = step(0.93, hash1(bc.x * 3.7 + bc.y * 11.1 + ci * 0.73 + frame * 0.11)) * step(0.5, crunch);
col = lerp(col, col.gbr, glitch * 0.65); // a few blocks lose their chroma and go the wrong color
float3 acc = float3(0, 0, 0);
float cover = 0;
// A fried bloom over the whole skyline, faint mosquito noise just above each top, an oversharpened dark rim.
float sky = tower(p.x);
layer(acc, cover, lerp(colorB.rgb, colorC.rgb, 0.4), exp(-max(y - min(sky, clipH), 0.0) / (0.16 * u)) * step(0.0, d) * (0.12 + 0.3 * crunch));
layer(acc, cover, lerp(ramp(H / clipH), float3(1, 1, 1), 0.3), step(e.x, 0.0) * step(0.0, e.y) * step(e.y, B) * crunch * saturate(0.35 * basis));
layer(acc, cover, float3(0.06, 0.0, 0.03), smoothstep(0.07 * u, 0.0, d) * step(0.0, d) * 0.7);
// The column (a little see-through at its foot), a hot inner rim, and red and cyan ghosts that split apart on the kick.
float body = smoothstep(0.5, -0.5, d);
float sp = 0.08 * u * beat + 0.5;
float2 eR = float2(abs(fx + sp - cw * 0.5) - (cw - gap) * 0.5, y + 0.5 * sp - H), eC = float2(abs(fx - sp - cw * 0.5) - (cw - gap) * 0.5, y - 0.5 * sp - H);
float ghostR = smoothstep(0.5, -0.5, length(max(eR, 0.0)) + min(max(eR.x, eR.y), 0.0));
float ghostC = smoothstep(0.5, -0.5, length(max(eC, 0.0)) + min(max(eC.x, eC.y), 0.0));
layer(acc, cover, float3(1.0, 0.05, 0.2), saturate(ghostR - body) * 0.9);
layer(acc, cover, float3(0.1, 0.95, 1.0), saturate(ghostC - body) * (0.3 + 0.7 * beat));
layer(acc, cover, col, body * lerp(0.6, 1.0, saturate(y / (0.3 * u))));
layer(acc, cover, float3(1.0, 1.0, 0.85), smoothstep(-0.06 * u, 0.0, d) * body * 0.5);
// Laser-eye glints: on each kick a pair of red lens flares pops on the column tops at random spots.
float gw = 5.0 * u, g0 = floor(p.x / gw), g1 = g0 + sign(frac(p.x / gw) - 0.5);
float ep = floor(time * 1.9);
float h0 = hash1(g0 * 7.3 + ep * 13.1), h1 = hash1(g1 * 7.3 + ep * 13.1);
float gx0 = (g0 + 0.2 + 0.5 * hash1(h0 * 91.0)) * gw, gx1 = (g1 + 0.2 + 0.5 * hash1(h1 * 91.0)) * gw;
float gy0 = clamp(tower(gx0), 0.3 * u, 0.72 * u), gy1 = clamp(tower(gx1), 0.3 * u, 0.72 * u);
float pop = pow(beat, 0.5) * (0.8 + 0.4 * level);
float f0 = (flare(p - float2(gx0, gy0), u) + flare(p - float2(gx0 + 0.42 * u, gy0 + 0.02 * u), u)) * step(h0, 0.5 + 0.3 * level);
float f1 = (flare(p - float2(gx1, gy1), u) + flare(p - float2(gx1 + 0.42 * u, gy1 + 0.02 * u), u)) * step(h1, 0.5 + 0.3 * level);
float f = (f0 + f1) * pop;
layer(acc, cover, lerp(float3(1.0, 0.06, 0.04), float3(1.0, 0.95, 0.9), saturate(f - 1.3)), saturate(f));
return paint(acc / max(cover, 0.001), cover);
}