resetting cycle~

Oct 11, 2008 at 3:49pm

resetting cycle~

is there any way to send cycle~ back to the beginning of it’s cycle with a message? i know you can set the phase, but this can only alter the play position relative to its current position… i need to bang a load of different ones to synchronise their phase.

thanks.

#40287
Oct 11, 2008 at 4:17pm

just realised maybe i could send it a set tablename message. i’ll try it

#142352
Oct 11, 2008 at 5:05pm

nope this doesn’t seem to work

#142353
Oct 12, 2008 at 1:25am

Sending a zero to the phase inlet of a cycle~ object will always “reset” it back to 0. Phase is not relative to the current value being output from the cycle~ object, it’s absolute. So, sending a float to the phase input will always result in the same output.

#142354
Oct 12, 2008 at 12:48pm

Quote: swieser1 wrote on Sat, 11 October 2008 19:25
—————————————————-
> Sending a zero to the phase inlet of a cycle~ object will always “reset” it back to 0. Phase is not relative to the current value being output from the cycle~ object, it’s absolute. So, sending a float to the phase input will always result in the same output.
—————————————————-

i just checked this and it doesnt seem to be true – if i send it a 0, and its phase is already at 0, then it has no effect. if its phase is at (for example) 0.2, and then i send it a 0, it moves 0.2 of a cycle backwards (relative). i’m using the right inlet as a signal inlet by the way.

#142355
Oct 12, 2008 at 6:06pm

In any case, try this:

Use a cycle~ object with no argument for initial frequency, and use a phasor~ object connected to the phase inlet of the cycle~. Make the frequency of the phasor~ object equal to the frequency of the sine wave you want to get out of the cycle~. The phasor~ will drive the cycle~ object at the appropriate frequency, with the added bonus that you can send a 0 to the phase inlet of the phasor~, and it actually will reset the cycle~ object the way you want it to.

– Pasted Max Patch, click to expand. –
#142356
Oct 12, 2008 at 8:46pm

heh, i’m being awkward here, but i don’t think i can do that either, because the reason i’m using cycle~ in the first place rather than phasor is so that i can have a signal phase input (i need to control phase in the normal relative way and for it to be glitch free when it moves, but occasionally i will need to send a message to re-synchronise everything as well)

cheers for the suggestions anyway. maybe if there is a way to slide phasor’s phase around at signal rate then i could do that instead of using cycle~ at all?

Quote: swieser1 wrote on Sun, 12 October 2008 12:06
—————————————————-
> Hmm, you’re right. My bad.
>
> In any case, try this:
>
> Use a cycle~ object with no argument for initial frequency, and use a phasor~ object connected to the phase inlet of the cycle~. Make the frequency of the phasor~ object equal to the frequency of the sine wave you want to get out of the cycle~. The phasor~ will drive the cycle~ object at the appropriate frequency, with the added bonus that you can send a 0 to the phase inlet of the phasor~, and it actually will reset the cycle~ object the way you want it to.
>
>

– Pasted Max Patch, click to expand. –

>
>
—————————————————-

#142357
Oct 13, 2008 at 2:14pm

i’ve found that turning dsp off then on again has the desired effect. but i can’t believe there’s no other way to do this..

#142358
Oct 13, 2008 at 3:23pm

try this patch: to reset the phase you have to set it to zero AND send a bang to the third inlet.

m

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 407 424 27 196617 stop;
#P message 381 406 67 196617 startwindow;
#P newex 407 458 29 196617 dac~;
#P comment 337 239 35 196617 reset;
#P window linecount 2;
#P comment 263 226 64 196617 phase (can be a signal);
#P user number~ 264 256 315 271 9 3 3 1 0. 0. 0 0. 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user scope~ 219 358 349 488 256 3 128 -1. 1. 0 0. 0 0. 102 255 51 135 135 135 0;
#P button 339 257 15 0;
#P flonum 219 256 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#N vpatcher 20 74 357 316;
#P button 188 52 18 0;
#P window setfont “Sans Serif” 9.;
#P newex 188 78 18 196617 t 0;
#P newex 80 132 80 196617 +~;
#P newex 80 107 46 196617 phasor~;
#P newex 50 165 40 196617 cycle~;
#P inlet 188 32 15 0;
#P inlet 150 33 15 0;
#P inlet 80 35 15 0;
#P outlet 50 187 15 0;
#P connect 4 0 0 0;
#P connect 1 0 5 0;
#P connect 5 0 6 0;
#P connect 6 0 4 1;
#P fasten 7 0 5 1 193 101 121 101;
#P connect 2 0 6 1;
#P connect 3 0 8 0;
#P connect 8 0 7 0;
#P pop;
#P newobj 219 302 100 196617 p resettable_cycle~;
#P comment 216 236 33 196617 freq;
#P connect 9 0 8 0;
#P connect 10 0 8 0;
#P connect 5 0 1 1;
#P connect 1 0 4 0;
#P connect 3 0 1 2;
#P connect 2 0 1 0;
#P window clipboard copycount 11;

#142359
Oct 13, 2008 at 7:00pm

Quote: peterworth@gmail.com wrote on Sun, 12 October 2008 14:46
—————————————————-
> heh, i’m being awkward here, but i don’t think i can do that either, because the reason i’m using cycle~ in the first place rather than phasor is so that i can have a signal phase input (i need to control phase in the normal relative way and for it to be glitch free when it moves, but occasionally i will need to send a message to re-synchronise everything as well)
—————————————————-

Hmm well you want the best of both worlds, don’t you? ;)

I suppose you can still use a phasor~ to drive the cycle~ object, doing the absolute phase “resets” from the phasor~ phase inlet. Then, you could add a delay~ object in between the phasor~ and the cycle~ to do your relative phase adjustment. You’d need to do a little bit of math to figure out how many samples you’d need to delay the phasor~ by in order to shift its phase by the desired amount.

Getting a little bit complicated now, but I can’t think of any other way to get both relative and absolute phase adjustment at the same time.

#142360
Oct 13, 2008 at 7:01pm

ah yes that will work, thanks very much

#142361
Oct 13, 2008 at 7:02pm

the patch above works great.

thanks again

#142362

You must be logged in to reply to this topic.