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);