From dae39818f941ceb32f96e2962e6ec49134460f20 Mon Sep 17 00:00:00 2001 From: Armin Date: Wed, 8 Jul 2026 19:42:06 +0200 Subject: [PATCH] wire volume gain node in audio graph and volume slider --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index c4ad8fd..89a6a4e 100644 --- a/index.html +++ b/index.html @@ -364,7 +364,10 @@ function initAudioCtx() { gainB.connect(splitter); splitter.connect(analyserL, 0); splitter.connect(analyserR, 1); - analyser.connect(audioCtx.destination); + volumeGain = audioCtx.createGain(); + volumeGain.gain.value = parseFloat(volumeSlider.value); + analyser.connect(volumeGain); + volumeGain.connect(audioCtx.destination); } catch (e) {} } const canvas = document.getElementById('spectrum'); @@ -1673,8 +1676,7 @@ waveformWrap.addEventListener('click', (e) => { }); volumeSlider.addEventListener('input', () => { const v = parseFloat(volumeSlider.value); - audioElA.volume = v; - audioElB.volume = v; + if (volumeGain) volumeGain.gain.value = v; volDisplay.textContent = Math.round(v * 100); }); addFolderBtn.addEventListener('click', addFolder);