From 8111ea2daa73053a689aaf26cd2c6a81355025b9 Mon Sep 17 00:00:00 2001 From: ergz Date: Mon, 9 Oct 2023 23:13:45 -0700 Subject: [PATCH] removes the filter for now since it was causing a lot clipping that needs to be figured out --- synth.html | 28 ---------------------------- synth.js | 43 +++++++++++++++++++------------------------ 2 files changed, 19 insertions(+), 52 deletions(-) diff --git a/synth.html b/synth.html index b8a020a..70c6818 100644 --- a/synth.html +++ b/synth.html @@ -104,34 +104,6 @@ - -
-
-
- Keyboard - - - - - - - - - - - - - - - - - - - - - -
-
diff --git a/synth.js b/synth.js index aa2b1e8..e7dc24c 100644 --- a/synth.js +++ b/synth.js @@ -30,9 +30,18 @@ function composeChord(chord) { case "E": { return ["E", "G", "B"]; } - case "B": { + case "F": { + return ["F", "A", "C"]; + } + case "G": { + return ["G", "B", "D"]; + } + case "A": { return ["A", "C", "E"]; } + case "B": { + return ["B", "D", "F"]; + } default: { return ["C", "D", "E"]; } @@ -243,20 +252,6 @@ window.onload = function () { } }); - // handle note changes - document.querySelectorAll("input[name='notechoice']").forEach((rb) => { - rb.addEventListener("change", (event) => { - let noteSelected = document.querySelector( - "input[name='notechoice']:checked" - ).value; - - for (let i = 0; i < synth.oscillators.length; i++) { - let osc = synth.oscillators[i]; - updateFrequency(event, synth, osc, i, noteSelected, null, null); - } - }); - }); - // handle waveform selection document.querySelectorAll("input[name='wavechoice1']").forEach((rb) => { rb.addEventListener("change", (event) => { @@ -299,15 +294,15 @@ window.onload = function () { updateFrequency(event, synth, osc, 0, null, null, detune); }); - const filterSliderVoice1 = document.getElementById("filtervoice1"); - const filtervoice1Display = document.getElementById("filtervoice1display"); - filterSliderVoice1.addEventListener("input", (event) => { - const osc = synth.oscillators[0]; - let selectedFreq = parseFloat(filterSliderVoice1.value); - const lpf = synth.createFilter("lowpass", 500, 1); - osc.osc.connect(lpf); - lpf.connect(synth.gain); - }); + // const filterSliderVoice1 = document.getElementById("filtervoice1"); + // const filtervoice1Display = document.getElementById("filtervoice1display"); + // filterSliderVoice1.addEventListener("input", (event) => { + // const osc = synth.oscillators[0]; + // let selectedFreq = parseFloat(filterSliderVoice1.value); + // const lpf = synth.createFilter("lowpass", 500, 1); + // osc.osc.connect(lpf); + // lpf.connect(synth.gain); + // }); // handle chord changes document.querySelectorAll("input[name='chordchoice']").forEach((rb) => {