Last active
November 6, 2017 01:03
-
-
Save colinbdclark/ff036ffb9b79a5ddb27c199aec09f8ff to your computer and use it in GitHub Desktop.
Dynamically creating synths based on a source array
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.noiseSynth", { | |
gradeNames: "flock.synth", | |
freq: 300, | |
synthDef: { | |
ugen: "flock.ugen.sum", | |
sources: { | |
ugen: "flock.ugen.filter.biquad.bp", | |
freq: "{that}.options.freq", | |
q: 1, | |
source: { | |
ugen: "flock.ugen.whiteNoise" | |
} | |
} | |
} | |
}); | |
fluid.defaults("adam.noiseBand", { | |
gradeNames: "flock.band", | |
numFreqBands: 10, | |
bandFreqMul: 100, | |
baseFreq: 300, | |
noiseFrequencies: { | |
expander: { | |
funcName: "adam.noiseBand.generateFrequencies", | |
args: [ | |
"{that}.options.numFreqBands", | |
"{that}.options.bandFreqMul", | |
"{that}.options.baseFreq" | |
] | |
} | |
}, | |
dynamicComponents: { | |
noiseSynth: { | |
sources: "{that}.options.noiseFrequencies", | |
type: "adam.noiseSynth", | |
options: { | |
freq: "{source}" | |
} | |
} | |
} | |
}); | |
adam.noiseBand.generateFrequencies = function (numFreqBands, bandFreqMul, baseFreq) { | |
return fluid.generate(numFreqBands, function (i) { | |
return (bandFreqMul * i) + baseFreq; | |
}, true); | |
}; | |
window.band = adam.noiseBand(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment