mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2025-01-24 00:09:48 -05:00
replace follower with waveshaper
This commit is contained in:
parent
4deff78059
commit
cf80c9f9b8
1 changed files with 7 additions and 7 deletions
|
@ -102,12 +102,12 @@ Vocoder.prototype.initBandpassFilters = function () {
|
||||||
var modulatorFilterPostGain = new Tone.Gain(6);
|
var modulatorFilterPostGain = new Tone.Gain(6);
|
||||||
modulatorFilter.connect(modulatorFilterPostGain);
|
modulatorFilter.connect(modulatorFilterPostGain);
|
||||||
|
|
||||||
// create a lowpass filtered follower to turn the bandpass filter output into a smooth control
|
// add a rectifier with a lowpass filter to turn the bandpass filtered signal
|
||||||
// signal for the carrier filter
|
// into a smoothed control signal to control the carrier filter
|
||||||
var follower = new Tone.Follower(0,0);
|
var rectifier = new Tone.WaveShaper([1,0,1]);
|
||||||
modulatorFilterPostGain.connect(follower);
|
modulatorFilterPostGain.connect(rectifier);
|
||||||
var followerLowPass = new Tone.Filter(50, 'lowpass');
|
var rectifierLowPass = new Tone.Filter(50, 'lowpass');
|
||||||
follower.connect(followerLowPass);
|
rectifier.connect(rectifierLowPass);
|
||||||
|
|
||||||
// Create the bandpass filter in the carrier chain
|
// Create the bandpass filter in the carrier chain
|
||||||
var carrierFilter = new Tone.Filter(this.vocoderBands[i].frequency, 'bandpass', -24);
|
var carrierFilter = new Tone.Filter(this.vocoderBands[i].frequency, 'bandpass', -24);
|
||||||
|
@ -121,7 +121,7 @@ Vocoder.prototype.initBandpassFilters = function () {
|
||||||
var bandGain = new Tone.Gain(0);
|
var bandGain = new Tone.Gain(0);
|
||||||
carrierFilterPostGain.connect(bandGain);
|
carrierFilterPostGain.connect(bandGain);
|
||||||
|
|
||||||
followerLowPass.connect(bandGain.gain);
|
rectifierLowPass.connect(bandGain.gain);
|
||||||
|
|
||||||
bandGain.connect(this.outputGain);
|
bandGain.connect(this.outputGain);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue