mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-13 22:35:15 -04:00
pitch envelope
This commit is contained in:
@@ -559,6 +559,16 @@ export class DoughVoice {
|
||||
const SourceClass = oscillators[this.s] ?? TriOsc;
|
||||
this._sound = new SourceClass();
|
||||
|
||||
if (this.penv) {
|
||||
this._penv = new ADSR();
|
||||
[this.pattack, this.pdecay, this.psustain, this.prelease] = getADSRValues([
|
||||
this.pattack,
|
||||
this.pdecay,
|
||||
this.psustain,
|
||||
this.prelease,
|
||||
]);
|
||||
}
|
||||
|
||||
if (this.fmi) {
|
||||
this._fm = new SineOsc();
|
||||
this.fmh = this.fmh ?? getDefaultValue('fmh');
|
||||
@@ -650,6 +660,11 @@ export class DoughVoice {
|
||||
freq = freq + this._fm.update(modfreq) * modgain;
|
||||
}
|
||||
|
||||
if (this._penv) {
|
||||
const env = this._penv.update(t, gate, this.pattack, this.pdecay, this.psustain, this.prelease) ** 2;
|
||||
freq = freq + env * this.penv;
|
||||
}
|
||||
|
||||
// sound source
|
||||
if (this.s === 'pulse') {
|
||||
s = this._sound.update(freq, this.pw ?? 0.5);
|
||||
|
||||
Reference in New Issue
Block a user