From dc82792d91458763b189d29055d490fae9a72715 Mon Sep 17 00:00:00 2001 From: Jason Sigal Date: Tue, 26 Jun 2018 00:44:43 +0200 Subject: [PATCH 1/3] monosynth: remove unused filter, patch velocity --- src/monosynth.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/monosynth.js b/src/monosynth.js index ea756235..35d6207a 100644 --- a/src/monosynth.js +++ b/src/monosynth.js @@ -50,7 +50,6 @@ define(function (require) { AudioVoice.call(this); this.oscillator = new p5.Oscillator(); - // this.oscillator.disconnect(); this.env = new p5.Envelope(); this.env.setRange(1, 0); @@ -59,17 +58,15 @@ define(function (require) { //set params this.setADSR(0.02, 0.25, 0.05, 0.35); - // filter - this.filter = new p5.Filter('highpass'); - this.filter.set(5, 1); - - // oscillator --> env --> filter --> this.output (gain) --> p5.soundOut + // oscillator --> env --> this.output (gain) --> p5.soundOut this.oscillator.disconnect(); - this.oscillator.connect(this.filter); + this.oscillator.connect(this.output); + this.env.disconnect(); - this.env.setInput(this.oscillator); - // this.env.connect(this.filter); - this.filter.connect(this.output); + this.env.setInput(this.output.gain); + + // reset oscillator gain to 1.0 + this.oscillator.output.gain.value = 1.0; this.oscillator.start(); this.connect(); @@ -164,7 +161,7 @@ define(function (require) { var vel = velocity || 0.1; this._isOn = true; this.oscillator.freq(freq, 0, secondsFromNow); - this.env.ramp(this.output, secondsFromNow, vel); + this.env.ramp(this.output.gain, secondsFromNow, vel); }; /** @@ -189,7 +186,7 @@ define(function (require) { */ p5.MonoSynth.prototype.triggerRelease = function (secondsFromNow) { var secondsFromNow = secondsFromNow || 0; - this.env.ramp(this.output, secondsFromNow, 0); + this.env.ramp(this.output.gain, secondsFromNow, 0); this._isOn = false; }; @@ -319,9 +316,6 @@ define(function (require) { p5.MonoSynth.prototype.dispose = function() { AudioVoice.prototype.dispose.apply(this); - if (this.filter) { - this.filter.dispose(); - } if (this.env) { this.env.dispose(); } From dd67c181ac4da48883ca108885b6a560a57f9128 Mon Sep 17 00:00:00 2001 From: Jason Sigal Date: Tue, 26 Jun 2018 00:45:19 +0200 Subject: [PATCH 2/3] monosynth: remove unused _isOn --- src/monosynth.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/monosynth.js b/src/monosynth.js index 35d6207a..a111bec1 100644 --- a/src/monosynth.js +++ b/src/monosynth.js @@ -71,10 +71,6 @@ define(function (require) { this.oscillator.start(); this.connect(); - //Audiovoices are connected to soundout by default - - this._isOn = false; - p5sound.soundArray.push(this); }; @@ -159,7 +155,6 @@ define(function (require) { var secondsFromNow = ~~secondsFromNow; var freq = noteToFreq(note); var vel = velocity || 0.1; - this._isOn = true; this.oscillator.freq(freq, 0, secondsFromNow); this.env.ramp(this.output.gain, secondsFromNow, vel); }; @@ -187,7 +182,6 @@ define(function (require) { p5.MonoSynth.prototype.triggerRelease = function (secondsFromNow) { var secondsFromNow = secondsFromNow || 0; this.env.ramp(this.output.gain, secondsFromNow, 0); - this._isOn = false; }; /** From 2354b759e0869552a62ae0aa99cb1c3085f8558c Mon Sep 17 00:00:00 2001 From: Jason Sigal Date: Tue, 26 Jun 2018 02:14:01 +0200 Subject: [PATCH 3/3] update master limiter - sharp knee --- src/master.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/master.js b/src/master.js index 2ef9020d..96dc10ca 100644 --- a/src/master.js +++ b/src/master.js @@ -12,8 +12,9 @@ define(function () { //put a hard limiter on the output this.limiter = audiocontext.createDynamicsCompressor(); - this.limiter.threshold.value = 0; + this.limiter.threshold.value = -3; this.limiter.ratio.value = 20; + this.limiter.knee.value = 1; this.audiocontext = audiocontext;