From 4d156074d2286b20519bde4e4b1e80ad3ff646de Mon Sep 17 00:00:00 2001 From: Vivek Rajput Date: Mon, 23 Nov 2026 22:26:12 +0530 Subject: [PATCH 1/6] fix: soften distorted Force Surge sound effect --- src/assets/js/script.js | 61 +++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/src/assets/js/script.js b/src/assets/js/script.js index 234c576a..c8845bb8 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -123,7 +123,7 @@ window.playSound = function playSound(type) { osc.start(now); osc.stop(now + 1.5); } else { - const config = LAYERED_SOUND_CONFIGS[type]; + const config = LAYERED_SOUND_CONFIGS[type]; if (!config) return; osc.type = config.oscillatorType; @@ -486,37 +486,52 @@ function playForceSoundtrack(duration = 8000) { initAudio(); if (!audioCtx) return; - // 1. Create a Master Compressor to prevent distortion + const now = audioCtx.currentTime; + const seconds = duration / 1000; + + // Master compressor: gentle settings to avoid pumping/crackle const compressor = audioCtx.createDynamicsCompressor(); - compressor.threshold.setValueAtTime(-24, audioCtx.currentTime); - compressor.knee.setValueAtTime(40, audioCtx.currentTime); - compressor.ratio.setValueAtTime(12, audioCtx.currentTime); - compressor.attack.setValueAtTime(0, audioCtx.currentTime); - compressor.release.setValueAtTime(0.25, audioCtx.currentTime); + compressor.threshold.setValueAtTime(-24, now); + compressor.knee.setValueAtTime(30, now); + compressor.ratio.setValueAtTime(4, now); + compressor.attack.setValueAtTime(0.01, now); + compressor.release.setValueAtTime(0.25, now); compressor.connect(audioCtx.destination); - const now = audioCtx.currentTime; - const masterGain = audioCtx.createGain(); - masterGain.connect(compressor); + // Lowpass filter: removes harsh high frequencies + const filter = audioCtx.createBiquadFilter(); + filter.type = "lowpass"; + filter.frequency.setValueAtTime(800, now); + filter.connect(compressor); - // Smooth volume swell - masterGain.gain.setValueAtTime(0, now); - masterGain.gain.linearRampToValueAtTime(0.6, now + 1.5); - masterGain.gain.setValueAtTime(0.6, now + duration / 1000 - 2); - masterGain.gain.exponentialRampToValueAtTime(0.001, now + duration / 1000); + // Master volume: smooth swell in and fade out + const masterGain = audioCtx.createGain(); + masterGain.connect(filter); + masterGain.gain.setValueAtTime(0.0001, now); + masterGain.gain.linearRampToValueAtTime(0.25, now + 1.5); + masterGain.gain.setValueAtTime(0.25, now + seconds - 2); + masterGain.gain.exponentialRampToValueAtTime(0.001, now + seconds); + + // Harmonic stack: each oscillator has its own small gain so the sum never clips + const layers = [ + { freq: 55, type: "triangle", level: 0.5 }, + { freq: 110, type: "triangle", level: 0.3 }, + { freq: 164.81, type: "sine", level: 0.3 }, + ]; - // Create the "Harmonic Stack" (Multiple notes for a rich sound) - [55, 110, 164.81].forEach((freq, i) => { + layers.forEach(({ freq, type, level }, i) => { const osc = audioCtx.createOscillator(); - osc.type = i === 0 ? "sawtooth" : "triangle"; // Mix textures - osc.frequency.setValueAtTime(freq, now); + const oscGain = audioCtx.createGain(); - // Add a slight "wobble" (detune) for realism - osc.detune.setValueAtTime(i * 5, now); + osc.type = type; + osc.frequency.setValueAtTime(freq, now); + osc.detune.setValueAtTime(i * 5, now); // slight wobble + oscGain.gain.setValueAtTime(level, now); - osc.connect(masterGain); + osc.connect(oscGain); + oscGain.connect(masterGain); osc.start(now); - osc.stop(now + duration / 1000); + osc.stop(now + seconds); }); } From ff7ddfbfdb2e30e81137b584abb1126409e5d197 Mon Sep 17 00:00:00 2001 From: Vivek Rajput Date: Mon, 23 Nov 2026 22:49:50 +0530 Subject: [PATCH 2/6] fix DeepSource JS-0067 --- src/assets/js/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/js/script.js b/src/assets/js/script.js index c8845bb8..0073ee32 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -482,7 +482,7 @@ function updateThemeIcon(theme) { /** * 5. EASTER EGG LOGIC & TRIGGERS */ -function playForceSoundtrack(duration = 8000) { +window.playForceSoundtrack = function (duration = 8000) { initAudio(); if (!audioCtx) return; @@ -535,7 +535,7 @@ function playForceSoundtrack(duration = 8000) { }); } -function triggerForceSurge() { +window.triggerForceSurge = function () { if (isSurging) return; isSurging = true; From c3df5dda99320bbb81e3d30ca9d222878cb992fe Mon Sep 17 00:00:00 2001 From: Vivek Rajput Date: Mon, 23 Nov 2026 23:22:07 +0530 Subject: [PATCH 3/6] fix global function references --- src/assets/js/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/js/script.js b/src/assets/js/script.js index 0073ee32..328cf6b9 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -540,7 +540,7 @@ window.triggerForceSurge = function () { isSurging = true; // 1. Audio - playForceSoundtrack(8000); + window.playForceSoundtrack(8000); // 2. Add Overlay const overlay = document.createElement("div"); @@ -1412,7 +1412,7 @@ function handleFooterDotClick() { // 3. Update the global unlockedEggs array if (!unlockedEggs.includes("secret_footer_surge")) { // Trigger the main function - triggerForceSurge(); + window.triggerForceSurge(); unlockedEggs.push("secret_footer_surge"); localStorage.setItem("unlockedEggs", JSON.stringify(unlockedEggs)); From e07facc76d18476c79e6fa69d91d1bfbb704dd28 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Fri, 27 Nov 2026 11:33:05 +1000 Subject: [PATCH 4/6] Fix syntax error in script.js Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/assets/js/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/js/script.js b/src/assets/js/script.js index 328cf6b9..eeb2a323 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -123,7 +123,7 @@ window.playSound = function playSound(type) { osc.start(now); osc.stop(now + 1.5); } else { - const config = LAYERED_SOUND_CONFIGS[type]; + const config = LAYERED_SOUND_CONFIGS[type]; if (!config) return; osc.type = config.oscillatorType; From 1442f578bfe68f881874b27b8811660beed3c690 Mon Sep 17 00:00:00 2001 From: Vivek Rajput Date: Fri, 27 Nov 2026 15:09:48 +0530 Subject: [PATCH 5/6] fix: formatting in script.js --- src/assets/js/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/js/script.js b/src/assets/js/script.js index eeb2a323..2f1e18fa 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -533,7 +533,7 @@ window.playForceSoundtrack = function (duration = 8000) { osc.start(now); osc.stop(now + seconds); }); -} +}; window.triggerForceSurge = function () { if (isSurging) return; @@ -573,7 +573,7 @@ window.triggerForceSurge = function () { flash.remove(); isSurging = false; }, 8000); -} +}; // biome-ignore lint/correctness/noUnusedVariables: Used outside this classic script. function triggerMagicXP() { From 38fd78e9deb0c26a6132cc522aa0ba21e47cb7d2 Mon Sep 17 00:00:00 2001 From: Vivek Rajput Date: Fri, 27 Nov 2026 15:23:06 +0530 Subject: [PATCH 6/6] fix: make Force Surge audible on small speakers --- src/assets/js/script.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/assets/js/script.js b/src/assets/js/script.js index 2f1e18fa..e85c3c4f 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -501,22 +501,22 @@ window.playForceSoundtrack = function (duration = 8000) { // Lowpass filter: removes harsh high frequencies const filter = audioCtx.createBiquadFilter(); filter.type = "lowpass"; - filter.frequency.setValueAtTime(800, now); + filter.frequency.setValueAtTime(2000, now); filter.connect(compressor); // Master volume: smooth swell in and fade out const masterGain = audioCtx.createGain(); masterGain.connect(filter); masterGain.gain.setValueAtTime(0.0001, now); - masterGain.gain.linearRampToValueAtTime(0.25, now + 1.5); - masterGain.gain.setValueAtTime(0.25, now + seconds - 2); + masterGain.gain.linearRampToValueAtTime(0.5, now + 1.5); + masterGain.gain.setValueAtTime(0.5, now + seconds - 2); masterGain.gain.exponentialRampToValueAtTime(0.001, now + seconds); // Harmonic stack: each oscillator has its own small gain so the sum never clips - const layers = [ - { freq: 55, type: "triangle", level: 0.5 }, - { freq: 110, type: "triangle", level: 0.3 }, - { freq: 164.81, type: "sine", level: 0.3 }, + const layers = [ + { freq: 110, type: "triangle", level: 0.4 }, + { freq: 220, type: "triangle", level: 0.3 }, + { freq: 330, type: "sine", level: 0.3 }, ]; layers.forEach(({ freq, type, level }, i) => {