Forums > MaxMSP

Time expansion of phasor~ without rate~???

January 31, 2007 | 10:33 pm

I need to expand the time scale of the output from a phasor~. Need it to be done in the signal domain WITHOUT rate~. Shrinking the timescale is easily accomplished by multiplication and pong however I can’t seem to think of how to do the time expansion???? Any help would be greatly appreciated.


January 31, 2007 | 11:17 pm

On 31-Jan-2007, at 23:33, Tyler Nitsch wrote:

> however I can’t seem to think of how to do the time expansion?

Why not simply adapt the frequency parameter to match the desired
time expansion? Or maybe I’m missing something.

————– http://www.bek.no/~pcastine/Litter/ ————-
Peter Castine +–> Litter Power & Litter Bundle for Jitter
Universal Binaries on the way
iCE: Sequencing, Recording &
Interface Building for |home | chez nous|
Max/MSP Extremely cool |bei uns | i nostri|
http://www.dspaudio.com/ http://www.castine.de


February 1, 2007 | 1:48 am

The idea is to have one master clock(phasor~) However the application involves inverting the direction of the saw wave created by phasor(ie. 0.->1. becomes 1.->0.) . The problem I run into with rate~ is when I do this operation on the master phasor~ the phase of the output of rate~ takes awhile to get back in phase with the original phasor.


February 1, 2007 | 3:21 am

Even when you send rate~ the "sync lock" message? I at least had a "Eureka!" experience when I noticed the different sync messages rate~ understands…maybe this is not your issue. You can also do the inversion by sending negative values to rate~.

Quote: Tyler Nitsch wrote on Wed, 31 January 2007 17:48
—————————————————-
> The idea is to have one master clock(phasor~) However the application involves inverting the direction of the saw wave created by phasor(ie. 0.->1. becomes 1.->0.) . The problem I run into with rate~ is when I do this operation on the master phasor~ the phase of the output of rate~ takes awhile to get back in phase with the original phasor.
—————————————————-


February 1, 2007 | 5:59 am

Also, for simple integer multiples of the fundamental frequency, I find
that this:

*~ n
|
%~ 1.

where N is an integer is scads more efficient. Also, I find that the
much neglected sah~ is a godsend for these kinds of patches…

Here’s a demo featuring envelope-following reversing (clap to reverse
the playback) and other goodies.

Peter McCulloch

