fix: format

This commit is contained in:
Felix Roos 2023-08-31 03:56:31 +02:00
parent c625096f59
commit b1b084452c

View File

@ -20,7 +20,6 @@ const mod = (freq, range = 1, type) => {
return { node: g, stop: (t) => osc.stop(t) }; return { node: g, stop: (t) => osc.stop(t) };
}; };
export function registerSynthSounds() { export function registerSynthSounds() {
['sine', 'square', 'triangle', 'sawtooth'].forEach((wave) => { ['sine', 'square', 'triangle', 'sawtooth'].forEach((wave) => {
registerSound( registerSound(
@ -34,13 +33,13 @@ export function registerSynthSounds() {
release = 0.01, release = 0.01,
fmh: fmHarmonicity = 1, fmh: fmHarmonicity = 1,
fmi: fmModulationIndex, fmi: fmModulationIndex,
fmenv: fmEnvelopeType = 'linear', fmenv: fmEnvelopeType = 'linear',
fmattack: fmAttack = 0.001, fmattack: fmAttack = 0.001,
fmdecay: fmDecay = 0.2, fmdecay: fmDecay = 0.2,
fmsustain: fmSustain = 0.001, fmsustain: fmSustain = 0.001,
fmrelease: fmRelease = 0.1, fmrelease: fmRelease = 0.1,
fmvelocity: fmVelocity = 1, fmvelocity: fmVelocity = 1,
fmwave: fmWaveform = 'sine' fmwave: fmWaveform = 'sine',
} = value; } = value;
let { n, note, freq } = value; let { n, note, freq } = value;
// with synths, n and note are the same thing // with synths, n and note are the same thing
@ -58,14 +57,14 @@ export function registerSynthSounds() {
let stopFm, fmEnvelope; let stopFm, fmEnvelope;
if (fmModulationIndex) { if (fmModulationIndex) {
const { node: modulator, stop } = fm( o, fmHarmonicity, fmModulationIndex, fmWaveform); const { node: modulator, stop } = fm(o, fmHarmonicity, fmModulationIndex, fmWaveform);
fmEnvelope = getEnvelope(fmAttack, fmDecay, fmSustain, fmRelease, fmVelocity, t); fmEnvelope = getEnvelope(fmAttack, fmDecay, fmSustain, fmRelease, fmVelocity, t);
if (fmEnvelopeType === "exp") { if (fmEnvelopeType === 'exp') {
fmEnvelope = getExpEnvelope(fmAttack, fmDecay, fmVelocity, t); fmEnvelope = getExpEnvelope(fmAttack, fmDecay, fmVelocity, t);
fmEnvelope.node.maxValue = fmModulationIndex * 2; fmEnvelope.node.maxValue = fmModulationIndex * 2;
fmEnvelope.node.minValue = 0.00001; fmEnvelope.node.minValue = 0.00001;
} }
modulator.connect(fmEnvelope.node); modulator.connect(fmEnvelope.node);
fmEnvelope.node.connect(o.frequency); fmEnvelope.node.connect(o.frequency);
stopFm = stop; stopFm = stop;
} }