select and float - why can't I bang?!?

For topics related to using MsPinky inside the Max/MSP graphical programming environment
Post Reply
register
select and float - why can't I bang?!?

Post by register » Fri Dec 02, 2005 1:39 am

Hey, I'm REALLY sorry for multiple posts with me at my knees for help but... I think I have my random sample machine sorted except for one tiny weeny problem...



I am using groove~ right outlet to go an snapshot~ object, and monitoring how far through the sample playing is (it goes from 0 to 1). I want to use a select object, so that when the sample gets to the end (1), it triggers a bang. I've tried loads of stuff, but the select won't trigger the bang. The sel / bang will trigger, however, if I drag the mouse on the float number box, however, when running through the audio sample, no trouble occurs.



Like I say, I'm really sorry to keep posting about my incompetence, but your help would be greatly appreciated.

Thanks

Tom
dlpinkstah
Site Admin
Posts:1093
Joined:Mon Jun 07, 2004 9:17 pm

Re: select and float - why can't I bang?!?

Post by dlpinkstah » Fri Dec 02, 2005 8:02 am

register wrote:I am using groove~ right outlet to go an snapshot~ object, and monitoring how far through the sample playing is (it goes from 0 to 1). I want to use a select object, so that when the sample gets to the end (1), it triggers a bang. I've tried loads of stuff, but the select won't trigger the bang. The sel / bang will trigger, however, if I drag the mouse on the float number box, however, when running through the audio sample, no trouble occurs.
No sweat, Tom (register). I think your problem is simply that the select object never actually receives the exact "1" value that is sent from the right outlet of groove~. This is because of it's sampling interval. The sample it happens to take unfortunately is not the one you're needing. Try instead using an ==~ object to test for exact equality to 1.0. Then pass the output of the ==~ object to edge~. The left outlet of edge~ will bang every time the end of the sample has been reached and the exact 1.0 passes from the right outlet of groove~. Try this patch:



max v2;

#N vpatcher 199 153 1040 759;

#P button 452 369 15 0;

#P button 412 369 15 0;

#P window setfont "Sans Serif" 9.;

#P window linecount 1;

#P newex 412 346 50 196617 edge~;

#P newex 412 323 59 196617 ==~ 1.;

#B color 5;

#P toggle 411 164 15 0;

#P message 411 183 68 196617 loopinterp \$1;

#P message 283 215 73 196617 setloop 0. 500;

#P button 41 144 15 0;

#P message 200 210 58 196617 set abuffer;

#P message 23 246 49 196617 startloop;

#P message 26 205 27 196617 stop;

#P comment 344 279 71 196617 signal or float;

#P flonum 41 171 47 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;

#P message 107 330 27 196617 stop;

#P message 38 330 65 196617 startwindow;

#P message 179 149 24 196617 0.5;

#P message 173 127 19 196617 -1;

#P toggle 261 133 15 0;

#P message 261 158 41 196617 loop \$1;

#P window linecount 3;

#P comment 448 241 50 196617 set max loop point (ms);

#P flonum 411 247 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;

#P flonum 286 247 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;

#P window linecount 1;

#P newex 161 363 29 196617 dac~;

#P toggle 161 96 15 0;

#P newex 161 169 27 196617 sig~;

#P newex 161 294 261 196617 groove~ hitme;

#B color 5;

#P message 28 72 28 196617 read;

#P newex 28 95 95 196617 buffer~ hitme 2000;

#B color 15;

#P comment 59 73 100 196617 ‘‹open a sample file;

#P window linecount 3;

#P comment 322 240 50 196617 set min loop point (ms);

#P window linecount 1;

#P comment 284 134 75 196617 ‘‹loop on/off;

#P window linecount 2;

#P comment 179 97 103 196617 ‘‹play normal speed forward/stop;

#P window linecount 1;

#P comment 194 128 63 196617 ‘‹backward;

#P comment 205 150 38 196617 ‘ slow;

#P comment 171 314 62 196617 audio output;

#P window linecount 6;

#P comment 500 310 100 196617 sync output ramps from 0 at beginning of loop portion of sample (according to current min and max) to 1 at the end;

#P window linecount 1;

#P comment 38 316 69 196617 ‘‹start audio;

#P window linecount 3;

#P comment 62 130 54 196617 ‘‹start \, set sample position;

#P window linecount 1;

#P comment 218 279 71 196617 signal or float;

#P window linecount 4;

#P comment 59 191 79 196617 ‘ stop until int/float or startloop received;

#P comment 76 244 82 196617 start at loop point (or the beginning if none);

#P window linecount 3;

#P comment 333 70 174 196617 groove~ takes an optional second argument specifying the number of output channels (default 1).;

#P comment 171 254 35 196617 speed signal in;

#P window linecount 1;

#P comment 200 194 151 196617 Change the buffer~ being played;

#P comment 360 215 195 196617 set both min and max loop points together;

#P window linecount 2;

#P comment 410 133 100 196617 turn interpolation at loop points on/off;

#P user panel 25 310 123 43;

#X brgb 255 255 255;

#X frgb 100 202 30;

#X border 2;

#X rounded 0;

#X shadow 0;

#X done;

#P connect 20 0 19 0;

#P connect 39 0 34 0;

#P connect 23 0 22 0;

#P connect 30 0 22 0;

#P connect 31 0 22 0;

#P hidden connect 41 0 21 0;

#P hidden connect 40 0 21 0;

#P connect 22 0 21 0;

#P hidden connect 28 0 21 0;

#P hidden connect 34 0 21 0;

#P hidden connect 36 0 21 0;

#P hidden connect 37 0 21 0;

#P hidden connect 38 0 21 0;

#P connect 21 0 24 0;

#P fasten 32 0 24 0 43 358 166 358;

#P fasten 33 0 24 0 112 358 166 358;

#P connect 29 0 28 0;

#P connect 25 0 21 1;

#P connect 42 0 41 0;

#P connect 26 0 21 2;

#P connect 21 1 43 0;

#P connect 43 0 44 0;

#P connect 44 0 45 0;

#P connect 44 1 46 0;

#P pop;
benoitsimon
Posts:6
Joined:Tue Aug 09, 2005 2:52 pm
Location:france

Post by benoitsimon » Fri Dec 02, 2005 9:22 am

Hi Register,



You necessary need to use the "replace" message instead of "read". It will automatically resize your buffer~.
Post Reply