scratch-audioengine
Advanced tools
Comparing version 0.1.0-prerelease.1478709622 to 0.1.0-prerelease.1478803928
{ | ||
"name": "scratch-audioengine", | ||
"version": "0.1.0-prerelease.1478709622", | ||
"version": "0.1.0-prerelease.1478803928", | ||
"description": "audio engine for scratch 3.0", | ||
@@ -5,0 +5,0 @@ "main": "dist.js", |
/* | ||
This is a port of Jamison Dance's port of Chris Wilson's WebAudio vocoder. | ||
This is a port of Jamison Dance's port of Chris Wilson's WebAudio vocoder: | ||
https://github.com/jergason/Vocoder | ||
https://github.com/cwilso/Vocoder | ||
I have adapted it to use the ToneJs library, making it a Tone Effect that | ||
@@ -46,3 +49,3 @@ can be added to an audio effects chain. | ||
this.vocoderBands = this.generateVocoderBands(55, 7040, 10); | ||
this.vocoderBands = this.generateVocoderBands(55, 7040, 8); | ||
this.initBandpassFilters(); | ||
@@ -103,28 +106,9 @@ this.createCarrier(); | ||
// Create the sine oscillator for the heterodyne | ||
var heterodyneOscillator = new Tone.Oscillator(this.vocoderBands[i].frequency).start(); | ||
// create a lowpass filtered follower to turn the bandpass filter output into a smooth control | ||
// signal for the carrier filter | ||
var follower = new Tone.Follower(0,0); | ||
modulatorFilterPostGain.connect(follower); | ||
var followerLowPass = new Tone.Filter(50, 'lowpass'); | ||
follower.connect(followerLowPass); | ||
// Create the node to multiply the sine by the modulator | ||
var heterodyne = new Tone.Gain(0); // audio-rate inputs are summed with initial intrinsic value | ||
modulatorFilterPostGain.connect(heterodyne); | ||
heterodyneOscillator.connect(heterodyne.gain); | ||
var heterodynePostGain = new Tone.Gain(2.0); | ||
heterodyne.connect(heterodynePostGain); | ||
// Create the rectifier node | ||
var rectifier = new Tone.WaveShaper([1, 0, 1]); | ||
heterodynePostGain.connect(rectifier); | ||
// Create the lowpass filter to mask off the difference (near zero) | ||
var lpFilter = new Tone.Filter(5, 'lowpass'); | ||
lpFilter.Q.value = 1; // don't need a peak | ||
rectifier.connect(lpFilter); | ||
var lpFilterPostGain = new Tone.Gain(); | ||
lpFilter.connect(lpFilterPostGain); | ||
var waveshaper = new Tone.WaveShaper([1, 0, 1]); | ||
lpFilterPostGain.connect(waveshaper); | ||
// Create the bandpass filter in the carrier chain | ||
@@ -139,6 +123,7 @@ var carrierFilter = new Tone.Filter(this.vocoderBands[i].frequency, 'bandpass', -24); | ||
// Create the carrier band gain node | ||
var bandGain = new Tone.Gain(0); // audio-rate inputs are summed with initial intrinsic value | ||
var bandGain = new Tone.Gain(0); | ||
carrierFilterPostGain.connect(bandGain); | ||
waveshaper.connect(bandGain.gain); // connect the lp controller | ||
followerLowPass.connect(bandGain.gain); | ||
bandGain.connect(this.outputGain); | ||
@@ -145,0 +130,0 @@ } |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
793150
23020