removes the filter for now since it was causing a lot clipping that needs to be figured out
This commit is contained in:
parent
e7ea3a5db8
commit
8111ea2daa
28
synth.html
28
synth.html
|
@ -104,34 +104,6 @@
|
|||
|
||||
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<form style="padding: 15px">
|
||||
<fieldset>
|
||||
<legend>Keyboard</legend>
|
||||
<input type="radio" id="noteC" name="notechoice" value="C" checked>
|
||||
<label for="C">C</label>
|
||||
|
||||
<input type="radio" id="noteD" name="notechoice" value="D">
|
||||
<label for="D">D</label>
|
||||
|
||||
<input type="radio" id="noteE" name="notechoice" value="E">
|
||||
<label for="E">E</label>
|
||||
|
||||
<input type="radio" id="noteF" name="notechoice" value="F">
|
||||
<label for="F">F</label>
|
||||
|
||||
<input type="radio" id="noteG" name="notechoice" value="G">
|
||||
<label for="G">G</label>
|
||||
|
||||
<input type="radio" id="noteA" name="notechoice" value="A">
|
||||
<label for="A">A</label>
|
||||
|
||||
<input type="radio" id="noteB" name="notechoice" value="B">
|
||||
<label for="B">B</label>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form style="padding: 15px">
|
||||
|
|
43
synth.js
43
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) => {
|
||||
|
|
Loading…
Reference in New Issue