Buffer and MIDI
Mar 14, 2013 at 9:25pm
Buffer and MIDI
I have a few wav mono files I need to playback (1 time with note on midi message – no loop). each file is different for each note of my midi controller (a usb keyboard with 4 octaves of range).
Is it possible to preload in ram the wav files (almost 48 files more or less) when the patch loads. Do I have to use a loadbang for that?
Let’s say midi note on pitch = 48
Is it buffer a suitable object for this. Should I look to other objects as well?
Mar 15, 2013 at 9:38pm
buffer~ can do all that (and lots more)…look to the “loadram” message for your first question, and the [sprintf] object for the second question:
sprintf read sample%u.wav
send in “48″ from your midi note on pitch, and the %u in [sprintf] will be replaced by it. Send the output of [sprintf] to your [buffer~] and voila!
You’ll need a separate buffer~ for every file unless you combine the files beforehand. No problem, each buffer~ is named differently. you can set which buffer~ the groove~ object plays with the “set” message. (Note that buffer~ names are NOT the same as the filename it’s playing.)
If you want a separate groove~ for each buffer~ (I would do it that way), you can make an abstraction for each “bundle”, and maybe use [bpatcher]. Very easy to duplicate when everything’s bundled together. Or you can make a subpatch for each instead, which is easier and more flexible in some ways, but not in others…
[Edit]: If you have a separate buffer~ for each possible file, you won’t need the [sprintf] command for reading new files in. But if you haven’t met [sprintf] yet, it’s a great one to be aware of…it can handle string replacement differently than messages can, like being able to insert values right into a string (message $1 $2 etc. will turn them into lists with spaces). Essential for filepath and filename processing.
Mar 17, 2013 at 7:23pm
Thank you so much mate!
You must be logged in to reply to this topic.