Skip to content

Instantly share code, notes, and snippets.

@jcreedcmu
Created June 22, 2015 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcreedcmu/0b7b186353d077ff9f98 to your computer and use it in GitHub Desktop.
Save jcreedcmu/0b7b186353d077ff9f98 to your computer and use it in GitHub Desktop.
// 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