waveform aliases: tri, sqr, saw, sin

This commit is contained in:
Felix Roos
2025-03-20 21:19:47 +01:00
parent ac6472a43a
commit c33cfc78c5
+8 -1
View File
@@ -1,5 +1,5 @@
import { clamp, midiToFreq, noteToMidi } from './util.mjs';
import { registerSound, getAudioContext } from './superdough.mjs';
import { registerSound, getAudioContext, soundMap } from './superdough.mjs';
import {
applyFM,
gainNode,
@@ -27,6 +27,12 @@ const getFrequencyFromValue = (value) => {
};
const waveforms = ['triangle', 'square', 'sawtooth', 'sine'];
const waveformAliases = [
['tri', 'triangle'],
['sqr', 'square'],
['saw', 'sawtooth'],
['sin', 'sine'],
];
const noises = ['pink', 'white', 'brown', 'crackle'];
export function registerSynthSounds() {
@@ -235,6 +241,7 @@ export function registerSynthSounds() {
{ type: 'synth', prebake: true },
);
});
waveformAliases.forEach(([alias, actual]) => soundMap.set({ ...soundMap.get(), [alias]: soundMap.get()[actual] }));
}
export function waveformN(partials, type) {