Forums > MaxMSP

Looping with sfplay~

April 26, 2006 | 5:51 pm

Hi there,

I am making my DJ patch still and have finally come around to the loop and cue system. The patch below is a new patch I hae started just for this because the one I had written in the main patch did not work and looked very messy (meaning I could not source the fault). I have now got a loop and cue system working, but when I turn off the looping it plays through the loop and then playback stops.What info. or signl does sfplay~ need to exit the loop and continue playback seamlessly?

Also, for reasons I do not understand, the "cue point 1 set" bang doesn’t always trigger value object to send the current time to the message box below, why is this and how can it be fixed?

Also how can this work with the file playing in reverse?

Help Please!

Heres the patch so far:

max v2;
#N vpatcher 164 74 811 945;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 234 46 46 9109513 speed $1;
#P flonum 234 24 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 86 523 96 9109513 Jump to cue point 1;
#P button 70 522 15 0;
#P toggle 49 502 15 0;
#P comment 64 502 70 9109513 Loop On/Off;
#P user ezdac~ 47 130 91 163 0;
#N vpatcher 662 64 1244 502;
#P inlet 396 111 15 0;
#P inlet 324 112 15 0;
#P inlet 194 113 15 0;
#P inlet 124 114 15 0;
#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P comment 398 142 119 9109516 3. jump to cue;
#P window setfont "Sans Serif" 9.;
#P comment 260 168 61 9109513 speed;
#P flonum 259 184 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 166 207 15 0;
#P window setfont "Sans Serif" 12.;
#P comment 274 142 119 9109516 2. turn on looping;
#P window setfont "Sans Serif" 9.;
#P comment 194 165 61 9109513 length;
#P toggle 324 167 15 0;
#P message 324 186 41 9109513 loop $1;
#P newex 13 225 68 9109513 speedlim 100;
#P flonum 194 184 62 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 166 231 38 9109513 + 500.;
#P message 124 231 35 9109513 set $1;
#P button 13 207 15 0;
#P flonum 124 184 64 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 124 255 94 9109513 pack 0. 0. 1.;
#P message 396 184 14 9109513 2;
#P message 124 276 104 9109513 preload 2 $1 $2 1 $3;
#P outlet 124 315 15 0;
#P window setfont "Sans Serif" 12.;
#P comment 122 142 133 9109516 1. set cue point;
#P window setfont "Sans Serif" 9.;
#P comment 125 165 61 9109513 start;
#P window linecount 6;
#P comment 13 254 100 9109513 this speedlim is a protective measure against preloading too often. in this example it shouldn’t be much of a problem though;
#P fasten 11 0 8 0 199 204 18 204;
#P fasten 7 0 8 0 129 204 18 204;
#P fasten 18 0 8 0 264 204 18 204;
#P connect 8 0 12 0;
#P connect 21 0 7 0;
#P connect 7 0 9 0;
#P fasten 12 0 6 0 18 245 129 245;
#P connect 9 0 6 0;
#P connect 6 0 4 0;
#P fasten 4 0 3 0 129 302 129 302;
#P fasten 13 0 3 0 329 297 129 297;
#P fasten 5 0 3 0 401 297 129 297;
#P fasten 11 0 17 0 199 204 171 204;
#P fasten 7 0 10 0 129 226 171 226;
#P connect 17 0 10 0;
#P connect 10 0 6 1;
#P connect 22 0 11 0;
#P connect 11 0 10 1;
#P fasten 18 0 6 2 264 227 213 227;
#P connect 23 0 14 0;
#P connect 14 0 13 0;
#P connect 24 0 5 0;
#P pop;
#P newobj 7 552 74 9109513 p looping;
#P flonum 234 446 73 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 278 388 73 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 144 386 73 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 278 283 73 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 144 283 73 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 234 498 73 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 234 470 56 9109513 expr $i1*-1.;
#P newex 234 419 27 9109513 -;
#P newex 278 362 75 9109513 value loopset2A;
#P newex 144 361 75 9109513 value loopset1A;
#P button 234 334 15 0;
#P newex 234 306 43 9109513 onebang;
#P button 288 236 15 0;
#P newex 278 257 73 9109513 value cueset1A;
#P comment 303 236 70 9109513 Cue point 2 set;
#P button 154 236 15 0;
#P newex 144 257 73 9109513 value cueset1A;
#P number 100 228 27 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 72 228 27 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 44 228 27 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 16 228 27 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 382 393 1018 736;
#P origin 0 4;
#P outlet 352 308 15 0;
#P outlet 243 308 15 0;
#P outlet 131 306 15 0;
#P outlet 30 307 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 259 204 68 9109513 expr $f1-$i2;
#P newex 352 227 45 9109513 * 1000.;
#P newex 158 158 68 9109513 expr $f1-$i2;
#P newex 243 182 33 9109513 * 60.;
#P newex 46 110 68 9109513 expr $f1-$i2;
#P window setfont "Sans Serif" 36.;
#P number 352 257 101 36 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 458 257 63 9109540 ms;
#P number 243 257 62 36 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 309 257 38 9109540 s;
#P number 131 257 62 36 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 131 135 33 9109513 * 60.;
#P window setfont "Sans Serif" 36.;
#P comment 195 257 38 9109540 m;
#P number 30 257 62 36 0 0 32 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 30 87 62 9109513 / 3600000.;
#P inlet 30 23 15 0;
#P window setfont "Sans Serif" 36.;
#P comment 94 257 28 9109540 h;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 16 0;
#P fasten 2 0 11 0 35 107 51 107;
#P fasten 2 0 11 1 35 106 109 106;
#P fasten 11 0 5 0 51 131 136 131;
#P connect 5 0 6 0;
#P connect 6 0 17 0;
#P fasten 5 0 13 0 136 154 163 154;
#P fasten 5 0 13 1 136 154 221 154;
#P fasten 13 0 12 0 163 179 248 179;
#P connect 12 0 8 0;
#P connect 8 0 18 0;
#P fasten 12 0 15 0 248 202 264 202;
#P fasten 12 0 15 1 248 201 322 201;
#P fasten 15 0 14 0 264 224 357 224;
#P connect 14 0 10 0;
#P connect 10 0 19 0;
#P pop;
#P newobj 30 202 59 9109513 p h:m:s:ms;
#P newex 184 109 50 9109513 metro 100;
#P flonum 144 173 147 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 144 138 53 9109513 snapshot~;
#P message 40 40 28 9109513 open;
#P toggle 70 40 15 0;
#N vpatcher 662 64 1233 324;
#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P comment 398 23 119 9109516 3. jump to cue;
#P window setfont "Sans Serif" 9.;
#P comment 260 49 61 9109513 speed;
#P flonum 259 65 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 166 88 15 0;
#P window setfont "Sans Serif" 12.;
#P comment 274 23 119 9109516 2. turn on looping;
#P window setfont "Sans Serif" 9.;
#P comment 194 46 61 9109513 length;
#P toggle 324 48 15 0;
#P message 324 67 41 9109513 loop $1;
#P newex 13 106 68 9109513 speedlim 100;
#P flonum 194 65 62 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 166 112 38 9109513 + 500.;
#P message 124 112 35 9109513 set $1;
#P button 13 88 15 0;
#P flonum 124 65 64 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 124 136 94 9109513 pack 0. 0. 1.;
#P message 396 65 14 9109513 2;
#P message 124 157 104 9109513 preload 2 $1 $2 1 $3;
#P outlet 124 196 15 0;
#P window setfont "Sans Serif" 12.;
#P comment 122 23 133 9109516 1. set cue point;
#P window setfont "Sans Serif" 9.;
#P comment 125 46 61 9109513 start;
#P window linecount 6;
#P comment 13 135 100 9109513 this speedlim is a protective measure against preloading too often. in this example it shouldn’t be much of a problem though;
#P fasten 11 0 8 0 199 85 18 85;
#P fasten 7 0 8 0 129 85 18 85;
#P fasten 18 0 8 0 264 85 18 85;
#P connect 8 0 12 0;
#P connect 7 0 9 0;
#P connect 9 0 6 0;
#P fasten 12 0 6 0 18 126 129 126;
#P connect 6 0 4 0;
#P fasten 5 0 3 0 401 178 129 178;
#P fasten 13 0 3 0 329 178 129 178;
#P fasten 4 0 3 0 129 183 129 183;
#P fasten 11 0 17 0 199 85 171 85;
#P connect 17 0 10 0;
#P fasten 7 0 10 0 129 107 171 107;
#P connect 10 0 6 1;
#P connect 11 0 10 1;
#P fasten 18 0 6 2 264 108 213 108;
#P connect 14 0 13 0;
#P pop;
#P newobj 87 40 45 9109513 p looping;
#N sfplay~ 2 0 1 deckA;
#P newobj 89 83 93 9109513 sfplay~ 2 0 1 deckA;
#P comment 169 236 69 9109513 Cue point 1 set;
#P user panel 140 211 98 93;
#X brgb 214 255 43;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 6;
#P comment 39 247 100 9109513 Sometimes when the bang here is clicked 0 is displayed in the message box below the value_cueset1A , why?;
#P fasten 29 0 32 0 149 468 12 468;
#P fasten 10 0 11 0 35 224 21 224;
#P fasten 26 0 32 1 239 519 33 519;
#P fasten 8 0 10 0 149 195 35 195;
#P fasten 10 1 12 0 51 224 49 224;
#P connect 3 0 33 0;
#P connect 35 0 32 2;
#P connect 36 0 32 3;
#P fasten 10 2 13 0 67 224 77 224;
#P connect 3 1 33 1;
#P fasten 39 0 3 0 239 73 94 73;
#P fasten 5 0 3 0 75 70 94 70;
#P fasten 6 0 3 0 45 70 94 70;
#P fasten 4 0 3 0 92 70 94 70;
#P fasten 32 0 3 0 12 64 94 64;
#P fasten 10 3 14 0 83 224 105 224;
#P connect 3 2 7 0;
#P fasten 9 0 7 0 189 134 149 134;
#P connect 7 0 8 0;
#P fasten 16 0 15 0 159 254 149 254;
#P connect 8 0 15 0;
#P connect 15 0 27 0;
#P fasten 21 0 22 0 239 357 149 357;
#P connect 27 0 22 0;
#P connect 22 0 29 0;
#P fasten 5 0 9 0 75 70 189 70;
#P connect 38 0 39 0;
#P fasten 19 0 20 0 293 254 239 254;
#P lcolor 6;
#P connect 20 0 21 0;
#P fasten 29 0 24 0 149 410 239 410;
#P connect 24 0 31 0;
#P connect 31 0 25 0;
#P connect 25 0 26 0;
#P fasten 30 0 24 1 283 411 256 411;
#P fasten 16 0 20 1 159 254 272 254;
#P lcolor 3;
#P fasten 8 0 18 0 149 195 283 195;
#P fasten 19 0 18 0 293 254 283 254;
#P connect 18 0 28 0;
#P fasten 21 0 23 0 239 357 283 357;
#P connect 28 0 23 0;
#P connect 23 0 30 0;
#P pop;


April 28, 2006 | 3:05 pm

Hi Jay,

I just wanted to tell you that all the answers to the questions are in
the help file, but I think you need an answer to a question you forgot
to ask… (sort of)

Jay Simpson wrote:
> when I turn off the looping it plays through the loop and then
> playback stops.

Everybody would assume you would stop it as verybody else does: switch
of the toggle which sends a zero which stops sfplay~…

> What info. or signl does sfplay~ need to exit the loop
> and continue playback seamlessly?

The answer how to stop is clear, the real question I think was HOW DO I
CONTINUE…

You’re already close, bang before you stop a snapshot at the position
outlet of sfplay~, use a cue number 100 for example to store the stop
position, then send 100 to continue…

You could have a look at my St.ools collection, I made some abstractions
with this technique, copy it and use them at your will…

Stefan

[][] [][][] [][] [][][]
[][][][][][][][][][][][][][][]

Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation

/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///

————————-x—-
–_____———–|———–
–(_|_ —-|—–|—–()—-
– _|_)—-|—–()———–
———-()————x—–

14, Av. Pr. Franklin Roosevelt,
94320 Thiais, France
Phone at CCMIX +33-1-57 42 91 09


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