pitch envelope for sampler and soundfonts

+ added getPitchEnvelope helper
This commit is contained in:
Felix Roos 2024-01-15 23:55:49 +01:00
parent bdc2af9733
commit 32456d6966
4 changed files with 37 additions and 17 deletions

View file

@ -1,5 +1,11 @@
import { noteToMidi, freqToMidi, getSoundIndex } from '@strudel.cycles/core';
import { getAudioContext, registerSound, getParamADSR, getADSRValues } from '@strudel.cycles/webaudio';
import {
getAudioContext,
registerSound,
getParamADSR,
getADSRValues,
getPitchEnvelope,
} from '@strudel.cycles/webaudio';
import gm from './gm.mjs';
let loadCache = {};
@ -149,6 +155,11 @@ export function registerSoundfonts() {
getParamADSR(node.gain, attack, decay, sustain, release, 0, 0.3, time, holdEnd, 'linear');
let envEnd = holdEnd + release + 0.01;
// pitch envelope
if (value.penv) {
getPitchEnvelope(bufferSource.detune, value, time, holdEnd);
}
bufferSource.stop(envEnd);
const stop = (releaseTime) => {};
bufferSource.onended = () => {