diff --git a/synth.html b/synth.html index ebe9b93..c4a92a2 100644 --- a/synth.html +++ b/synth.html @@ -40,11 +40,11 @@ 0 -
+
@@ -78,6 +78,13 @@
+
+ + + 0 +
+ +
@@ -109,6 +116,13 @@
+ +
+ + + 0 +
+
diff --git a/synth.js b/synth.js index 6dea53b..5ef9c93 100644 --- a/synth.js +++ b/synth.js @@ -291,13 +291,17 @@ window.onload = function () { setupOctaveControls(i, synth); // Call setupOctaveControls for each voice } // detune - const detuneSliderVoice1 = document.getElementById("detunevoice1"); - const detunevoice1Display = document.getElementById("detunevoice1display"); - detuneSliderVoice1.addEventListener("input", (event) => { - let osc = synth.oscillators[0]; - let detune = parseFloat(detuneSliderVoice1.value); - console.log(detune); - updateFrequency(event, synth, osc, 0, null, null, detune); + ["1", "2", "3"].forEach((voiceNumber, index) => { + const detuneSlider = document.getElementById(`detunevoice${voiceNumber}`); + const detuneDisplay = document.getElementById( + `detunevoice${voiceNumber}display` + ); + detuneSlider.addEventListener("input", (event) => { + let osc = synth.oscillators[index]; + let detune = parseFloat(detuneSlider.value); + console.log(detune); + updateFrequency(event, synth, osc, index, null, null, detune); + }); }); // const filterSliderVoice1 = document.getElementById("filtervoice1");