#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P newex 654 164 39 196620 abs~;
#P flonum 731 90 55 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 731 64 55 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 1090 493 67 196620 sig~ 300.;
#P newex 1013 491 51 196620 sig~ 0.;
#P newex 1090 524 94 196620 sah~ 0.1;
#P newex 1013 524 63 196620 sah~ 0.1;
#P comment 196 102 100 196620 inversion lfo;
#P window linecount 5;
#P comment 1073 46 110 196620 Cleaner sync signal for sah~ than just
using phasor~ and sah~ 0.01;
#P window linecount 1;
#P newex 1020 18 83 196620 phasor~ 0.5;
#P newex 1020 79 42 196620 < ~ 0.;
#P newex 1020 48 48 196620 delta~;
#P user scope~ 1020 146 1120 196 256 3 128 -1. 1. 0 0. 0 0. 102 255 51
135 135 135 0;
#P comment 9 424 102 196620 Inversion signal;
#P comment 365 662 52 196620 Master;
#P comment 361 517 73 196620 Subdivided;
#P comment 854 37 136 196620 Master phasor speed;
#P window linecount 2;
#P comment 722 27 103 196620 Random number of subdivisions;
#P flonum 653 24 55 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 723 259 100 196620 random amp per loop;
#P flonum 732 297 55 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 1090 465 56 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 1013 465 56 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 893 203 144 196620 loadmess set drums 1;
#P window setfont "Sans Serif" 9.;
#P user waveform~ 893 234 310 118 3 9;
#W mode loop;
#W mouseoutput continuous;
#W unit ms;
#W grid 1000.;
#W ticks 0;
#W labels 1;
#W vlabels 0;
#W vticks 1;
#W bpm 120. 4.;
#W frgb 33 0 0;
#W brgb 60 178 173;
#W rgb2 0 95 255;
#W rgb3 0 0 0;
#W rgb4 0 0 0;
#W rgb5 190 137 255;
#W rgb6 100 100 100;
#W rgb7 100 100 100;
#P window setfont "Sans Serif" 12.;
#P newex 732 322 69 196620 rand~ 30.;
#P newex 732 392 63 196620 sah~ 0.1;
#P newex 953 628 27 196620 *~;
#P comment 717 731 346 196620 (since the microphone’s on the left on my
powerbook…);
#P user ubumenu 5 255 193 196620 0 1 1 0;
#X add No Inversion;
#X add Random inversion;
#X add Envelope controls inversion;
#X prefix_set 0 0 0;
#P newex 316 194 58 196620 >~ 0.01;
#P user scope~ 117 368 247 498 256 3 128 -1. 1. 0 0. 0 0. 102 255 51
135 135 135 0;
#P newex 316 158 101 196620 slide~ 1. 9000.;
#P newex 316 128 50 196620 >~ 0.1;
#P newex 117 300 193 196620 selector~ 2;
#P newex 316 93 157 196620 average~ 4000 absolute;
#P newex 316 57 39 196620 adc~;
#P window linecount 2;
#P comment 58 127 100 196620 percent chance of inversion;
#P flonum 59 165 55 12 0. 100. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 59 196 126 196620 scale 0. 100. -1. 1.;
#P flonum 248 233 55 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 853 60 60 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user gain~ 953 663 37 52 158 0 1.071519 7.94321 10.;
#P newex 953 557 130 196620 wave~ drums 0 300;
#P newex 1038 706 157 196620 buffer~ drums jongly.aif;
#P user number~ 668 218 724 237 12 3 3 2 0. 0. 0 0. 250 0. 0 0 0 221
221 221 222 222 222 0 0 0;
#P newex 654 108 42 196620 +~ 7.;
#P newex 653 82 41 196620 *~ 5.;
#P newex 654 137 68 196620 round~ 1.;
#P newex 653 51 61 196620 rand~ 3.;
#P newex 731 153 42 196620 < ~ 0.;
#P newex 731 126 48 196620 delta~;
#P newex 654 191 87 196620 sah~ 0.1;
#P newex 522 344 42 196620 < ~ 0.;
#P newex 522 315 48 196620 delta~;
#P flonum 208 124 55 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user ezdac~ 887 702 931 735 0;
#P newex 627 389 42 196620 !-~ 1.;
#P newex 208 155 69 196620 rand~ 0.2;
#P newex 208 261 50 196620 < =~ 0.;
#P newex 445 344 38 196620 +~ 1;
#P newex 445 383 87 196620 sah~ 0.1;
#P newex 445 418 193 196620 selector~ 2;
#P user scope~ 445 463 575 593 256 3 128 -1. 1. 0 0. 0 0. 102 255 51
135 135 135 0;
#P user scope~ 445 606 575 736 256 3 128 -1. 1. 0 0. 0 0. 102 255 51
135 135 135 0;
#P newex 853 88 83 196620 phasor~ 0.5;
#P newex 627 281 43 196620 %~ 1.;
#P newex 627 253 37 196620 *~ 8;
#P window linecount 2;
#P comment 548 220 100 196620 subdivisions of master;
#P connect 30 0 29 0;
#P fasten 39 0 34 0 10 287 122 287;
#P connect 34 0 37 0;
#P connect 13 0 10 0;
#P connect 10 0 9 0;
#P connect 9 0 34 1;
#P fasten 29 0 28 0 64 225 253 225;
#P connect 28 0 9 1;
#P fasten 38 0 34 2 321 286 304 286;
#P connect 32 1 33 0;
#P connect 32 0 33 0;
#P connect 33 0 35 0;
#P connect 35 0 36 0;
#P connect 36 0 38 0;
#P fasten 34 0 8 0 122 332 450 332;
#P connect 8 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 5 0;
#P lcolor 7;
#P fasten 3 0 4 0 858 601 450 601;
#P fasten 2 0 14 0 632 308 527 308;
#P connect 14 0 15 0;
#P connect 15 0 7 1;
#P lcolor 13;
#P connect 2 0 6 1;
#P fasten 3 0 1 0 858 242 632 242;
#P connect 1 0 2 0;
#P connect 2 0 11 0;
#P connect 11 0 6 2;
#P connect 50 0 19 0;
#P connect 19 0 21 0;
#P connect 21 0 22 0;
#P connect 22 0 20 0;
#P connect 20 0 68 0;
#P connect 68 0 16 0;
#P connect 16 0 1 1;
#P connect 16 0 23 0;
#P connect 66 0 21 1;
#P connect 67 0 22 1;
#P fasten 3 0 17 0 858 119 736 119;
#P connect 17 0 18 0;
#P connect 18 0 16 1;
#P connect 48 0 43 0;
#P connect 43 0 42 0;
#P fasten 15 0 42 1 527 374 790 374;
#P lcolor 13;
#P connect 27 0 3 0;
#P connect 45 0 44 0;
#P connect 26 0 12 1;
#P fasten 6 0 25 0 450 452 958 452;
#P lcolor 7;
#P connect 25 0 41 0;
#P lcolor 7;
#P connect 41 0 26 0;
#P lcolor 7;
#P connect 42 0 41 1;
#P lcolor 13;
#P connect 44 2 46 0;
#P connect 46 0 64 0;
#P connect 64 0 62 0;
#P connect 62 0 25 1;
#P connect 59 0 57 0;
#P connect 57 0 58 0;
#P connect 58 0 56 0;
#P fasten 15 0 62 1 527 374 1071 374;
#P lcolor 12;
#P connect 63 0 25 2;
#P connect 44 3 47 0;
#P connect 47 0 65 0;
#P connect 65 0 63 0;
#P fasten 15 0 63 1 527 374 1179 374;
#P lcolor 12;
#P window clipboard copycount 69;


February 1, 2007 | 6:37 am

Sheesh you guys are ninjas. Ok so the negative thing for rate~ and the modulus thingy defineatly made my patch more efficient, thanks!! Still the same problem though. I’ve pondered using sample and hold for time expanding a phasor~ but have yet to come up with a method that wouldn’t require feedback.


February 1, 2007 | 8:42 am


February 1, 2007 | 9:24 am

Peter, this second patch won’t open for me (first one worked fine)…even though it looks like it’s all there? I’m not complaining – seeing how I’m not paying, just letting you know.

Lewis

Quote: peter.mcculloch@gmail.com wrote on Thu, 01 February 2007 00:42
—————————————————-
> >
> > Sheesh you guys are ninjas.
> Yeah, well ninja-ing doesn’t really pay the bills at present. (Image
> of ninja pawning a throwing star…"$3?…but it’s a deadly shuriken!
> Aw…." (if there’s anyone in the NYC area who’s looking for Max
> lessons, there’s space at my dojo)
>
> I really don’t understand why rate~ won’t work for you. Can you
> explain why?
>
> The right inlet of rate can be updated at the signal rate, and with
> the appropriate operation mode, it should work just fine for this kind
> of task.
>
> For edumacational purposes, here’s one potential 3/4 solution. +=~ is
> the key; it provides the increment that a feedback loop gives you. The
> patch is happiest with integer multiples of the beat, though you can do
> other things too…
>
> Peter McCulloch
>
> #P window setfont "Sans Serif" 12.;
> #P flonum 453 56 87 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P newex 453 120 51 196620 sig~ 4.;
> #P message 172 618 24 196620 40;
> #P button 173 577 25 0;
> #P newex 173 519 50 196620 < ~ 0.1;
> #P newex 173 549 46 196620 edge~;
> #P newex 172 705 77 196620 noteout 10;
> #P newex 172 665 125 196620 makenote 127 100;
> #P message 234 619 24 196620 49;
> #P button 235 578 25 0;
> #P newex 235 520 50 196620 < ~ 0.1;
> #P newex 235 550 46 196620 edge~;
> #P window setfont "Sans Serif" 9.;
> #P message 702 537 27 196617 stop;
> #P message 630 537 65 196617 startwindow;
> #P newex 630 571 29 196617 dac~;
> #P comment 633 521 75 196617 � turn on audio;
> #P user panel 620 517 123 43;
> #X brgb 255 255 255;
> #X frgb 100 202 30;
> #X border 2;
> #X rounded 0;
> #X shadow 0;
> #X done;
> #P window setfont "Sans Serif" 12.;
> #P newex 337 464 43 196620 %~ 1.;
> #P flonum 337 21 58 12 0.05 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P newex 540 290 63 196620 sah~ 0.1;
> #P newex 398 153 50 196620 < =~ 0.;
> #P newex 398 209 65 196620 +~;
> #P newex 453 180 53 196620 *~;
> #P newex 453 152 42 196620 >~ 0.;
> #P newex 398 258 44 196620 !/~ 1.;
> #P newex 398 345 63 196620 sah~ 0.1;
> #P newex 594 241 42 196620 < ~ 0.;
> #P newex 594 209 48 196620 delta~;
> #P newex 472 380 49 196620 *~ 0.5;
> #P newex 472 325 78 196620 %~ 2.;
> #P user scope~ 337 645 467 775 256 3 128 -1. 1. 0 0. 0 0.01 102 255 51
> 135 135 135 0;
> #P user scope~ 337 511 467 641 256 3 128 -1. 1. 0 0. 0 0.01 102 255 51
> 135 135 135 0;
> #P newex 337 419 27 196620 +~;
> #P newex 337 373 71 196620 *~ 0.5;
> #P newex 337 49 71 196620 phasor~ 6;
> #P newex 472 293 34 196620 +=~;
> #P connect 32 0 33 0;
> #P connect 33 0 28 0;
> #P connect 27 0 28 0;
> #P connect 28 0 29 0;
> #P connect 1 0 31 0;
> #P connect 31 0 30 0;
> #P connect 30 0 32 0;
> #P connect 28 1 29 1;
> #P connect 26 0 27 0;
> #P connect 18 0 25 0;
> #P connect 25 0 24 0;
> #P connect 24 0 26 0;
> #P connect 17 0 1 0;
> #P connect 1 0 2 0;
> #P connect 2 0 3 0;
> #P connect 3 0 18 0;
> #P connect 18 0 4 0;
> #P fasten 1 0 5 0 342 86 312 86 312 644 342 644;
> #P fasten 7 0 3 1 477 407 359 407;
> #P fasten 34 0 15 0 458 146 403 146;
> #P connect 15 0 14 0;
> #P connect 14 0 11 0;
> #P lcolor 9;
> #P connect 11 0 10 0;
> #P connect 10 0 2 1;
> #P fasten 9 0 10 1 599 271 456 271;
> #P connect 35 0 34 0;
> #P connect 34 0 12 0;
> #P connect 12 0 13 0;
> #P connect 13 0 14 1;
> #P fasten 9 0 0 0 599 271 477 271;
> #P connect 0 0 6 0;
> #P connect 6 0 7 0;
> #P fasten 34 0 13 1 458 146 501 146;
> #P connect 10 0 7 1;
> #P fasten 14 0 16 0 403 247 545 247;
> #P lcolor 9;
> #P connect 16 0 6 1;
> #P connect 9 0 16 1;
> #P fasten 1 0 8 0 342 85 599 85;
> #P connect 8 0 9 0;
> #P fasten 23 0 21 0 707 566 635 566;
> #P connect 22 0 21 0;
> #P window clipboard copycount 36;
>
>
>
>
—————————————————-


February 1, 2007 | 4:21 pm


February 1, 2007 | 5:26 pm

Thanks for reposting Peter. After fiddling with all three patches I noticed that the second and third have a little bullet thing in the comment "turn on audio" which shows up as a question mark for me on the forum. I think this is the bullet (little dot) that appears in all of the .help files. If I remove that in textedit, then recopy the patch to the clip board, then both will open using new from clipboard. With it left in: neither will open using new from clip board, the 2nd one when saved to disk only opens in Max as a text document and the 3rd one when saved to disk opens as a patch but with a "degree" symbol followed by the letter Z where the bullet should be. I’m using Firefox 1.5.0.9 using Western (ISO-8859-15) character encoding. Just some info for any other web readers interested in what your patches contain….and perhaps for future patch posting? This must have come up before though?

Lewis


February 1, 2007 | 5:50 pm

I’m on OSX.3.9. You’re right that the startwindow bit is from a help
file but that sounds like a weird bug. (or the sort of thing that you’d
figure would have already come up) Maybe there’s some text encoding
issue with the web forum?

What happens when you use Safari?

Peter McCulloch

On Feb 1, 2007, at 12:26 PM, Lewis Keller wrote:

>
> Thanks for reposting Peter. After fiddling with all three patches I
> noticed that the second and third have a little bullet thing in the
> comment "turn on audio" which shows up as a question mark for me on
> the forum. I think this is the bullet (little dot) that appears in
> all of the .help files. If I remove that in textedit, then recopy the
> patch to the clip board, then both will open using new from clipboard.
> With it left in: neither will open using new from clip board, the 2nd
> one when saved to disk only opens in Max as a text document and the
> 3rd one when saved to disk opens as a patch but with a "degree" symbol
> followed by the letter Z where the bullet should be. I’m using
> Firefox 1.5.0.9 using Western (ISO-8859-15) character encoding. Just
> some info for any other web readers interested in what your patches
> contain….and perhaps for future patch posting? This must have come
> up before though?
>
> Lewis
> –
> Max/MSP 4.5.7
> OSX v.10.3.9
> 1.5Ghz G4 Powerbook w/512MB
>
> http://glewlio.com
>


February 1, 2007 | 6:12 pm

Yup, both patches open fine using new from clip board when copied from Safari. The bullet even shows up on the forum. I guess it’s a Firefox text encoding problem….good to know.

Lewis

Quote: peter.mcculloch@gmail.com wrote on Thu, 01 February 2007 09:50
—————————————————-
(or the sort of thing that you’d
> figure would have already come up) Maybe there’s some text encoding
> issue with the web forum?
>
> What happens when you use Safari?
>
> Peter McCulloch
—————————————————-


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