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>
|
||||||
<div>
|
<div>
|
||||||
<form style="padding: 15px">
|
<form style="padding: 15px">
|
||||||
|
|
43
synth.js
43
synth.js
|
@ -30,9 +30,18 @@ function composeChord(chord) {
|
||||||
case "E": {
|
case "E": {
|
||||||
return ["E", "G", "B"];
|
return ["E", "G", "B"];
|
||||||
}
|
}
|
||||||
case "B": {
|
case "F": {
|
||||||
|
return ["F", "A", "C"];
|
||||||
|
}
|
||||||
|
case "G": {
|
||||||
|
return ["G", "B", "D"];
|
||||||
|
}
|
||||||
|
case "A": {
|
||||||
return ["A", "C", "E"];
|
return ["A", "C", "E"];
|
||||||
}
|
}
|
||||||
|
case "B": {
|
||||||
|
return ["B", "D", "F"];
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
return ["C", "D", "E"];
|
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
|
// handle waveform selection
|
||||||
document.querySelectorAll("input[name='wavechoice1']").forEach((rb) => {
|
document.querySelectorAll("input[name='wavechoice1']").forEach((rb) => {
|
||||||
rb.addEventListener("change", (event) => {
|
rb.addEventListener("change", (event) => {
|
||||||
|
@ -299,15 +294,15 @@ window.onload = function () {
|
||||||
updateFrequency(event, synth, osc, 0, null, null, detune);
|
updateFrequency(event, synth, osc, 0, null, null, detune);
|
||||||
});
|
});
|
||||||
|
|
||||||
const filterSliderVoice1 = document.getElementById("filtervoice1");
|
// const filterSliderVoice1 = document.getElementById("filtervoice1");
|
||||||
const filtervoice1Display = document.getElementById("filtervoice1display");
|
// const filtervoice1Display = document.getElementById("filtervoice1display");
|
||||||
filterSliderVoice1.addEventListener("input", (event) => {
|
// filterSliderVoice1.addEventListener("input", (event) => {
|
||||||
const osc = synth.oscillators[0];
|
// const osc = synth.oscillators[0];
|
||||||
let selectedFreq = parseFloat(filterSliderVoice1.value);
|
// let selectedFreq = parseFloat(filterSliderVoice1.value);
|
||||||
const lpf = synth.createFilter("lowpass", 500, 1);
|
// const lpf = synth.createFilter("lowpass", 500, 1);
|
||||||
osc.osc.connect(lpf);
|
// osc.osc.connect(lpf);
|
||||||
lpf.connect(synth.gain);
|
// lpf.connect(synth.gain);
|
||||||
});
|
// });
|
||||||
|
|
||||||
// handle chord changes
|
// handle chord changes
|
||||||
document.querySelectorAll("input[name='chordchoice']").forEach((rb) => {
|
document.querySelectorAll("input[name='chordchoice']").forEach((rb) => {
|
||||||
|
|
Loading…
Reference in New Issue