MIDI Input triggering sound samples
I've been reading the tutorials but I can't find what I'm looking for...also a newbie. I'm trying to get individual MIDI signals to trigger different sounds. so instead of one sample scaled throughout the entire keyboard, one sound per key (think Ferris Bueller's E-mu sampler).
The idea is each key, or midi button from a kaospad, triggers a different sample of speech. I found a patch that prints when MIDI data is sent. it looks like this
[loadbang]-->[0]-->[midiinfo]==>[padKONTROL PORT A]-->[midiin]-->[print]
it mostly prints gibbirish, but I can tell that it distinguishing between the buttons I hit. I don't know how to harness it into what i need... yet. Any help offered is appreciated since I'm on borrowed time with this project. I have until 5 to work on it today, but I can work on it more tomorrow
try this. it's one of many ways of doing it. using sfplay~ might not be the best solution depending on the setup and files you use. might be interesting to look at the new polybuffer~ object, which you can find in the "Edge" section of the forum.
HTH
I have 4.6, so I can't use that buffer in the edge section. Also, I don't know what to do with the machine code posted above; would you explain it, please?
that's max5 code so no good to you. I am attaching a pic of what it looks like so you can recreate it in max4. the inside of the coll looks like this:
0, open anton.aif;
1, open cello-f2.aif;
2, open cherokee.aif;
3, open drumLoop.aif;
4, open jongly.aif;
5, open rainstick.aif;
6, open sho0630.aif;
7, open vibes-a1.aif;
I wish I could upload my patches but the max computer cant get internet.
I tried plugging in your patch, MIB, but I'm not understanding the coll function or how exactly you fit those 8 files into the patch.
the patch i've got right now is like this:
midiinfo>padkontrol>notein>sel (which has a 0 going to the top left) > bang
that notein also goes to a sel (which has it's own 0 box going to it)
that sel reads [sel 1 2 3 ... 16]
each channel for the sel goes to its own bang
there are 16 of these and each look like this:
bang->[1]
[open] the above [1] and a [0] all go to [sfplay~ 2 ""]
all 16 sfplay~ boxes go to the same [dac] box (leftmost sfplay to topleft of dacbox, middle of sfplay to the right).
all of the [0] boxes go to the bang coming from [sel 0]
one example of a completed sfplay box reads [sfplay~ 2 believe.aif]
what's particularly heartbreaking is that i get a bang on for the appropriate pad/patch designation and a bang off when the pad is released, but I'm not getting sound
I'm so close!
man it feels weird working in max4 again... ahhh, the good old days :)
just copy everything below and paste it into a max window
"what's particularly heartbreaking is that i get a bang on for the appropriate pad/patch designation and a bang off when the pad is released, but I'm not getting sound"
have a look at the "stripnote" object....
i would expect the examples above to get you _started_ but that you'll quickly find new and perhaps better ways to build this up.
keep in mind that the modulo trick MIB is posting is a great way to ensure that every note will trigger a sound. you can also use an integer offset for the pitches coming in to shift the location of this "sample tile" up and down.
MSP tutorial 14 has a great intro into the buffer~/groove~ stuff- i would probably start there after you get some version working. it will only help you understand more about how to expand the possibilities. buffer~s are stored in RAM and you can always access them quickly for a midi-based performative delight. if you're interested in many-samples-at-once-style loading, click on the edge forum and look at a cool new obj. that EJ has posted, which handles buffer banks.
just keep in mind that because you have separate numbers coming in via MIDI you can either map them via some lookup table (coll is perfect for this) by name or just "do something" with them via a bang from select.
jml
I'll take a look at stripnote MIB. I'm also going to try to copy that file code into coll.
jml, if I've tried understand buffers and grooves, but the stuff in the program help and tutorials i keep reading have been of little help... worst of all if i did get them, they seem to be easy to use to get this thing going!
tl;dr-
explain how a groove~ buffer~ works to the mind of a 7-year-old, please. :)
i might be derailing. if so; save what i've posted for later on, when you want to have many buffers loaded and ready to go immediately.
when that time comes, feel free to copy my patch into yours...
i would recommend starting with just two samples and seeing what is going on (which is what i've done in that picture).
to load sounds,
1. click on the "replace" messages that are going into the buffer objects. then,
2. try playing note 60 (middle c on many keyboards) and 61 (one above it) in order to select the notes.
3. if you are unsure of what notes you are playing in, try patching the output of the notein object's left outlet into the input of a number box.
* you'd of course need as many buffers as you have keys that you'll want to play individual sounds.
this should help you get a bit further.
if the other method is working for you, by all means, use it! i was mainly pointing out what another approach would be.
jml
jml: thanks for writing again! theKPad shows what note value I'm punching in. i can see that the pad is banging at the sf that I was expecting it would, but it wasn't actually playing the sound. all smoke; no fire. I've got to take a break for a few minutes just because... well, i need it... but i'll be back with word on that idea
k. enjoy the smoke.
you might not have
1. a sound loaded
2. the audio on
3. named your buffer that you are triggering
4. a zero going into your groove~
just take it slow, keep reading and trying out new things, be patient. you'll get there. ;)
jml
Hi all,
I have build a subpatcher that is supposed to take incoming midimessages and get distributed to another patch for triggering samples. I have a mpd18 (16pads) to control it.
The patch only sends out the positive velocity (so never 0) to play entire samples with play~.
I have used poly~ for the first time here, but have trouble with "matching"/"selecting" the pitch/velocity-numbers when they're unpacked out of the poly~.
Its probably really easy, but i have tried all kinds of objects. (well, probably not all.)
The problem is now that the velocitynumber gets recognised as padnumber.
Could anyone help me out with this little stupidity?
Thanks a lot!
Nathan
I think i got it. :)
*blows dust off thread*
I'm trying to do the same thing, but I'm new to Max so I don't quite understand what everything in MIB's patch is doing.
Pack is concatenating both of data from the kslider (which are Key Value (pitch?) and Velocity).
Unpack is then separating them into two integers (why? When I run the Key Value outlet from KSlider to the left input of %, it seems to work just as well?)
How does the % 8 work? When I hit a key with value of 40, and it's divided by 8, the value comes out as...0?
And finally (sorry - like I said I'm new to this) - what is the trigger doing? Removing it breaks the patch - does sfplay~ need a bang to work?
Thanks!
Hi
the % operator outputs the remainder, in this case 0 - 7; this ensures that the sample map repeats across the octaves. The argument 8 relates to the number of samples required; therefore with 6 samples you would use [% 6] and alter the contents of the [coll] accordingly.
The [pack]/[unpack] pair is used to allow access to velocity data, which this example doesn't actually use yet. Removing the trigger object will cause the output of [coll], a list, to go to [sfplay~], but there will be no "1" message telling it to play the file. MIB has set up the triggering order such that the "open fileBlah.aif" is sent first, followed by the 1.
Brendan
. . . . object helpfiles are a treasure trove of such information and assistance : )
Help files are the first place I went! I understand their purpose, but like I said, I had trouble understanding how they were behaving in the sample patch. But thanks for the explanation!