resetting cycle~

peterworth@gmail.com's icon

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.

peterworth@gmail.com's icon

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

peterworth@gmail.com's icon

nope this doesn't seem to work

swieser1's icon

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.

peterworth@gmail.com's icon

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.

swieser1's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

peterworth@gmail.com's icon

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?

Max Patch
Copy patch and select New From Clipboard in Max.

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.
>
>
>
>
----------------------------------------------------

peterworth@gmail.com's icon

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..

Maurizio Giri's icon

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

m

Max Patch
Copy patch and select New From Clipboard in Max.

swieser1's icon

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.

peterworth@gmail.com's icon

ah yes that will work, thanks very much

peterworth@gmail.com's icon

the patch above works great.

thanks again