Merge pull request 'Feature: Wavetable FM' (#1623) from glossing/strudel:glossing/wavetable-fm into main

Reviewed-on: https://codeberg.org/uzu/strudel/pulls/1623
This commit is contained in:
Switch Angel AKA Jade Rose 2025-10-13 07:05:56 +02:00
commit f40d079543

View file

@ -1,6 +1,7 @@
import { getAudioContext, registerSound } from './index.mjs'; import { getAudioContext, registerSound } from './index.mjs';
import { getCommonSampleInfo } from './util.mjs'; import { getCommonSampleInfo } from './util.mjs';
import { import {
applyFM,
applyParameterModulators, applyParameterModulators,
destroyAudioWorkletNode, destroyAudioWorkletNode,
getADSRValues, getADSRValues,
@ -308,6 +309,7 @@ export async function onTriggerSynth(t, value, onended, tables, cps, frameLen) {
}, },
); );
const vibratoOscillator = getVibratoOscillator(source.parameters.get('detune'), value, t); const vibratoOscillator = getVibratoOscillator(source.parameters.get('detune'), value, t);
const fm = applyFM(source.parameters.get('frequency'), value, t);
const envGain = ac.createGain(); const envGain = ac.createGain();
const node = source.connect(envGain); const node = source.connect(envGain);
getParamADSR(node.gain, attack, decay, sustain, release, 0, 0.3, t, holdEnd, 'linear'); getParamADSR(node.gain, attack, decay, sustain, release, 0, 0.3, t, holdEnd, 'linear');
@ -318,6 +320,7 @@ export async function onTriggerSynth(t, value, onended, tables, cps, frameLen) {
() => { () => {
destroyAudioWorkletNode(source); destroyAudioWorkletNode(source);
vibratoOscillator?.stop(); vibratoOscillator?.stop();
fm?.stop();
node.disconnect(); node.disconnect();
wtPosModulators?.disconnect(); wtPosModulators?.disconnect();
wtWarpModulators?.disconnect(); wtWarpModulators?.disconnect();