Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: Re: Re: Re: Phasor with variable phase

Date2009-03-06 21:58
Fromvictor
Subject[Csnd] Re: Re: Re: Re: Re: Phasor with variable phase
I see, so the fractional bit is to make sure the modulated phase sig
is between 0 and 1? If so, you could always do this

itab ftgen  1,0,1025,7,0,1024,1
aph phasor kfreq
aph tablei aph+kph,itab,1,0,1

the phase will be modulated, but the table lookup will keep it
wrapped around 0-1.

Victor

----- Original Message ----- 
From: "Mark Van Peteghem" 
To: 
Sent: Friday, March 06, 2009 9:01 PM
Subject: [Csnd] Re: Re: Re: Re: Phasor with variable phase


>A hypothetical example is
>
> aphasor phasor kfreq, kphase
> aphasor = aphasor + aphasor*(1-aphasor)*imult
> asig tablei kphasor, cosine, 1, 0, 1
>
> If I then add two signals like this together but one with a varying kphase 
> and another with a constant kphase, you get nice effects of interference, 
> like I already did with signals generated with vco2.
>
>
> Victor.Lazzarini@nuim.ie wrote:
>> So I can't see the need for anything extra; I am not
>> sure I understand the need for the frac() functions.
>>
>> Perhaps an usage example would help.
>>
>> Victor
>>
>> ----- Original Message -----
>> From: Michael Gogins 
>> Date: Friday, March 6, 2009 7:37 pm
>> Subject: [Csnd] Re: Re: Phasor with variable phase
>> To: csound@lists.bath.ac.uk
>>
>> > I think he means phase modulation.
>> >
>> > Regards,
>> > Mike
>> >
>> > On Fri, Mar 6, 2009 at 1:21 PM,  wrote:
>> > > I am not sure I understand what you want to do; phasor
>> > > outputs a varying phase, so I don't know what you mean
>> > > by a 'variable phase'.
>> > >
>> > > Victor
>> > >
>> > > ----- Original Message -----
>> > > From: Mark Van Peteghem 
>> > > Date: Friday, March 6, 2009 4:36 pm
>> > > Subject: [Csnd] Phasor with variable phase
>> > > To: csound@lists.bath.ac.uk
>> > >
>> > >> Hi,
>> > >>
>> > >> I'm looking for a way to make a phasor with a varying phase;
>> > >> with the
>> > >> phasor opcode the phase is fixed. Note that it should work for
>> > >> negative
>> > >> values of the phase, so a simple frac(x) doesn't work. So far
>> > >> the only
>> > >> two solutions I thought of are
>> > >>
>> > >> aphasor phasor kfreq
>> > >> aphasor = frac(frac(aphasor+kphase)-1)+1
>> > >>
>> > >> and
>> > >>
>> > >> setksmps 1
>> > >> kphasor phasor kfreq
>> > >> kphasor loopsegp kphasor+kphase, 0, 1, 1
>> > >> aphasor upsamp kphasor
>> > >>
>> > >> which look quite clumsy and maybe consume more CPU-time than
>> > >> necessary.
>> > >> --
>> > >>   Mark
>> > >>   _________________________________________
>> > >>   When you get lemons, you make lemonade.
>> > >>   When you get hardware, you make software.
>> > >>
>> > >>
>> > >>
>> > >> Send bugs reports to this list.
>> > >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> > >> "unsubscribe csound"
>> > >
>> > > ========================
>> > > Dr Victor Lazzarini
>> > > Senior Lecturer
>> > > Dept. of Music
>> > > National University of Ireland, Maynooth
>> > >
>> >
>> >
>> >
>> > --
>> > Michael Gogins
>> > Irreducible Productions
>> > Michael dot Gogins at gmail dot com
>> >
>> >
>> > Send bugs reports to this list.
>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> > "unsubscribe csound"
>>
>> ========================
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> National University of Ireland, Maynooth
>
> -- 
>  Mark
>  _________________________________________
>  When you get lemons, you make lemonade.
>  When you get hardware, you make software.
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound" 


Date2009-03-06 22:25
FromMark Van Peteghem
Subject[Csnd] Re: Re: Re: Re: Re: Re: Phasor with variable phase
Yes, the point is to keep it between 0 and 1, otherwise the effect is 
messed up.

I have thought about your solution, but unless I'm mistaken, the 
interpolation could generate a number between 0 and 1 when it 'jumps' 
from 1 to 0 at the end of each cycle, which would cause a stray value at 
the end of each cycle. With the table opcode that would not happen, but 
then the precision is too low, unless the table is very big.

I think it shouldn't be that hard to let the phasor opcode accept a 
k-rate variable for the phase, or is it?

Another solution I thought of is to slightly vary the frequency to 
imitate the phase variation (by adding the derivative of the phase 
variation to the frequency), but I think that is more difficult than my 
other two solutions.

victor wrote:
> I see, so the fractional bit is to make sure the modulated phase sig
> is between 0 and 1? If so, you could always do this
>
> itab ftgen  1,0,1025,7,0,1024,1
> aph phasor kfreq
> aph tablei aph+kph,itab,1,0,1
>
> the phase will be modulated, but the table lookup will keep it
> wrapped around 0-1.
>
> Victor
>
> ----- Original Message ----- From: "Mark Van Peteghem" 
> 
> To: 
> Sent: Friday, March 06, 2009 9:01 PM
> Subject: [Csnd] Re: Re: Re: Re: Phasor with variable phase
>
>
>> A hypothetical example is
>>
>> aphasor phasor kfreq, kphase
>> aphasor = aphasor + aphasor*(1-aphasor)*imult
>> asig tablei kphasor, cosine, 1, 0, 1
>>
>> If I then add two signals like this together but one with a varying 
>> kphase and another with a constant kphase, you get nice effects of 
>> interference, like I already did with signals generated with vco2.
>>
>>
>> Victor.Lazzarini@nuim.ie wrote:
>>> So I can't see the need for anything extra; I am not
>>> sure I understand the need for the frac() functions.
>>>
>>> Perhaps an usage example would help.
>>>
>>> Victor
>>>
>>> ----- Original Message -----
>>> From: Michael Gogins 
>>> Date: Friday, March 6, 2009 7:37 pm
>>> Subject: [Csnd] Re: Re: Phasor with variable phase
>>> To: csound@lists.bath.ac.uk
>>>
>>> > I think he means phase modulation.
>>> >
>>> > Regards,
>>> > Mike
>>> >
>>> > On Fri, Mar 6, 2009 at 1:21 PM,  wrote:
>>> > > I am not sure I understand what you want to do; phasor
>>> > > outputs a varying phase, so I don't know what you mean
>>> > > by a 'variable phase'.
>>> > >
>>> > > Victor
>>> > >
>>> > > ----- Original Message -----
>>> > > From: Mark Van Peteghem 
>>> > > Date: Friday, March 6, 2009 4:36 pm
>>> > > Subject: [Csnd] Phasor with variable phase
>>> > > To: csound@lists.bath.ac.uk
>>> > >
>>> > >> Hi,
>>> > >>
>>> > >> I'm looking for a way to make a phasor with a varying phase;
>>> > >> with the
>>> > >> phasor opcode the phase is fixed. Note that it should work for
>>> > >> negative
>>> > >> values of the phase, so a simple frac(x) doesn't work. So far
>>> > >> the only
>>> > >> two solutions I thought of are
>>> > >>
>>> > >> aphasor phasor kfreq
>>> > >> aphasor = frac(frac(aphasor+kphase)-1)+1
>>> > >>
>>> > >> and
>>> > >>
>>> > >> setksmps 1
>>> > >> kphasor phasor kfreq
>>> > >> kphasor loopsegp kphasor+kphase, 0, 1, 1
>>> > >> aphasor upsamp kphasor
>>> > >>
>>> > >> which look quite clumsy and maybe consume more CPU-time than
>>> > >> necessary.
>>> > >> --
>>> > >>   Mark
>>> > >>   _________________________________________
>>> > >>   When you get lemons, you make lemonade.
>>> > >>   When you get hardware, you make software.
>>> > >>
>>> > >>
>>> > >>
>>> > >> Send bugs reports to this list.
>>> > >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>> > >> "unsubscribe csound"
>>> > >
>>> > > ========================
>>> > > Dr Victor Lazzarini
>>> > > Senior Lecturer
>>> > > Dept. of Music
>>> > > National University of Ireland, Maynooth
>>> > >
>>> >
>>> >
>>> >
>>> > --
>>> > Michael Gogins
>>> > Irreducible Productions
>>> > Michael dot Gogins at gmail dot com
>>> >
>>> >
>>> > Send bugs reports to this list.
>>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>> > "unsubscribe csound"
>>>
>>> ========================
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> National University of Ireland, Maynooth
>>
>> -- 
>>  Mark
>>  _________________________________________
>>  When you get lemons, you make lemonade.
>>  When you get hardware, you make software.
>>
>>
>>
>> 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"
>
>

-- 
  Mark
  _________________________________________
  When you get lemons, you make lemonade.
  When you get hardware, you make software.


Date2009-03-06 23:38
FromIain McCurdy
Subject[Csnd] RE: Re: Re: Re: Re: Re: Re: Phasor with variable phase
is 'osciliktp' any good to you?

Iain


> Date: Fri, 6 Mar 2009 23:25:00 +0100
> From: Mark.Van.Peteghem@telenet.be
> To: csound@lists.bath.ac.uk
> Subject: [Csnd] Re: Re: Re: Re: Re: Re: Phasor with variable phase
>
> Yes, the point is to keep it between 0 and 1, otherwise the effect is
> messed up.
>
> I have thought about your solution, but unless I'm mistaken, the
> interpolation could generate a number between 0 and 1 when it 'jumps'
> from 1 to 0 at the end of each cycle, which would cause a stray value at
> the end of each cycle. With the table opcode that would not happen, but
> then the precision is too low, unless the table is very big.
>
> I think it shouldn't be that hard to let the phasor opcode accept a
> k-rate variable for the phase, or is it?
>
> Another solution I thought of is to slightly vary the frequency to
> imitate the phase variation (by adding the derivative of the phase
> variation to the frequency), but I think that is more difficult than my
> other two solutions.
>
> victor wrote:
> > I see, so the fractional bit is to make sure the modulated phase sig
> > is between 0 and 1? If so, you could always do this
> >
> > itab ftgen 1,0,1025,7,0,1024,1
> > aph phasor kfreq
> > aph tablei aph+kph,itab,1,0,1
> >
> > the phase will be modulated, but the table lookup will keep it
> > wrapped around 0-1.
> >
> > Victor
> >
> > ----- Original Message ----- From: "Mark Van Peteghem"
> > <Mark.Van.Peteghem@telenet.be>
> > To: <csound@lists.bath.ac.uk>
> > Sent: Friday, March 06, 2009 9:01 PM
> > Subject: [Csnd] Re: Re: Re: Re: Phasor with variable phase
> >
> >
> >> A hypothetical example is
> >>
> >> aphasor phasor kfreq, kphase
> >> aphasor = aphasor + aphasor*(1-aphasor)*imult
> >> asig tablei kphasor, cosine, 1, 0, 1
> >>
> >> If I then add two signals like this together but one with a varying
> >> kphase and another with a constant kphase, you get nice effects of
> >> interference, like I already did with signals generated with vco2.
> >>
> >>
> >> Victor.Lazzarini@nuim.ie wrote:
> >>> So I can't see the need for anything extra; I am not
> >>> sure I understand the need for the frac() functions.
> >>>
> >>> Perhaps an usage example would help.
> >>>
> >>> Victor
> >>>
> >>> ----- Original Message -----
> >>> From: Michael Gogins <michael.gogins@gmail.com>
> >>> Date: Friday, March 6, 2009 7:37 pm
> >>> Subject: [Csnd] Re: Re: Phasor with variable phase
> >>> To: csound@lists.bath.ac.uk
> >>>
> >>> > I think he means phase modulation.
> >>> >
> >>> > Regards,
> >>> > Mike
> >>> >
> >>> > On Fri, Mar 6, 2009 at 1:21 PM, <Victor.Lazzarini@nuim.ie> wrote:
> >>> > > I am not sure I understand what you want to do; phasor
> >>> > > outputs a varying phase, so I don't know what you mean
> >>> > > by a 'variable phase'.
> >>> > >
> >>> > > Victor
> >>> > >
> >>> > > ----- Original Message -----
> >>> > > From: Mark Van Peteghem <Mark.Van.Peteghem@telenet.be>
> >>> > > Date: Friday, March 6, 2009 4:36 pm
> >>> > > Subject: [Csnd] Phasor with variable phase
> >>> > > To: csound@lists.bath.ac.uk
> >>> > >
> >>> > >> Hi,
> >>> > >>
> >>> > >> I'm looking for a way to make a phasor with a varying phase;
> >>> > >> with the
> >>> > >> phasor opcode the phase is fixed. Note that it should work for
> >>> > >> negative
> >>> > >> values of the phase, so a simple frac(x) doesn't work. So far
> >>> > >> the only
> >>> > >> two solutions I thought of are
> >>> > >>
> >>> > >> aphasor phasor kfreq
> >>> > >> aphasor = frac(frac(aphasor+kphase)-1)+1
> >>> > >>
> >>> > >> and
> >>> > >>
> >>> > >> setksmps 1
> >>> > >> kphasor phasor kfreq
> >>> > >> kphasor loopsegp kphasor+kphase, 0, 1, 1
> >>> > >> aphasor upsamp kphasor
> >>> > >>
> >>> > >> which look quite clumsy and maybe consume more CPU-time than
> >>> > >> necessary.
> >>> > >> --
> >>> > >> Mark
> >>> > >> _________________________________________
> >>> > >> When you get lemons, you make lemonade.
> >>> > >> When you get hardware, you make software.
> >>> > >>
> >>> > >>
> >>> > >>
> >>> > >> Send bugs reports to this list.
> >>> > >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> >>> > >> "unsubscribe csound"
> >>> > >
> >>> > > ========================
> >>> > > Dr Victor Lazzarini
> >>> > > Senior Lecturer
> >>> > > Dept. of Music
> >>> > > National University of Ireland, Maynooth
> >>> > >
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > Michael Gogins
> >>> > Irreducible Productions
> >>> > Michael dot Gogins at gmail dot com
> >>> >
> >>> >
> >>> > Send bugs reports to this list.
> >>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body
> >>> > "unsubscribe csound"
> >>>
> >>> ========================
> >>> Dr Victor Lazzarini
> >>> Senior Lecturer
> >>> Dept. of Music
> >>> National University of Ireland, Maynooth
> >>
> >> --
> >> Mark
> >> _________________________________________
> >> When you get lemons, you make lemonade.
> >> When you get hardware, you make software.
> >>
> >>
> >>
> >> 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"
> >
> >
>
> --
> Mark
> _________________________________________
> When you get lemons, you make lemonade.
> When you get hardware, you make software.
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Windows Live™ Groups: Create an online spot for your favorite groups to meet. Check it out.

Date2009-03-07 20:29
FromMark Van Peteghem
Subject[Csnd] Re: RE: Re: Re: Re: Re: Re: Re: Phasor with variable phase
No, AFAIK it has the same problem when I do

setksmps 1
kphasor phasor kfreq, 0
kphasor = kphasor*(1-kphasor)*imult
ares osciliktp kfreq, gi_cosine, kphasor + kphase

unless you had something else in mind.

Iain McCurdy wrote:
> is 'osciliktp' any good to you?
>
> Iain
> **
> **
>
> > Date: Fri, 6 Mar 2009 23:25:00 +0100
> > From: Mark.Van.Peteghem@telenet.be
> > To: csound@lists.bath.ac.uk
> > Subject: [Csnd] Re: Re: Re: Re: Re: Re: Phasor with variable phase
> >
> > Yes, the point is to keep it between 0 and 1, otherwise the effect is
> > messed up.
> >
> > I have thought about your solution, but unless I'm mistaken, the
> > interpolation could generate a number between 0 and 1 when it 'jumps'
> > from 1 to 0 at the end of each cycle, which would cause a stray 
> value at
> > the end of each cycle. With the table opcode that would not happen, but
> > then the precision is too low, unless the table is very big.
> >
> > I think it shouldn't be that hard to let the phasor opcode accept a
> > k-rate variable for the phase, or is it?
> >
> > Another solution I thought of is to slightly vary the frequency to
> > imitate the phase variation (by adding the derivative of the phase
> > variation to the frequency), but I think that is more difficult than my
> > other two solutions.
> >
> > victor wrote:
> > > I see, so the fractional bit is to make sure the modulated phase sig
> > > is between 0 and 1? If so, you could always do this
> > >
> > > itab ftgen 1,0,1025,7,0,1024,1
> > > aph phasor kfreq
> > > aph tablei aph+kph,itab,1,0,1
> > >
> > > the phase will be modulated, but the table lookup will keep it
> > > wrapped around 0-1.
> > >
> > > Victor
> > >
> > > ----- Original Message ----- From: "Mark Van Peteghem"
> > > 
> > > To: 
> > > Sent: Friday, March 06, 2009 9:01 PM
> > > Subject: [Csnd] Re: Re: Re: Re: Phasor with variable phase
> > >
> > >
> > >> A hypothetical example is
> > >>
> > >> aphasor phasor kfreq, kphase
> > >> aphasor = aphasor + aphasor*(1-aphasor)*imult
> > >> asig tablei kphasor, cosine, 1, 0, 1
> > >>
> > >> If I then add two signals like this together but one with a varying
> > >> kphase and another with a constant kphase, you get nice effects of
> > >> interference, like I already did with signals generated with vco2.
> > >>
> > >>
> > >> Victor.Lazzarini@nuim.ie wrote:
> > >>> So I can't see the need for anything extra; I am not
> > >>> sure I understand the need for the frac() functions.
> > >>>
> > >>> Perhaps an usage example would help.
> > >>>
> > >>> Victor
> > >>>
> > >>> ----- Original Message -----
> > >>> From: Michael Gogins 
> > >>> Date: Friday, March 6, 2009 7:37 pm
> > >>> Subject: [Csnd] Re: Re: Phasor with variable phase
> > >>> To: csound@lists.bath.ac.uk
> > >>>
> > >>> > I think he means phase modulation.
> > >>> >
> > >>> > Regards,
> > >>> > Mike
> > >>> >
> > >>> > On Fri, Mar 6, 2009 at 1:21 PM,  wrote:
> > >>> > > I am not sure I understand what you want to do; phasor
> > >>> > > outputs a varying phase, so I don't know what you mean
> > >>> > > by a 'variable phase'.
> > >>> > >
> > >>> > > Victor
> > >>> > >
> > >>> > > ----- Original Message -----
> > >>> > > From: Mark Van Peteghem 
> > >>> > > Date: Friday, March 6, 2009 4:36 pm
> > >>> > > Subject: [Csnd] Phasor with variable phase
> > >>> > > To: csound@lists.bath.ac.uk
> > >>> > >
> > >>> > >> Hi,
> > >>> > >>
> > >>> > >> I'm looking for a way to make a phasor with a varying phase;
> > >>> > >> with the
> > >>> > >> phasor opcode the phase is fixed. Note that it should work for
> > >>> > >> negative
> > >>> > >> values of the phase, so a simple frac(x) doesn't work. So far
> > >>> > >> the only
> > >>> > >> two solutions I thought of are
> > >>> > >>
> > >>> > >> aphasor phasor kfreq
> > >>> > >> aphasor = frac(frac(aphasor+kphase)-1)+1
> > >>> > >>
> > >>> > >> and
> > >>> > >>
> > >>> > >> setksmps 1
> > >>> > >> kphasor phasor kfreq
> > >>> > >> kphasor loopsegp kphasor+kphase, 0, 1, 1
> > >>> > >> aphasor upsamp kphasor
> > >>> > >>
> > >>> > >> which look quite clumsy and maybe consume more CPU-time than
> > >>> > >> necessary.
> > >>> > >> --
> > >>> > >> Mark
> > >>> > >> _________________________________________
> > >>> > >> When you get lemons, you make lemonade.
> > >>> > >> When you get hardware, you make software.
> > >>> > >>
> > >>> > >>
> > >>> > >>
> > >>> > >> Send bugs reports to this list.
> > >>> > >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> > >>> > >> "unsubscribe csound"
> > >>> > >
> > >>> > > ========================
> > >>> > > Dr Victor Lazzarini
> > >>> > > Senior Lecturer
> > >>> > > Dept. of Music
> > >>> > > National University of Ireland, Maynooth
> > >>> > >
> > >>> >
> > >>> >
> > >>> >
> > >>> > --
> > >>> > Michael Gogins
> > >>> > Irreducible Productions
> > >>> > Michael dot Gogins at gmail dot com
> > >>> >
> > >>> >
> > >>> > Send bugs reports to this list.
> > >>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body
> > >>> > "unsubscribe csound"
> > >>>
> > >>> ========================
> > >>> Dr Victor Lazzarini
> > >>> Senior Lecturer
> > >>> Dept. of Music
> > >>> National University of Ireland, Maynooth
> > >>
> > >> --
> > >> Mark
> > >> _________________________________________
> > >> When you get lemons, you make lemonade.
> > >> When you get hardware, you make software.
> > >>
> > >>
> > >>
> > >> 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"
> > >
> > >
> >
> > --
> > Mark
> > _________________________________________
> > When you get lemons, you make lemonade.
> > When you get hardware, you make software.
> >
> >
> >
> > Send bugs reports to this list.
> > To unsubscribe, send email sympa@lists.bath.ac.uk with body 
> "unsubscribe csound"
>
> ------------------------------------------------------------------------
> Windows Live™ Groups: Create an online spot for your favorite groups 
> to meet. Check it out. 
> 

-- 
  Mark
  _________________________________________
  When you get lemons, you make lemonade.
  When you get hardware, you make software.


Date2009-03-07 22:02
FromIain McCurdy
Subject[Csnd] RE: Phasor with variable phase
I was imagining that you could replace the phasor altogether with an osciliktp as shown below. (Apologies if I'm missed something.)


sr     =     44100 
ksmps     =     1
nchnls     =     1   

gisine      ftgen    0, 0, 131072, 10, 1
   ;STRAIGHT LINE FUNCTION FROM ZERO TO 1
giphase    ftgen    0, 0, 131073, 7, 0, 131072, 1
 
instr 1
kfreq = 200
kphase = 0
aphase osciliktp kfreq, giphase, kphase
asig table aphase, gisine, 1
out asig*10000
endin


Iain


> Date: Sat, 7 Mar 2009 21:29:38 +0100
> From: Mark.Van.Peteghem@telenet.be
> To: csound@lists.bath.ac.uk
> Subject: [Csnd] Re: RE: Re: Re: Re: Re: Re: Re: Phasor with variable phase
>
> No, AFAIK it has the same problem when I do
>
> setksmps 1
> kphasor phasor kfreq, 0
> kphasor = kphasor*(1-kphasor)*imult
> ares osciliktp kfreq, gi_cosine, kphasor + kphase
>
> unless you had something else in mind.
>
> Iain McCurdy wrote:
> > is 'osciliktp' any good to you?
> >
> > Iain
> > **
> > **
> >
> > > Date: Fri, 6 Mar 2009 23:25:00 +0100
> > > From: Mark.Van.Peteghem@telenet.be
> > > To: csound@lists.bath.ac.uk
> > > Subject: [Csnd] Re: Re: Re: Re: Re: Re: Phasor with variable phase
> > >
> > > Yes, the point is to keep it between 0 and 1, otherwise the effect is
> > > messed up.
> > >
> > > I have thought about your solution, but unless I'm mistaken, the
> > > interpolation could generate a number between 0 and 1 when it 'jumps'
> > > from 1 to 0 at the end of each cycle, which would cause a stray
> > value at
> > > the end of each cycle. With the table opcode that would not happen, but
> > > then the precision is too low, unless the table is very big.
> > >
> > > I think it shouldn't be that hard to let the phasor opcode accept a
> > > k-rate variable for the phase, or is it?
> > >
> > > Another solution I thought of is to slightly vary the frequency to
> > > imitate the phase variation (by adding the derivative of the phase
> > > variation to the frequency), but I think that is more difficult than my
> > > other two solutions.
> > >
> > > victor wrote:
> > > > I see, so the fractional bit is to make sure the modulated phase sig
> > > > is between 0 and 1? If so, you could always do this
> > > >
> > > > itab ftgen 1,0,1025,7,0,1024,1
> > > > aph phasor kfreq
> > > > aph tablei aph+kph,itab,1,0,1
> > > >
> > > > the phase will be modulated, but the table lookup will keep it
> > > > wrapped around 0-1.
> > > >
> > > > Victor
> > > >
> > > > ----- Original Message ----- From: "Mark Van Peteghem"
> > > > <Mark.Van.Peteghem@telenet.be>
> > > > To: <csound@lists.bath.ac.uk>
> > > > Sent: Friday, March 06, 2009 9:01 PM
> > > > Subject: [Csnd] Re: Re: Re: Re: Phasor with variable phase
> > > >
> > > >
> > > >> A hypothetical example is
> > > >>
> > > >> aphasor phasor kfreq, kphase
> > > >> aphasor = aphasor + aphasor*(1-aphasor)*imult
> > > >> asig tablei kphasor, cosine, 1, 0, 1
> > > >>
> > > >> If I then add two signals like this together but one with a varying
> > > >> kphase and another with a constant kphase, you get nice effects of
> > > >> interference, like I already did with signals generated with vco2.
> > > >>
> > > >>
> > > >> Victor.Lazzarini@nuim.ie wrote:
> > > >>> So I can't see the need for anything extra; I am not
> > > >>> sure I understand the need for the frac() functions.
> > > >>>
> > > >>> Perhaps an usage example would help.
> > > >>>
> > > >>> Victor
> > > >>>
> > > >>> ----- Original Message -----
> > > >>> From: Michael Gogins <michael.gogins@gmail.com>
> > > >>> Date: Friday, March 6, 2009 7:37 pm
> > > >>> Subject: [Csnd] Re: Re: Phasor with variable phase
> > > >>> To: csound@lists.bath.ac.uk
> > > >>>
> > > >>> > I think he means phase modulation.
> > > >>> >
> > > >>> > Regards,
> > > >>> > Mike
> > > >>> >
> > > >>> > On Fri, Mar 6, 2009 at 1:21 PM, <Victor.Lazzarini@nuim.ie> wrote:
> > > >>> > > I am not sure I understand what you want to do; phasor
> > > >>> > > outputs a varying phase, so I don't know what you mean
> > > >>> > > by a 'variable phase'.
> > > >>> > >
> > > >>> > > Victor
> > > >>> > >
> > > >>> > > ----- Original Message -----
> > > >>> > > From: Mark Van Peteghem <Mark.Van.Peteghem@telenet.be>
> > > >>> > > Date: Friday, March 6, 2009 4:36 pm
> > > >>> > > Subject: [Csnd] Phasor with variable phase
> > > >>> > > To: csound@lists.bath.ac.uk
> > > >>> > >
> > > >>> > >> Hi,
> > > >>> > >>
> > > >>> > >> I'm looking for a way to make a phasor with a varying phase;
> > > >>> > >> with the
> > > >>> > >> phasor opcode the phase is fixed. Note that it should work for
> > > >>> > >> negative
> > > >>> > >> values of the phase, so a simple frac(x) doesn't work. So far
> > > >>> > >> the only
> > > >>> > >> two solutions I thought of are
> > > >>> > >>
> > > >>> > >> aphasor phasor kfreq
> > > >>> > >> aphasor = frac(frac(aphasor+kphase)-1)+1
> > > >>> > >>
> > > >>> > >> and
> > > >>> > >>
> > > >>> > >> setksmps 1
> > > >>> > >> kphasor phasor kfreq
> > > >>> > >> kphasor loopsegp kphasor+kphase, 0, 1, 1
> > > >>> > >> aphasor upsamp kphasor
> > > >>> > >>
> > > >>> > >> which look quite clumsy and maybe consume more CPU-time than
> > > >>> > >> necessary.
> > > >>> > >> --
> > > >>> > >> Mark
> > > >>> > >> _________________________________________
> > > >>> > >> When you get lemons, you make lemonade.
> > > >>> > >> When you get hardware, you make software.
> > > >>> > >>
> > > >>> > >>
> > > >>> > >>
> > > >>> > >> Send bugs reports to this list.
> > > >>> > >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> > > >>> > >> "unsubscribe csound"
> > > >>> > >
> > > >>> > > ========================
> > > >>> > > Dr Victor Lazzarini
> > > >>> > > Senior Lecturer
> > > >>> > > Dept. of Music
> > > >>> > > National University of Ireland, Maynooth
> > > >>> > >
> > > >>> >
> > > >>> >
> > > >>> >
> > > >>> > --
> > > >>> > Michael Gogins
> > > >>> > Irreducible Productions
> > > >>> > Michael dot Gogins at gmail dot com
> > > >>> >
> > > >>> >
> > > >>> > Send bugs reports to this list.
> > > >>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body
> > > >>> > "unsubscribe csound"
> > > >>>
> > > >>> ========================
> > > >>> Dr Victor Lazzarini
> > > >>> Senior Lecturer
> > > >>> Dept. of Music
> > > >>> National University of Ireland, Maynooth
> > > >>
> > > >> --
> > > >> Mark
> > > >> _________________________________________
> > > >> When you get lemons, you make lemonade.
> > > >> When you get hardware, you make software.
> > > >>
> > > >>
> > > >>
> > > >> 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"
> > > >
> > > >
> > >
> > > --
> > > Mark
> > > _________________________________________
> > > When you get lemons, you make lemonade.
> > > When you get hardware, you make software.
> > >
> > >
> > >
> > > Send bugs reports to this list.
> > > To unsubscribe, send email sympa@lists.bath.ac.uk with body
> > "unsubscribe csound"
> >
> > ------------------------------------------------------------------------
> > Windows Live™ Groups: Create an online spot for your favorite groups
> > to meet. Check it out.
> > <http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009>
>
> --
> Mark
> _________________________________________
> When you get lemons, you make lemonade.
> When you get hardware, you make software.
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Windows Live™ Contacts: Organize your contact list. Check it out.

Date2009-03-09 20:48
FromMark Van Peteghem
Subject[Csnd] Re: RE: Phasor with variable phase
This seems to work in about the same way as Victors solution, but it is 
one line shorter, so it may be faster. Thanks!

Iain McCurdy wrote:
> I was imagining that you could replace the phasor altogether with an 
> osciliktp as shown below. (Apologies if I'm missed something.)
>
>
> sr     =     44100 
> ksmps     =     1
> nchnls     =     1   
>
> gisine      ftgen    0, 0, 131072, 10, 1
>    ;STRAIGHT LINE FUNCTION FROM ZERO TO 1
> giphase    ftgen    0, 0, 131073, 7, 0, 131072, 1
>  
> instr 1
> kfreq = 200
> kphase = 0
> aphase osciliktp kfreq, giphase, kphase
> asig table aphase, gisine, 1
> out asig*10000
> endin
>
>
> Iain
>
>
> > Date: Sat, 7 Mar 2009 21:29:38 +0100
> > From: Mark.Van.Peteghem@telenet.be
> > To: csound@lists.bath.ac.uk
> > Subject: [Csnd] Re: RE: Re: Re: Re: Re: Re: Re: Phasor with variable 
> phase
> >
> > No, AFAIK it has the same problem when I do
> >
> > setksmps 1
> > kphasor phasor kfreq, 0
> > kphasor = kphasor*(1-kphasor)*imult
> > ares osciliktp kfreq, gi_cosine, kphasor + kphase
> >
> > unless you had something else in mind.
> >
> > Iain McCurdy wrote:
> > > is 'osciliktp' any good to you?
> > >
> > > Iain
> > > **
> > > **
> > >
> > > > Date: Fri, 6 Mar 2009 23:25:00 +0100
> > > > From: Mark.Van.Peteghem@telenet.be
> > > > To: csound@lists.bath.ac.uk
> > > > Subject: [Csnd] Re: Re: Re: Re: Re: Re: Phasor with variable phase
> > > >
> > > > Yes, the point is to keep it between 0 and 1, otherwise the 
> effect is
> > > > messed up.
> > > >
> > > > I have thought about your solution, but unless I'm mistaken, the
> > > > interpolation could generate a number between 0 and 1 when it 
> 'jumps'
> > > > from 1 to 0 at the end of each cycle, which would cause a stray
> > > value at
> > > > the end of each cycle. With the table opcode that would not 
> happen, but
> > > > then the precision is too low, unless the table is very big.
> > > >
> > > > I think it shouldn't be that hard to let the phasor opcode accept a
> > > > k-rate variable for the phase, or is it?
> > > >
> > > > Another solution I thought of is to slightly vary the frequency to
> > > > imitate the phase variation (by adding the derivative of the phase
> > > > variation to the frequency), but I think that is more difficult 
> than my
> > > > other two solutions.
> > > >
> > > > victor wrote:
> > > > > I see, so the fractional bit is to make sure the modulated 
> phase sig
> > > > > is between 0 and 1? If so, you could always do this
> > > > >
> > > > > itab ftgen 1,0,1025,7,0,1024,1
> > > > > aph phasor kfreq
> > > > > aph tablei aph+kph,itab,1,0,1
> > > > >
> > > > > the phase will be modulated, but the table lookup will keep it
> > > > > wrapped around 0-1.
> > > > >
> > > > > Victor
> > > > >
> > > > > ----- Original Message ----- From: "Mark Van Peteghem"
> > > > > 
> > > > > To: 
> > > > > Sent: Friday, March 06, 2009 9:01 PM
> > > > > Subject: [Csnd] Re: Re: Re: Re: Phasor with variable phase
> > > > >
> > > > >
> > > > >> A hypothetical example is
> > > > >>
> > > > >> aphasor phasor kfreq, kphase
> > > > >> aphasor = aphasor + aphasor*(1-aphasor)*imult
> > > > >> asig tablei kphasor, cosine, 1, 0, 1
> > > > >>
> > > > >> If I then add two signals like this together but one with a 
> varying
> > > > >> kphase and another with a constant kphase, you get nice 
> effects of
> > > > >> interference, like I already did with signals generated with 
> vco2.
> > > > >>
> > > > >>
> > > > >> Victor.Lazzarini@nuim.ie wrote:
> > > > >>> So I can't see the need for anything extra; I am not
> > > > >>> sure I understand the need for the frac() functions.
> > > > >>>
> > > > >>> Perhaps an usage example would help.
> > > > >>>
> > > > >>> Victor
> > > > >>>
> > > > >>> ----- Original Message -----
> > > > >>> From: Michael Gogins 
> > > > >>> Date: Friday, March 6, 2009 7:37 pm
> > > > >>> Subject: [Csnd] Re: Re: Phasor with variable phase
> > > > >>> To: csound@lists.bath.ac.uk
> > > > >>>
> > > > >>> > I think he means phase modulation.
> > > > >>> >
> > > > >>> > Regards,
> > > > >>> > Mike
> > > > >>> >
> > > > >>> > On Fri, Mar 6, 2009 at 1:21 PM,  
> wrote:
> > > > >>> > > I am not sure I understand what you want to do; phasor
> > > > >>> > > outputs a varying phase, so I don't know what you mean
> > > > >>> > > by a 'variable phase'.
> > > > >>> > >
> > > > >>> > > Victor
> > > > >>> > >
> > > > >>> > > ----- Original Message -----
> > > > >>> > > From: Mark Van Peteghem 
> > > > >>> > > Date: Friday, March 6, 2009 4:36 pm
> > > > >>> > > Subject: [Csnd] Phasor with variable phase
> > > > >>> > > To: csound@lists.bath.ac.uk
> > > > >>> > >
> > > > >>> > >> Hi,
> > > > >>> > >>
> > > > >>> > >> I'm looking for a way to make a phasor with a varying 
> phase;
> > > > >>> > >> with the
> > > > >>> > >> phasor opcode the phase is fixed. Note that it should 
> work for
> > > > >>> > >> negative
> > > > >>> > >> values of the phase, so a simple frac(x) doesn't work. 
> So far
> > > > >>> > >> the only
> > > > >>> > >> two solutions I thought of are
> > > > >>> > >>
> > > > >>> > >> aphasor phasor kfreq
> > > > >>> > >> aphasor = frac(frac(aphasor+kphase)-1)+1
> > > > >>> > >>
> > > > >>> > >> and
> > > > >>> > >>
> > > > >>> > >> setksmps 1
> > > > >>> > >> kphasor phasor kfreq
> > > > >>> > >> kphasor loopsegp kphasor+kphase, 0, 1, 1
> > > > >>> > >> aphasor upsamp kphasor
> > > > >>> > >>
> > > > >>> > >> which look quite clumsy and maybe consume more CPU-time 
> than
> > > > >>> > >> necessary.
> > > > >>> > >> --
> > > > >>> > >> Mark
> > > > >>> > >> _________________________________________
> > > > >>> > >> When you get lemons, you make lemonade.
> > > > >>> > >> When you get hardware, you make software.
> > > > >>> > >>
> > > > >>> > >>
> > > > >>> > >>
> > > > >>> > >> Send bugs reports to this list.
> > > > >>> > >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> > > > >>> > >> "unsubscribe csound"
> > > > >>> > >
> > > > >>> > > ========================
> > > > >>> > > Dr Victor Lazzarini
> > > > >>> > > Senior Lecturer
> > > > >>> > > Dept. of Music
> > > > >>> > > National University of Ireland, Maynooth
> > > > >>> > >
> > > > >>> >
> > > > >>> >
> > > > >>> >
> > > > >>> > --
> > > > >>> > Michael Gogins
> > > > >>> > Irreducible Productions
> > > > >>> > Michael dot Gogins at gmail dot com
> > > > >>> >
> > > > >>> >
> > > > >>> > Send bugs reports to this list.
> > > > >>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body
> > > > >>> > "unsubscribe csound"
> > > > >>>
> > > > >>> ========================
> > > > >>> Dr Victor Lazzarini
> > > > >>> Senior Lecturer
> > > > >>> Dept. of Music
> > > > >>> National University of Ireland, Maynooth
> > > > >>
> > > > >> --
> > > > >> Mark
> > > > >> _________________________________________
> > > > >> When you get lemons, you make lemonade.
> > > > >> When you get hardware, you make software.
> > > > >>
> > > > >>
> > > > >>
> > > > >> 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"
> > > > >
> > > > >
> > > >
> > > > --
> > > > Mark
> > > > _________________________________________
> > > > When you get lemons, you make lemonade.
> > > > When you get hardware, you make software.
> > > >
> > > >
> > > >
> > > > Send bugs reports to this list.
> > > > To unsubscribe, send email sympa@lists.bath.ac.uk with body
> > > "unsubscribe csound"
> > >
> > > 
> ------------------------------------------------------------------------
> > > Windows Live™ Groups: Create an online spot for your favorite groups
> > > to meet. Check it out.
> > > 
> >
> > --
> > Mark
> > _________________________________________
> > When you get lemons, you make lemonade.
> > When you get hardware, you make software.
> >
> >
> >
> > Send bugs reports to this list.
> > To unsubscribe, send email sympa@lists.bath.ac.uk with body 
> "unsubscribe csound"
>
> ------------------------------------------------------------------------
> Windows Live™ Contacts: Organize your contact list. Check it out. 
> 

-- 
  Mark
  _________________________________________
  When you get lemons, you make lemonade.
  When you get hardware, you make software.