added back (possibly unessecary? stop fm
This commit is contained in:
parent
232b9c13d7
commit
05887967e0
2 changed files with 9 additions and 3 deletions
|
|
@ -215,11 +215,16 @@ export function applyFM(param, value, begin) {
|
||||||
fmwave: fmWaveform = 'sine',
|
fmwave: fmWaveform = 'sine',
|
||||||
duration,
|
duration,
|
||||||
} = value;
|
} = value;
|
||||||
|
let modulator;
|
||||||
|
let stop = () => {};
|
||||||
|
|
||||||
if (fmModulationIndex) {
|
if (fmModulationIndex) {
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
const envGain = ac.createGain();
|
const envGain = ac.createGain();
|
||||||
const { node: modulator, stop } = fm(param, fmHarmonicity, fmModulationIndex, fmWaveform);
|
const fmmod = fm(param, fmHarmonicity, fmModulationIndex, fmWaveform);
|
||||||
|
|
||||||
|
modulator = fmmod.node;
|
||||||
|
stop = fmmod.stop;
|
||||||
if (![fmAttack, fmDecay, fmSustain, fmRelease, fmVelocity].find((v) => v !== undefined)) {
|
if (![fmAttack, fmDecay, fmSustain, fmRelease, fmVelocity].find((v) => v !== undefined)) {
|
||||||
// no envelope by default
|
// no envelope by default
|
||||||
modulator.connect(param);
|
modulator.connect(param);
|
||||||
|
|
@ -242,4 +247,5 @@ export function applyFM(param, value, begin) {
|
||||||
envGain.connect(param);
|
envGain.connect(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return { stop };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ export function getOscillator(s, t, value) {
|
||||||
|
|
||||||
// pitch envelope
|
// pitch envelope
|
||||||
getPitchEnvelope(o.detune, value, t, t + duration);
|
getPitchEnvelope(o.detune, value, t, t + duration);
|
||||||
applyFM(o.frequency, value, t);
|
const fmModulator = applyFM(o.frequency, value, t);
|
||||||
|
|
||||||
let noiseMix;
|
let noiseMix;
|
||||||
if (noise) {
|
if (noise) {
|
||||||
|
|
@ -218,9 +218,9 @@ export function getOscillator(s, t, value) {
|
||||||
return {
|
return {
|
||||||
node: noiseMix?.node || o,
|
node: noiseMix?.node || o,
|
||||||
stop: (time) => {
|
stop: (time) => {
|
||||||
|
fmModulator.stop(time);
|
||||||
vibratoOscillator?.stop(time);
|
vibratoOscillator?.stop(time);
|
||||||
noiseMix?.stop(time);
|
noiseMix?.stop(time);
|
||||||
// stopFm?.(time);
|
|
||||||
o.stop(time);
|
o.stop(time);
|
||||||
},
|
},
|
||||||
triggerRelease: (time) => {
|
triggerRelease: (time) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue