Forums > MaxMSP

confused about storing/playing samples with coll object

November 3, 2008 | 2:14 pm

hi

hopefully i can explain this properly…
i have been making a patch (see enclosed) which ultimately will play up to six sounds at the same time depending on the numbers that are coming in from six distance sensors that i will be using.

at the moment i have tested it using just number boxes which play samples of my voice saying numbers. i use six instances of the coll object to store the samples and it seemed to work pretty well. eg:- if the number in the number box is ’1′ then the sample named ‘one’ will be played, and so on.

last night i tried to change the number samples and substitute them with samples from different songs…but i couldnt get the song samples to play properly (or at all) if they were stored in coll using their song names as the file name. i could only get them to play if i renamed them ’1.one.wav’ etc, like i had originally named the test number files.

so how can i store the song samples in a coll object and keep their original names so i can identify them easily?

hope this makes sense and someone can help me. im using max4.5

many thanks


November 3, 2008 | 5:07 pm

Okay, I think you’re not handling the strings correctly here. Stupidly, coll outputs something like ‘symbol MacintoshHD:/blabla part 2.wav’ when it only has one element at an index. Unpacking this list and using the second part will give you ‘MacintoshHD:/blabla’ in this case. Try to keep the path together in 1 symbol.

A better method would be something like this:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 199 284 146 196617 "fou r.wav";
#P newex 199 241 62 196617 prepend set;
#P newex 264 261 62 196617 buffer~ one;
#B color 5;
#P newex 264 241 81 196617 prepend replace;
#P newex 199 214 51 196617 tosymbol;
#P newex 199 189 69 196617 route symbol;
#P window setfont "Sans Serif" 12.;
#N coll ;
#T flags 1 0;
#T 1 on e.wav;
#T 2 tw o.wav;
#T 3 thre e.wav;
#T 4 fou r.wav;
#T 5 fiv e.wav;
#P newobj 34 156 53 196620 coll;
#P window setfont "Sans Serif" 10.;
#P newex 33 104 44 196618 * 50.;
#P flonum 33 79 68 10 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 33 50 74 196618 receive pin0;
#P window setfont "Sans Serif" 9.;
#P newex 33 188 56 196617 unpack s s;
#P message 14 268 146 196617 r.wav;
#P newex 14 225 62 196617 prepend set;
#P window setfont "Sans Serif" 10.;
#P number 33 134 35 10 1 6 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 79 245 62 196617 buffer~ one;
#B color 5;
#P newex 79 225 81 196617 prepend replace;
#P user com 93 160 199 196617 22;
#K set 0 29810 31008 25455 27756 25955 29801 28263 8307 28525 25972 26729 28263 8311 26996 26656 24864 29552 24931 25888 26990 8297 29696;
#K end;
#P connect 12 0 15 0;
#P connect 12 0 13 0;
#P connect 13 0 14 0;
#P connect 15 0 16 0;
#P fasten 11 1 12 0 263 209 204 209;
#P connect 11 0 12 0;
#P connect 10 0 6 0;
#P connect 10 0 11 0;
#P connect 4 0 5 0;
#P connect 7 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 3 0;
#P connect 3 0 10 0;
#P connect 6 1 1 0;
#P fasten 6 1 4 0 84 218 19 218;
#P connect 1 0 2 0;
#P window clipboard copycount 17;

Good luck!


November 3, 2008 | 9:20 pm

hi there

many thanks for your reply

using your advice and a bit of fiddling about i managed to get it to play the sound files by leaving out the spaces in the song names.

another small question : how do i get the groove~ object to play all of the sample, regardless of its size (none of them are longer than 10 seconds)? the patch seems to only play parts of some of the samples

many thanks


November 4, 2008 | 9:42 am

I’m not authorized to answer that question; i know too little about msp…


November 4, 2008 | 10:03 am

When you want to re-trigger the entire loop in a groove~ object you should send it the "startloop" message. This will play your entire loop from the beginning.


November 4, 2008 | 8:46 pm

hi

thanks for your help

in my patch i have numbers continually coming in from a sensor which are then matched to a sample in a coll object which is then played using the groove object.
i am not sure (i am still learning) but i think that a sample starts to play but does not have time to finish before coll receives another number and another sample (or the same one) is played.
i would like the full sample to play before it is changed so i think i need to use a gate or something to stop numbers coming in until the sample is finished.

thanks in advance for any advice


Viewing 6 posts - 1 through 6 (of 6 total)