Last active
January 20, 2021 16:20
-
-
Save colinbdclark/3a7c776d6494079d5563b9e894d6575f to your computer and use it in GitHub Desktop.
Using Flocking's BufferLoader
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("bncfi.bufferLoader", { | |
gradeNames: "flock.bufferLoader", | |
sounds: ['MaxV - Conga Hi.wav', 'MaxV - Conga Lo.wav', 'MaxV - Conga Mi.wav', | |
'MaxV - Tom Hi.wav', 'MaxV - Tom Lo.wav', 'MaxV - Tom Mi.wav', 'MaxV - Kick2.wav', 'MaxV - Kick1.wav'] | |
bufferDefs: { | |
expander: { | |
funcName: "bncfi.bufferLoader.mapSoundFileURLs", | |
args: ["{that}.options.sounds)"] | |
} | |
} | |
}); | |
bncfi.bufferLoader.mapSoundFileURLs = function mapSoundFileURLs (sounds) { | |
sounds.map(function (url, idx) { | |
return { | |
id: idx, | |
src: url | |
}; | |
}); | |
}; | |
fluid.defaults("bncfi.samplePlayerSynth", { | |
gradeNames: "flock.synth", | |
synthDef: { | |
ugen: "flock.ugen.out", | |
source: { | |
id: "player", | |
ugen: "flock.ugen.playBuffer", | |
buffer: 1, | |
speed: 1, | |
loop: 1, | |
start: 0, | |
end: 1 | |
} | |
} | |
}); | |
fluid.defaults("bncfi.composition", { | |
gradeNames: "fluid.component", | |
components: { | |
enviro: { | |
type: "flock.enviro" | |
}, | |
bufferLoader: { | |
type: "bncfi.bufferLoader" | |
}, | |
synth: { | |
type: "bncfi.samplePlayerSynth" | |
} | |
}, | |
listeners: { | |
"afterBuffersLoaded.playSynth": "{synth}.play()" | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment