lowered volume on synth to stop distortion

This commit is contained in:
suroh 2023-10-26 10:51:53 +02:00
parent 7d0ec7dd4c
commit e66381548b
1 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,5 @@
export class Synth { export class Synth {
// SYNTH VOICE CONSTRUCTOR // SYNTH VOICE CONSTRUCTOR
// Variables?
constructor(audio, type, env = { constructor(audio, type, env = {
a: 0.2, a: 0.2,
r: 0.5, r: 0.5,
@ -46,7 +45,7 @@ export class Synth {
// clear preScheduled events // clear preScheduled events
this.gain.gain.cancelScheduledValues(this.audio.currentTime) this.gain.gain.cancelScheduledValues(this.audio.currentTime)
// attack // attack
this.gain.gain.setTargetAtTime(0.9, this.t + this.env.a, 0.2) this.gain.gain.setTargetAtTime(0.45, this.t + this.env.a, 0.2)
} }
noteOff() { noteOff() {
@ -57,9 +56,9 @@ export class Synth {
mod() { mod() {
this.modGain.gain.cancelScheduledValues(this.audio.currentTime) this.modGain.gain.cancelScheduledValues(this.audio.currentTime)
// attack // attack
this.modGain.gain.setTargetAtTime(0.9, this.audio.currentTime, 0.5) this.modGain.gain.setTargetAtTime(0.8, this.audio.currentTime, 0.5)
// release // release
this.modGain.gain.setTargetAtTime(0.0, this.audio.currentTime + 0.4, 0.5) this.modGain.gain.setTargetAtTime(0.8, this.audio.currentTime + 0.4, 0.5)
} }
} }