From 88b5b9b21ceaa9377f3ded8f5698f8c648dbf348 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 31 Aug 2023 04:24:44 +0200 Subject: [PATCH] fix: history --- packages/superdough/synth.mjs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/superdough/synth.mjs b/packages/superdough/synth.mjs index 1e9ea114..c1e31973 100644 --- a/packages/superdough/synth.mjs +++ b/packages/superdough/synth.mjs @@ -2,13 +2,6 @@ import { midiToFreq, noteToMidi } from './util.mjs'; import { registerSound, getAudioContext } from './superdough.mjs'; import { getOscillator, gainNode, getEnvelope, getExpEnvelope } from './helpers.mjs'; -const fm = (osc, harmonicityRatio, modulationIndex, wave) => { - const carrfreq = osc.frequency.value; - const modfreq = carrfreq * harmonicityRatio; - const modgain = modfreq * modulationIndex; - return mod(modfreq, modgain, wave); -}; - const mod = (freq, range = 1, type) => { const ctx = getAudioContext(); const osc = ctx.createOscillator(); @@ -20,6 +13,13 @@ const mod = (freq, range = 1, type) => { return { node: g, stop: (t) => osc.stop(t) }; }; +const fm = (osc, harmonicityRatio, modulationIndex, wave) => { + const carrfreq = osc.frequency.value; + const modfreq = carrfreq * harmonicityRatio; + const modgain = modfreq * modulationIndex; + return mod(modfreq, modgain, wave); +}; + export function registerSynthSounds() { ['sine', 'square', 'triangle', 'sawtooth'].forEach((wave) => { registerSound(