Created
January 8, 2014 15:53
-
-
Save fand/8318958 to your computer and use it in GitHub Desktop.
Delay effect in Web Audio API, but it kills Chrome...
This file contains 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
class @FX | |
constructor: (@ctx) -> | |
@in = @ctx.createGain() | |
@in.gain.value = 1.0 | |
@out = @ctx.createGain() | |
@out.gain.value = 1.0 | |
@view = new FXView(this) | |
connect: (dst) -> @out.connect(dst) | |
disconnect: () -> @out.disconnect() | |
setInput: (d) -> @in.gain.value = d | |
setOutput: (d) -> @out.gain.value = d | |
class @Delay extends @FX | |
constructor: (@ctx) -> | |
super(@ctx) | |
@delay = @ctx.createDelay() | |
@delay.delayTime.value = 0.23 | |
@lofi = @ctx.createBiquadFilter() | |
@lofi.type = "peaking" | |
@lofi.frequency.value = 12 | |
@lofi.Q.value = 0.0 # range is [0.0, 5.0] | |
@lofi.gain.value = 1.0 | |
@feedback = @ctx.createGain() | |
@feedback.gain.value = 0.2 | |
@in.connect(@lofi) | |
@lofi.connect(@delay) | |
@delay.connect(@out) | |
@delay.connect(@feedback) | |
@feedback.connect(@lofi) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment