add detune to rest of the voices

This commit is contained in:
2023-10-12 23:05:37 -07:00
parent 3773cfd778
commit 77af7d2576
2 changed files with 27 additions and 9 deletions

View File

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