vibrato
This commit is contained in:
parent
c9f494d865
commit
e99adffc56
1 changed files with 11 additions and 0 deletions
|
|
@ -643,6 +643,11 @@ export class DoughVoice {
|
|||
[$.pattack, $.pdecay, $.psustain, $.prelease] = getADSR([$.pattack, $.pdecay, $.psustain, $.prelease]);
|
||||
}
|
||||
|
||||
if ($.vib) {
|
||||
$._vib = new SineOsc();
|
||||
$.vibmod = $.vibmod ?? getDefaultValue('vibmod');
|
||||
}
|
||||
|
||||
if ($.fmi) {
|
||||
$._fm = new SineOsc();
|
||||
$.fmh = $.fmh ?? getDefaultValue('fmh');
|
||||
|
|
@ -705,6 +710,7 @@ export class DoughVoice {
|
|||
let gate = Number(t >= this._begin && t <= this._holdEnd);
|
||||
|
||||
let freq = this.freq * this.speed;
|
||||
|
||||
// frequency modulation
|
||||
if (this._fm) {
|
||||
let fmi = this.fmi;
|
||||
|
|
@ -717,6 +723,11 @@ export class DoughVoice {
|
|||
freq = freq + this._fm.update(modfreq) * modgain;
|
||||
}
|
||||
|
||||
// vibrato
|
||||
if (this._vib) {
|
||||
freq = freq * 2 ** ((this._vib.update(this.vib) * this.vibmod) / 12);
|
||||
}
|
||||
|
||||
// pitch envelope
|
||||
if (this._penv) {
|
||||
const env = this._penv.update(t, gate, this.pattack, this.pdecay, this.psustain, this.prelease);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue