change default FM env to exp because it modulates frequency and sounds way better :)

This commit is contained in:
Jade (Rose) Rowland 2024-01-05 01:07:54 -05:00
parent 2ee392be9b
commit b2f63897f9

View file

@ -119,7 +119,7 @@ export function getOscillator(
// fm // fm
fmh: fmHarmonicity = 1, fmh: fmHarmonicity = 1,
fmi: fmModulationIndex, fmi: fmModulationIndex,
fmenv: fmEnvelopeType = 'lin', fmenv: fmEnvelopeType = 'exp',
fmattack: fmAttack, fmattack: fmAttack,
fmdecay: fmDecay, fmdecay: fmDecay,
fmsustain: fmSustain, fmsustain: fmSustain,
@ -165,10 +165,7 @@ export function getOscillator(
modulator.connect(o.frequency); modulator.connect(o.frequency);
} else { } else {
const [attack, decay, sustain, release] = getADSRValues([fmAttack, fmDecay, fmSustain, fmRelease]); const [attack, decay, sustain, release] = getADSRValues([fmAttack, fmDecay, fmSustain, fmRelease]);
const holdEnd = t + duration; const holdEnd = t + duration;
// let envEnd = holdEnd + release + 0.01;
getParamADSR( getParamADSR(
envGain.gain, envGain.gain,
attack, attack,
@ -181,11 +178,6 @@ export function getOscillator(
holdEnd, holdEnd,
fmEnvelopeType === 'exp' ? 'exponential' : 'linear', fmEnvelopeType === 'exp' ? 'exponential' : 'linear',
); );
if (fmEnvelopeType === 'exp') {
envGain.maxValue = fmModulationIndex * 2;
envGain.minValue = 0.00001;
}
modulator.connect(envGain); modulator.connect(envGain);
envGain.connect(o.frequency); envGain.connect(o.frequency);
} }