pitch envelope for sampler and soundfonts
+ added getPitchEnvelope helper
This commit is contained in:
parent
bdc2af9733
commit
32456d6966
4 changed files with 37 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { noteToMidi, valueToMidi, getSoundIndex } from './util.mjs';
|
||||
import { getAudioContext, registerSound } from './index.mjs';
|
||||
import { getADSRValues, getParamADSR } from './helpers.mjs';
|
||||
import { getADSRValues, getParamADSR, getPitchEnvelope } from './helpers.mjs';
|
||||
import { logger } from './logger.mjs';
|
||||
|
||||
const bufferCache = {}; // string: Promise<ArrayBuffer>
|
||||
|
|
@ -310,6 +310,11 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) {
|
|||
|
||||
getParamADSR(node.gain, attack, decay, sustain, release, 0, 1, t, holdEnd, 'linear');
|
||||
|
||||
// pitch envelope
|
||||
if (value.penv) {
|
||||
getPitchEnvelope(bufferSource.detune, value, t, holdEnd);
|
||||
}
|
||||
|
||||
const out = ac.createGain(); // we need a separate gain for the cutgroups because firefox...
|
||||
node.connect(out);
|
||||
bufferSource.onended = function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue