Csound Csound-dev Csound-tekno Search About

[Csnd] subdividing a synchronised phasor

Date2010-02-07 23:57
FromJ
Subject[Csnd] subdividing a synchronised phasor
Hello Everyone,

I have been working to subdivide a phasor in Csound in a manner similar to the sync~ object in Max/MSP. Essentially, this object outputs synchronised phasor signals at different subdivisions of a master phasor. I would like to use this structure to synchronise LFOs, step sequencers and samples to a common phasor.

So, for instance, for every 0 to 1 period of the phasor, a synched phasor may output 4, or may only output half, depending on the settings. I have got as far as reconstructing the behaviour of the sync~ object by doing something like this: 

phasor output to (% (1/sub)) / (1/sub) .... Where phasor is the master phasor output and "sub" is the subdivision factor. 

Basically, I am dividing 1 by a subdivision factor to get a fraction of the phasor's output, then putting the output of the phasor into a %, the dividing the output of that by the first number. I haven't actually run the code in Csound yet (just modelled it in Max), but it should work fine, as the maths seems to work.

It does work, and if given a subdivision factor of four, for instance, the equation outputs 4 periods for every 1 period of the master phasor.
What I can't figure out is this: how to make the synched phasor run slower than the master!

So my questions are these:

1. Can anyone think of a way to subdivide for a slower phasor (for instance, a master phasor that runs at 1hz with a synched slave at 0.5hz?
2. Is there an easier/better/more efficient way to do this?

My maths skills leave a lot to be desired, so sorry if I am not explaining well or just plain wrong!

Best, Jeremy

Date2010-02-08 14:34
FromAndres Cabrera
Subject[Csnd] Re: subdividing a synchronised phasor
Hi,

On Sun, Feb 7, 2010 at 11:57 PM, J  wrote:
> What I can't figure out is this: how to make the synched phasor run slower
> than the master!

Maybe a counter which accumulates everytime the phasor restars?

However this is where things get nasty as most calculations will take
place at k-rate, and the phasor's cycle might restart at any point in
between the control period.

Maybe the best way is to have several syncphasors in Csound, all with
frequencies multiples of each other and synchronized with the sync
output.


Cheers,
Andrés


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-02-08 16:49
FromJ
Subject[Csnd] Re: Re: subdividing a synchronised phasor
Hello Andres,

I was thinking to do this with syncphasor, but my understanding is that syncphasor will reset the synched phasors to zero immediately.

I suppose, though, if they were all multiples of each other, then this sync point should theoretically fall on or almost on the zero anyway, is that right?

I suppose my other option is just to have the master phasor run extremely slow, so that all usable values would be in range.

Hmm. Also, just for clarification, it is the Max "rate~" object, not "sync~" I am trying to reproduce.

Thank you, Jeremy

On Mon, Feb 8, 2010 at 2:34 PM, Andres Cabrera <mantaraya36@gmail.com> wrote:
Hi,

On Sun, Feb 7, 2010 at 11:57 PM, J <falabala66@gmail.com> wrote:
> What I can't figure out is this: how to make the synched phasor run slower
> than the master!

Maybe a counter which accumulates everytime the phasor restars?

However this is where things get nasty as most calculations will take
place at k-rate, and the phasor's cycle might restart at any point in
between the control period.

Maybe the best way is to have several syncphasors in Csound, all with
frequencies multiples of each other and synchronized with the sync
output.


Cheers,
Andrés


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2010-02-08 17:37
FromSteven Yi
Subject[Csnd] Re: Re: Re: subdividing a synchronised phasor
Hi Jeremy,

I'm not sure if this would help, but Hans Mikelson did an article on
Hard Sync a while back:

http://www.csounds.com/ezine/summer2002/sync/index.html

steven

On Mon, Feb 8, 2010 at 11:49 AM, J  wrote:
> Hello Andres,
> I was thinking to do this with syncphasor, but my understanding is that
> syncphasor will reset the synched phasors to zero immediately.
> I suppose, though, if they were all multiples of each other, then this sync
> point should theoretically fall on or almost on the zero anyway, is that
> right?
> I suppose my other option is just to have the master phasor run extremely
> slow, so that all usable values would be in range.
> Hmm. Also, just for clarification, it is the Max "rate~" object, not "sync~"
> I am trying to reproduce.
> Thank you, Jeremy
> On Mon, Feb 8, 2010 at 2:34 PM, Andres Cabrera 
> wrote:
>>
>> Hi,
>>
>> On Sun, Feb 7, 2010 at 11:57 PM, J  wrote:
>> > What I can't figure out is this: how to make the synched phasor run
>> > slower
>> > than the master!
>>
>> Maybe a counter which accumulates everytime the phasor restars?
>>
>> However this is where things get nasty as most calculations will take
>> place at k-rate, and the phasor's cycle might restart at any point in
>> between the control period.
>>
>> Maybe the best way is to have several syncphasors in Csound, all with
>> frequencies multiples of each other and synchronized with the sync
>> output.
>>
>>
>> Cheers,
>> Andrés
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-02-08 18:07
FromJ
Subject[Csnd] Re: Re: Re: Re: subdividing a synchronised phasor
Thank you Steven, this does open up some possibilities, I hadn't thought to scale them through multiplication. I will have to experiment and see what works best.

Best, Jeremy

On Mon, Feb 8, 2010 at 5:37 PM, Steven Yi <stevenyi@gmail.com> wrote:
Hi Jeremy,

I'm not sure if this would help, but Hans Mikelson did an article on
Hard Sync a while back:

http://www.csounds.com/ezine/summer2002/sync/index.html

steven

On Mon, Feb 8, 2010 at 11:49 AM, J <falabala66@gmail.com> wrote:
> Hello Andres,
> I was thinking to do this with syncphasor, but my understanding is that
> syncphasor will reset the synched phasors to zero immediately.
> I suppose, though, if they were all multiples of each other, then this sync
> point should theoretically fall on or almost on the zero anyway, is that
> right?
> I suppose my other option is just to have the master phasor run extremely
> slow, so that all usable values would be in range.
> Hmm. Also, just for clarification, it is the Max "rate~" object, not "sync~"
> I am trying to reproduce.
> Thank you, Jeremy
> On Mon, Feb 8, 2010 at 2:34 PM, Andres Cabrera <mantaraya36@gmail.com>
> wrote:
>>
>> Hi,
>>
>> On Sun, Feb 7, 2010 at 11:57 PM, J <falabala66@gmail.com> wrote:
>> > What I can't figure out is this: how to make the synched phasor run
>> > slower
>> > than the master!
>>
>> Maybe a counter which accumulates everytime the phasor restars?
>>
>> However this is where things get nasty as most calculations will take
>> place at k-rate, and the phasor's cycle might restart at any point in
>> between the control period.
>>
>> Maybe the best way is to have several syncphasors in Csound, all with
>> frequencies multiples of each other and synchronized with the sync
>> output.
>>
>>
>> Cheers,
>> Andrés
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"