[PD] Creating a basic oscillator from first principles?

Frank Barknecht fbar at footils.org
Sat Feb 7 23:54:48 CET 2009


Hallo,
Geoff hat gesagt: // Geoff wrote:

> Thanks Frank this all makes sense up to
> 
> >Note that you need to use a kind of "fmod" for floating point numbers
> >here, i.e. replace the "%" with a calculation to get the fractional
> >part:
> >
> > fractional part of f = f - int(f)
> >
> >Also add an additional 1 if you deal with negative numbers.
> >
> 
> I can see from experimenting in PD that % doesn't want to behave the  
> same for decimal numbers.
> i.e. if I set % to 1 and increment (x[n] + 1/100) % 1
> nothing happens
> so I need some sort of fmod to deal with the fact that now the values  
> I am generating range from 0 to 1 in 0.01 increments.
> 
> could you expand on
> 
> fractional part of f = f - int(f)

it's simply: 

 [t f f]
 |  /
 |  [int]
 |  |
 [- ]

Check out the "message phasor" in the RjDj library for a full
implementation:
http://trac.rjdj.me/browser/trunk/rjlib/rj/c_mphasor.pd
http://trac.rjdj.me/browser/trunk/rjlib/rj/c_mphasor-help.pd

Ciao
-- 
Frank




More information about the Pd-list mailing list