diff --git a/assets/audio/flute/a4.mp3 b/assets/audio/flute/a4.mp3 new file mode 100644 index 0000000..3c9c67a Binary files /dev/null and b/assets/audio/flute/a4.mp3 differ diff --git a/assets/audio/flute/a5.mp3 b/assets/audio/flute/a5.mp3 new file mode 100644 index 0000000..9f5a47a Binary files /dev/null and b/assets/audio/flute/a5.mp3 differ diff --git a/assets/audio/flute/a6.mp3 b/assets/audio/flute/a6.mp3 new file mode 100644 index 0000000..e5c3bb1 Binary files /dev/null and b/assets/audio/flute/a6.mp3 differ diff --git a/assets/audio/flute/ds4.mp3 b/assets/audio/flute/ds4.mp3 new file mode 100644 index 0000000..232f0ce Binary files /dev/null and b/assets/audio/flute/ds4.mp3 differ diff --git a/assets/audio/flute/ds5.mp3 b/assets/audio/flute/ds5.mp3 new file mode 100644 index 0000000..72272b0 Binary files /dev/null and b/assets/audio/flute/ds5.mp3 differ diff --git a/assets/audio/flute/ds6.mp3 b/assets/audio/flute/ds6.mp3 new file mode 100644 index 0000000..299f832 Binary files /dev/null and b/assets/audio/flute/ds6.mp3 differ diff --git a/assets/audio/horn/a3.mp3 b/assets/audio/horn/a3.mp3 new file mode 100644 index 0000000..e7b97df Binary files /dev/null and b/assets/audio/horn/a3.mp3 differ diff --git a/assets/audio/horn/a4.mp3 b/assets/audio/horn/a4.mp3 new file mode 100644 index 0000000..b1e35be Binary files /dev/null and b/assets/audio/horn/a4.mp3 differ diff --git a/assets/audio/horn/a5.mp3 b/assets/audio/horn/a5.mp3 new file mode 100644 index 0000000..0ba9423 Binary files /dev/null and b/assets/audio/horn/a5.mp3 differ diff --git a/assets/audio/horn/ds3.mp3 b/assets/audio/horn/ds3.mp3 new file mode 100644 index 0000000..8634c49 Binary files /dev/null and b/assets/audio/horn/ds3.mp3 differ diff --git a/assets/audio/horn/ds4.mp3 b/assets/audio/horn/ds4.mp3 new file mode 100644 index 0000000..22d24e7 Binary files /dev/null and b/assets/audio/horn/ds4.mp3 differ diff --git a/assets/audio/horn/ds5.mp3 b/assets/audio/horn/ds5.mp3 new file mode 100644 index 0000000..ffba39a Binary files /dev/null and b/assets/audio/horn/ds5.mp3 differ diff --git a/index.html b/index.html index 2b54ea5..735cc44 100644 --- a/index.html +++ b/index.html @@ -110,21 +110,8 @@

play notes

instrument: effect (experimental): diff --git a/main.js b/main.js index 7e5c2fd..b69c8ce 100644 --- a/main.js +++ b/main.js @@ -409,13 +409,72 @@ document.addEventListener("DOMContentLoaded", () => { console.log("musicbox samples loaded"); }, }), // 2 musicbox sampler - new Tone.PolySynth(Tone.Synth), // 3 - new Tone.PolySynth(Tone.DuoSynth), // 4 - new Tone.PolySynth(Tone.FMSynth), // 5 - new Tone.PolySynth(Tone.AMSynth), // 6 + new Tone.Sampler({ + urls: { + "A4": "a4.mp3", + "A5": "a5.mp3", + "A6": "a6.mp3", + "D#4": "ds4.mp3", + "D#5": "ds5.mp3", + "D#6": "ds6.mp3", + }, + baseUrl: "./assets/audio/flute/", + onload: () => { + console.log("flute samples loaded"); + }, + }), // 3 flute sampler + new Tone.Sampler({ + urls: { + "A3": "a3.mp3", + "A4": "a4.mp3", + "A5": "a5.mp3", + "D#3": "ds3.mp3", + "D#4": "ds4.mp3", + "D#5": "ds5.mp3", + }, + baseUrl: "./assets/audio/horn/", + onload: () => { + console.log("horn samples loaded"); + }, + }), // 3 flute sampler + new Tone.PolySynth(Tone.Synth), // 4 + new Tone.PolySynth(Tone.DuoSynth), // 5 + new Tone.PolySynth(Tone.FMSynth), // 6 + new Tone.PolySynth(Tone.AMSynth), // 7 // todo: explore & add more ]; + + const instrumentNames = [ + "Piano (Sampler)", + "E-Guitar (Sampler)", + "Music Box (Sampler)", + "Flute (Sampler)", + "Horn (Sampler)", + "Synth", + "Duo Synth", + "FM Synth", + "AM Synth" + ] + + // dynamically update select elements + for (var i = 0; i < instrumentNames.length; i++) { + instrumentSelection.appendChild( + Object.assign( + document.createElement("option"), + { value: i, innerHTML: instrumentNames[i] } + ) + ); + } + + for (var i = 0; i < effectNodes.length; i++) { + effectSelection.appendChild( + Object.assign( + document.createElement("option"), + { value: i, innerHTML: effectNodes[i] != null ? effectNodes[i].name : "None" } + ) + ) + } // effectNodes[4].dampening = 5000; // or 1000 if you want a rough sound