fix: polyblepped sawtooth + fm = death
This commit is contained in:
parent
5988e3d3b4
commit
ab052ce1ac
1 changed files with 6 additions and 1 deletions
|
|
@ -450,6 +450,7 @@ const defaultDefaultValues = {
|
||||||
z: 'triangle',
|
z: 'triangle',
|
||||||
pan: 0.5,
|
pan: 0.5,
|
||||||
fmh: 1,
|
fmh: 1,
|
||||||
|
fmenv: 0, // differs from superdough
|
||||||
};
|
};
|
||||||
|
|
||||||
let getDefaultValue = (key) => defaultDefaultValues[key];
|
let getDefaultValue = (key) => defaultDefaultValues[key];
|
||||||
|
|
@ -540,6 +541,7 @@ export class DoughVoice {
|
||||||
this.fft = this.fft ?? getDefaultValue('fft');
|
this.fft = this.fft ?? getDefaultValue('fft');
|
||||||
this.pan = this.pan ?? getDefaultValue('pan');
|
this.pan = this.pan ?? getDefaultValue('pan');
|
||||||
this.orbit = this.orbit ?? getDefaultValue('orbit');
|
this.orbit = this.orbit ?? getDefaultValue('orbit');
|
||||||
|
this.fmenv = this.fmenv ?? getDefaultValue('fmenv');
|
||||||
|
|
||||||
[this.attack, this.decay, this.sustain, this.release] = getADSRValues([
|
[this.attack, this.decay, this.sustain, this.release] = getADSRValues([
|
||||||
this.attack,
|
this.attack,
|
||||||
|
|
@ -551,6 +553,9 @@ export class DoughVoice {
|
||||||
this._holdEnd = this._begin + this._duration; // needed for gate
|
this._holdEnd = this._begin + this._duration; // needed for gate
|
||||||
this._end = this._holdEnd + this.release + 0.01; // needed for despawn
|
this._end = this._holdEnd + this.release + 0.01; // needed for despawn
|
||||||
|
|
||||||
|
if (this.s === 'saw' || this.s === 'sawtooth') {
|
||||||
|
this.s = 'zaw'; // polyblepped saw when fm is applied
|
||||||
|
}
|
||||||
const SourceClass = oscillators[this.s] ?? TriOsc;
|
const SourceClass = oscillators[this.s] ?? TriOsc;
|
||||||
this._sound = new SourceClass();
|
this._sound = new SourceClass();
|
||||||
|
|
||||||
|
|
@ -638,7 +643,7 @@ export class DoughVoice {
|
||||||
let fmi = this.fmi;
|
let fmi = this.fmi;
|
||||||
if (this._fmenv) {
|
if (this._fmenv) {
|
||||||
const env = this._fmenv.update(t, gate, this.fmattack, this.fmdecay, this.fmsustain, this.fmrelease) ** 2;
|
const env = this._fmenv.update(t, gate, this.fmattack, this.fmdecay, this.fmsustain, this.fmrelease) ** 2;
|
||||||
fmi = /* 2 ** */ this.fmenv * env * fmi; // todo: find good scaling
|
fmi = this.fmenv * env * fmi;
|
||||||
}
|
}
|
||||||
const modfreq = freq * this.fmh;
|
const modfreq = freq * this.fmh;
|
||||||
const modgain = modfreq * fmi;
|
const modgain = modfreq * fmi;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue