Forums > MaxMSP

rotate buffer content

January 25, 2007 | 12:26 pm

Dear all, how can i give an offset to a soundfile in a buffer like rotate works for lists..i don’t think waveform has this feature..
thanks
michele


January 25, 2007 | 1:51 pm

hi michele,

Do you mean that you want to actually move the data around in the
buffer (as opposed to just moving a start pointer within the buffer)?
There may be better ways, but you could do this using peek~ and Poke~
and a second buffer. You would start the copy at a certain point
inside the buffer, copy to the end and then copy from the beginning
to the pointer. I think the easiest way to do this would be to count
from 0 to buffer length, and use [+ (start point)] plus one of the
objects that wraps number ranges (I think one off the Litter objects
does this).

As a possible start point for this, here’s a patch I put together
that copies from a selection one buffer, and adds the copy the the
end of previously copied material in a second buffer. You’ll need
tl.uzi from Trond’s 3POs.

(And thanks to Peter C for the 3PO abbreviation – I never thought of
that before!!)

David

max v2;
#N vpatcher 29 81 578 209;
#P origin 90 29;
#P window setfont "Sans Serif" 10.;
#P hidden newex 536 -7 168 196618 autopattr copybfrs @autoname 1;
#X prestore flonum 1 0 0.;
#X prestore flonum[1] 1 0 10.;
#X prestore flonum[2] 1 0 1.;
#X prestore flonum[3] 1 0 0.;
#X prestore flonum[4] 1 0 10.;
#X prestore flonum[5] 1 0 1.;
#X prestore ubumenu[1] 1 0 one;
#X prestore ubumenu[2] 1 0 two;
#X prestore ubumenu[3] 1 0 four;
#X prestore ubumenu[5] 1 0 one;
#X prestore ubumenu[6] 1 0 three;
#P objectname copybfrs;
#P hidden newex 268 500 30 196618 * 1.;
#P objectname *[5];
#P flonum 210 80 35 10 0. 2. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname flonum[5];
#P hidden newex 326 165 51 196618 * 1000.;
#P objectname *[4];
#P hidden newex 253 165 51 196618 * 1000.;
#P objectname *[3];
#P user ubumenu 151 80 50 196618 0 1 1 0;
#X add one;
#X add two;
#X add three;
#X add four;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P objectname ubumenu[6];
#P hidden newex 286 530 66 196618 prepend set;
#P user ubumenu 69 80 50 196618 0 1 1 0;
#X add one;
#X add two;
#X add three;
#X add four;
#X prefix_set 0 0
0;
#X pattrmode 1;
#P objectname ubumenu[5];
#P hidden newex 205 392 66 196618 prepend set;
#P flonum 324 81 46 10 0. 0 65 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname flonum[4];
#P flonum 266 80 46 10 0. 0 65 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname flonum[3];
#P hidden newex 208 203 30 196618 t i b;
#P hidden button 445 296 15 0;
#P hidden message 430 321 34 196618 set 0;
#P hidden newex 293 379 27 196618 + 0;
#P objectname +[4];
#P hidden newex 465 319 34 196618 t 0 0;
#P hidden newex 373 328 30 196618 t b i;
#P hidden newex 388 360 42 196618 bucket;
#P hidden newex 373 391 40 196618 accum;
#P hidden newex 232 530 46 196618 pack f f;
#P hidden newex 232 557 68 196618 peek~ three;
#P hidden newex 222 465 27 196618 + 0;
#P objectname +[3];
#P hidden newex 268 455 58 196618 peek~ one;
#P hidden newex 256 262 32 196618 t b b;
#P hidden newex 256 233 48 196618 select 0;
#P hidden newex 326 204 70 196618 mstosamps~;
#P hidden newex 253 204 70 196618 mstosamps~;
#P hidden newex 259 293 27 196618 int;
#P hidden newex 259 320 53 196618 tl.uzi;
#P window setfont "Sans Serif" 12.;
#P user ubumenu 381 80 100 196620 0 0 1 1;
#X setrgb 31 31 31 229 227 117 234 234 234 198 33 0 141 141 141 112
112 112;
#X add copy buffer;
#X prefix_set 0 0
0;
#X pattrmode 1;
#P objectname ubumenu[4];
#P window setfont "Sans Serif" 10.;
#P hidden newex 337 237 27 196618 !-;
#P comment 316 63 69 196618 duration (s);
#B color 5;
#P comment 263 63 54 196618 start (s);
#B color 5;
#P comment 206 63 56 196618 "gain";
#B color 5;
#P window setfont "Sans Serif" 14.;
#P comment 117 76 39 196622 =>>;
#B color 5;
#P window setfont "Sans Serif" 10.;
#P hidden newex 587 449 30 196618 * 1.;
#P objectname *[2];
#P flonum 211 23 35 10 0. 2. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname flonum[2];
#P hidden newex 645 114 51 196618 * 1000.;
#P objectname *[1];
#P hidden newex 572 114 51 196618 * 1000.;
#P objectname *;
#P user ubumenu 152 23 50 196618 0 1 1 0;
#X add one;
#X add two;
#X add three;
#X add four;
#X prefix_set 0 0
0;
#X pattrmode 1;
#P objectname ubumenu[3];
#P hidden newex 605 479 66 196618 prepend set;
#P user ubumenu 68 23 50 196618 0 1 1 0;
#X add one;
#X add two;
#X add three;
#X add four;
#X prefix_set 0 0
0;
#X pattrmode 1;
#P objectname ubumenu[2];
#P hidden newex 751 342 66 196618 prepend set;
#P user ubumenu 6 23 50 196618 0 1 1 0;
#X add one;
#X add two;
#X add three;
#X add four;
#X prefix_set 0 0
0;
#X pattrmode 1;
#P objectname ubumenu[1];
#P hidden newex 524 341 66 196618 prepend set;
#P flonum 325 24 46 10 0. 0 65 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname flonum[1];
#P flonum 267 23 46 10 0. 0 65 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname flonum;
#P hidden newex 527 152 30 196618 t i b;
#P hidden button 764 245 15 0;
#P hidden newex 597 414 31 196618 + 0.;
#P objectname +[2];
#P hidden newex 637 379 59 196618 peek~ two;
#P hidden message 749 270 34 196618 set 0;
#P hidden newex 612 328 27 196618 + 0;
#P objectname +[1];
#P hidden newex 784 268 34 196618 t 0 0;
#P hidden newex 692 277 30 196618 t b i;
#P hidden newex 707 309 42 196618 bucket;
#P hidden newex 692 340 40 196618 accum;
#P hidden newex 551 479 46 196618 pack f f;
#P hidden newex 551 506 68 196618 peek~ three;
#P hidden newex 541 414 27 196618 + 0;
#P objectname +;
#P hidden newex 576 379 58 196618 peek~ one;
#P hidden newex 575 211 32 196618 t b b;
#P hidden newex 575 182 48 196618 select 0;
#P hidden newex 645 153 70 196618 mstosamps~;
#P hidden newex 572 153 70 196618 mstosamps~;
#P hidden newex 578 242 27 196618 int;
#P hidden newex 578 269 53 196618 tl.uzi;
#P window setfont "Sans Serif" 12.;
#P user ubumenu 382 23 100 196620 0 0 1 1;
#X setrgb 31 31 31 229 227 117 234 234 234 198 33 0 141 141 141 112
112 112;
#X add merge buffers;
#X prefix_set 0 0
0;
#X pattrmode 1;
#P objectname ubumenu;
#P window setfont "Sans Serif" 10.;
#P hidden newex 656 186 27 196618 !-;
#P comment 317 6 69 196618 duration (s);
#B color 5;
#P comment 264 6 54 196618 start (s);
#B color 5;
#P comment 207 6 56 196618 "gain";
#B color 5;
#P window setfont "Sans Serif" 14.;
#P comment 54 19 19 196622 +;
#B color 5;
#P comment 118 19 39 196622 =>>;
#B color 5;
#P user panel -4 55 581 58;
#X brgb 91 91 91;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel -4 -2 581 58;
#X brgb 91 91 91;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P hidden fasten 68 1 67 0 94 97 194 97 194 346 210 346;
#P hidden fasten 46 0 64 0 386 97 194 97 194 168 213 168;
#P hidden fasten 47 2 54 0 292 346 227 346;
#P hidden fasten 54 0 56 0 227 498 237 498;
#P hidden fasten 69 0 55 0 291 551 237 551;
#P hidden connect 56 0 55 0;
#P hidden fasten 57 0 54 1 378 422 244 422;
#P hidden fasten 65 0 71 0 271 97 194 97 194 157 258 157;
#P hidden connect 71 0 49 0;
#P hidden fasten 64 0 51 0 213 232 261 232;
#P hidden connect 51 0 52 0;
#P hidden fasten 52 1 48 0 283 285 264 285;
#P hidden connect 48 0 47 0;
#P hidden fasten 67 0 53 0 210 416 273 416;
#P hidden fasten 61 0 53 0 298 414 273 414;
#P hidden connect 53 0 74 0;
#P hidden connect 74 0 56 1;
#P hidden fasten 45 0 48 1 342 291 281 291;
#P hidden fasten 70 1 69 0 176 97 194 97 194 494 291 494;
#P hidden fasten 73 0 74 1 215 97 194 97 194 494 293 494;
#P hidden fasten 47 2 61 0 292 359 298 359;
#P hidden fasten 49 1 61 1 318 232 323 232 323 373 315 373;
#P hidden fasten 66 0 72 0 329 97 194 97 194 157 331 157;
#P hidden connect 72 0 50 0;
#P hidden fasten 49 1 45 0 318 232 342 232;
#P hidden fasten 50 1 45 1 391 232 359 232;
#P hidden fasten 48 0 59 0 264 316 378 316;
#P hidden connect 59 0 57 0;
#P hidden fasten 62 0 57 0 435 384 378 384;
#P hidden fasten 75 1 46 0 593 54 386 54;
#P hidden fasten 75 1 8 0 593 17 387 17;
#P hidden fasten 59 1 58 0 398 353 393 353;
#P hidden fasten 60 0 58 0 470 347 393 347;
#P hidden fasten 60 1 58 0 494 347 393 347;
#P hidden connect 58 0 57 1;
#P hidden connect 63 0 62 0;
#P hidden fasten 64 1 63 0 233 232 450 232;
#P hidden connect 63 0 60 0;
#P hidden fasten 32 1 31 0 31 48 516 48 516 297 529 297;
#P hidden fasten 8 0 28 0 387 48 516 48 516 119 532 119;
#P hidden fasten 9 2 16 0 611 295 546 295;
#P hidden fasten 16 0 18 0 546 447 556 447;
#P hidden connect 18 0 17 0;
#P hidden fasten 35 0 17 0 610 500 556 500;
#P hidden fasten 19 0 16 1 697 371 563 371;
#P hidden fasten 29 0 37 0 272 48 516 48 516 77 577 77;
#P hidden connect 37 0 11 0;
#P hidden fasten 28 0 13 0 532 181 580 181;
#P hidden connect 13 0 14 0;
#P hidden fasten 23 0 15 0 617 363 581 363;
#P hidden fasten 31 0 15 0 529 365 581 365;
#P hidden fasten 14 1 10 0 602 234 583 234;
#P hidden connect 10 0 9 0;
#P hidden fasten 26 0 40 0 602 441 592 441;
#P hidden connect 40 0 18 1;
#P hidden fasten 7 0 10 1 661 240 600 240;
#P hidden fasten 15 0 26 0 581 403 602 403;
#P hidden fasten 36 1 35 0 177 48 516 48 516 445 610 445;
#P hidden fasten 39 0 40 1 216 48 516 48 516 420 612 420;
#P hidden fasten 9 2 23 0 611 308 617 308;
#P hidden fasten 25 0 26 1 642 402 623 402;
#P hidden fasten 11 1 23 1 637 181 642 181 642 322 634 322;
#P hidden fasten 33 0 25 0 756 363 642 363;
#P hidden fasten 23 0 25 0 617 363 642 363;
#P hidden fasten 30 0 38 0 330 48 516 48 516 77 650 77;
#P hidden connect 38 0 12 0;
#P hidden fasten 11 1 7 0 637 181 661 181;
#P hidden fasten 12 1 7 1 710 181 678 181;
#P hidden fasten 10 0 21 0 583 265 697 265;
#P hidden fasten 24 0 19 0 754 333 697 333;
#P hidden connect 21 0 19 0;
#P hidden fasten 22 1 20 0 813 296 712 296;
#P hidden fasten 22 0 20 0 789 296 712 296;
#P hidden fasten 21 1 20 0 717 302 712 302;
#P hidden connect 20 0 19 1;
#P hidden connect 27 0 24 0;
#P hidden fasten 34 1 33 0 93 48 516 48 516 310 756 310;
#P hidden fasten 28 1 27 0 552 181 769 181;
#P hidden connect 27 0 22 0;
#P pop;


January 25, 2007 | 3:29 pm


January 25, 2007 | 4:47 pm

Thanks a lot! i’ll give a look at the patch and the object soon as i can..all the best
michele


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