Skip to content

Instantly share code, notes, and snippets.

@colinbdclark
Created January 20, 2015 14:06
Show Gist options
  • Save colinbdclark/7198f28cc8eb2e9b07e0 to your computer and use it in GitHub Desktop.
Save colinbdclark/7198f28cc8eb2e9b07e0 to your computer and use it in GitHub Desktop.
One unit generator connected to multiple inputs: code
var synth = flock.synth({
synthDef: {
id: "sum",
ugen: "flock.ugen.sum",
sources: [
{
ugen: "flock.ugen.lfSaw",
freq: 440,
mul: {
id: "amp",
ugen: "flock.ugen.line",
start: 0,
end: 0.1,
duration: 20
}
},
{
ugen: "flock.ugen.lfSaw",
freq: 450,
mul: 0.1
},
{
ugen: "flock.ugen.lfSaw",
freq: 460,
mul: 0.1
}
]
},
addToEnvironment: false
});
var line = synth.get("amp");
var oscs = synth.get("sum").inputs.sources;
for (var i = 0; i < oscs.length; i++) {
var osc = oscs[i];
osc.inputs.mul = line;
osc.onInputChanged("mul");
}
synth.play();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment