Created
June 22, 2015 23:22
-
-
Save jcreedcmu/0b7b186353d077ff9f98 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// after: public volume: number = 1.0; | |
private _prev:number = 0; | |
public static REVERB_LEN:number = 2000; | |
private _reverb:Float64Array = new Float64Array(Synth.REVERB_LEN); | |
private _reverb_ix = 0; | |
// after: sample *= this.volume; | |
var slew_limit = 0.005; | |
if (Math.abs(sample - this._prev) > slew_limit) | |
sample = this._prev + (sample > this._prev ? slew_limit : -slew_limit); | |
this._prev = sample; | |
var next = (this._reverb_ix + 1) % Synth.REVERB_LEN; | |
var other = (this._reverb_ix + 37) % Synth.REVERB_LEN; | |
sample += 0.4 * this._reverb[next] + | |
0.1 * this._reverb[other]; | |
this._reverb[this._reverb_ix] = sample; | |
this._reverb_ix = next; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment