[PD] Creating a basic oscillator from first principles?
Frank Barknecht
fbar at footils.org
Mon Feb 9 10:17:05 CET 2009
Hallo,
Geoff hat gesagt: // Geoff wrote:
> Just a few things I need to clarify
> > The frequency of the phasor is determined by the slope of the line,
> > by the phase
> > increment k.
>
>
> If y=mx +k and wrapping this produces an oscillator, I understand
> that adding k can be the phase increment i.e. what point the waveform
> will start from,
The phase increment is not where the waveform starts but the amount
it advances each time step. So the phase increment would be m in the
equation y = mx + k. You can ignore k for phasor~-like signals, it
always is zero.
"y = mx + k" is a linear equation - see
http://en.wikipedia.org/wiki/Line_(geometry)
> Does this mean that in this example the [*~ 3] object represents m
> and therefore the frequency of the oscillator and you would add a
> [+~ ] to control the phase increment?
The [*~ 3] is a frequency multiplier. If you multiply a phasor signal
by x and then wrap it, you get a phasor signal with x times the base
frequency. You can see this in the example in that the vline~ produces
a burst of three spikes, although it itself is only doing a single
ramp.
If you add anything to that signal with [+~] you don't change the
frequency, only the offset from the x-axis i.e. the "DC offset" or the
start of a sample in a phasor-driven [tabread4~]-sampler.
> > In practice, in code, we combine the integrator and wrap into a
> > single unit
> > so that the line does not increase without bound. If it does then
> > the oscillator
> > will work for a while, but then the line will exceed the
> > representation range
> > of the CPU.
>
> Am I understanding you correctly in thinking that the integrator and
> wrap and combined so that rather than leave the integrator to keep
> counting higher and higher (unitl the processor can't cope) the wrap
> function is somehow combined with it so that the integrator keeps
> reseting itself so that the number it counts up to never gets that big?
In Andy's patches the wrap~ is not resetting the integrators, but in
the source code for [phasor~] in Pd, the integrator indeed is reset.
Btw: If you're like me and are always having difficulties reading
[biquad~] coefficients: In Andy's patch you could also use [rpole~ 1]
instead of the biquad.
rpole calculates this:
y[n] = y[n-1] + a[n] * x[n]
so if a == 1 it calculates: y[n] = y[n-1] + x[n] which means, it
constantly adds the new input to the old output to produce the next
output which is integration.
Ciao
--
Frank Barknecht Do You RjDj.me? _ ______footils.org__
More information about the Pd-list
mailing list