Skip to content

Instantly share code, notes, and snippets.

@colinbdclark
Last active October 27, 2017 20:03
Show Gist options
  • Save colinbdclark/1cec7c0fb1e66ac3cc1cb3936340b31f to your computer and use it in GitHub Desktop.
Save colinbdclark/1cec7c0fb1e66ac3cc1cb3936340b31f to your computer and use it in GitHub Desktop.
Refactoring of Adam's banded noise synth
fluid.defaults("adam.bandednoise",
gradeNames: "flock.synth",
numBands: 10,
bandFreqMul: 100,
noizDefTemplate: {
ugen: "flock.ugen.filter.biquad.bp",
freq: 300,
q: 1,
source: {
ugen: "flock.ugen.whiteNoise"
}
},
noizDefs: {
expander: {
funcName: "adam.bandednoise.createBands",
args: ["{that}.options.numBands", "{that}.options.bandFreqMul", "{that}.options.noizDefTemplate"]
}
},
synthDef: {
ugen: "flock.ugen.sum",
sources: "{that}.options.noizDefs"
}
});
adam.bandednoise.createBands = function (numBands, bandFreqMul, noizDefTemplate) {
var ugenDefs = fluid.generate(numBands, function (i) {
var noizBandUGenDef = fluid.copy(noizDefTemplate);
noizDefTemplate.freq += i * bandFreqMul;
return noizBandUGenDef;
}, true);
return ugenDefs;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment