Last active
October 27, 2017 20:03
-
-
Save colinbdclark/1cec7c0fb1e66ac3cc1cb3936340b31f to your computer and use it in GitHub Desktop.
Refactoring of Adam's banded noise synth
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
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