READING WAV FILES FROM A UMENU

V@LeRiC's icon

Hi guys, this is kinda urgent: MAX/MSP Exam, part 2 :D

So i have to do this: i have a sequence of midi notes and i want them to match in pitch with samples i made for each note. when a note is triggered, i need to play the matching audio file (.wav format). i've been lookin through different topics over here but i couldn't get any solution kinda clear. i'm usign a uMenu. first of all, is it correct?
then, i have the audio files into the same folder of my patch so in the umenu proprieties i put the folder and wrote the name of the umenu elements like this: "0.wav", "1.wav" etc... the first thing i noticed is that it can't handle the ""... dunno why even because in an example patch my teachers made me, the "" have no problem on being into the file name...

then, how can i make the listed sounds into the umenu be played every time i trigger a note? sfplay? play? please, help!!!

thanks in advance

V.

ATH's icon

Dear V.
You could use a coll object for this.
In the coll file you define e.g. Midi note 80 plays sample 4 in your umenu
Write in the coll file:

80,4;

Be sure tu activate the save data wirh patcher of the inspector (Apple - I) of the coll object.
now incoming note 80 gives out 4 out of coll
the output of coll goes to the input of umenu. Remember the umenu starts counting at 0!

File playing you do by sfplay.
Eventually you will have to preload your sounds in the sf play object to have a fast response. Check out the sfplay tutorial and Helpfile.

good luck

bpatcher

pdelges's icon

About the ", you should have a look to fromsymbol and tosymbol. Quotes should be introduced only if there are spaces in the filename, this is the job of those objects.

You have the choice to play the notes from disk (with sfplay~) or from RAM (with a buffer~ and play~, groove~, etc.). You should also think about polyphony: can more sounds be played together? Maybe you should have a look to poly~.

V@LeRiC's icon
Max Patch
Copy patch and select New From Clipboard in Max.

this is how i solved the problem :