Last active
August 29, 2015 13:56
-
-
Save colinbdclark/9179042 to your computer and use it in GitHub Desktop.
Wiring Flocking up to Web Audio nodes
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
flock.init(); | |
var as = flock.enviro.shared.audioStrategy; | |
// Create the new gain node and set some parameters on it. | |
var gainNode = as.context.createGain(); | |
gainNode.gain.setValueAtTime(0.0, as.context.currentTime); | |
as.insertOutputNode(gainNode); | |
// Start up a new synth. | |
var synth = flock.synth({ | |
synthDef: { | |
ugen: "flock.ugen.sin", | |
mul: 0.1 | |
} | |
}); | |
// And schedule some audio params on the gain node. | |
gainNode.gain.linearRampToValueAtTime(1.0, as.context.currentTime + 10); | |
gainNode.gain.linearRampToValueAtTime(0.0, as.context.currentTime + 20); | |
synth.play(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment