[PD] phasor~ and osc~ right inlet: exact timing
brbrofsvl at gmail.com
Mon Apr 19 04:14:21 CEST 2010
> Coming up again with the 'smoother' topic:
> Is [phasor~]-[cos~ ] precision-wise and interpolation-wise the same as
> an [osc~]? If not, which has less error and why?
I think each one is 512-point linear interpolated.
#define LOGCOSTABSIZE 9
#define COSTABSIZE (1<<LOGCOSTABSIZE)
This would give you 512 points.
The code for both osc~ and cos~ have:
*out++ = f1 + frac * (f2 - f1);
Which, if the mnemonically named "frac" variable is just the
fractional part of the index between f1 and f2, is a simple linear
interpolation between the two points.
For this reason I almost always use an 8192-point [table] and
[tabread4~] if I need more accurate sinusoids; I've gotten pretty
severe errors especially in cases where I need to divide a signal by
the output of a cosine oscillator near 90-degrees phase (near the
zero-crossing), and even more especially where the numerator is also
near zero, just using [cos~], presumably both because the values from
the oscillator output are near zero and because the function is
changing at the greatest rate there.
IIRC SuperCollider's SinOsc uses an 8192-point table with linear
interpolation, and Phasor+BufRd you specify the table size and the
type of interpolation (the cubic is the same as the Hermite one in
In csound's oscil* or phasor+table* opcodes you specify the table size
(power of 2) and the type of interpolation (the cubic is identical to
the Lagrange one in Pd).
Someone please correct me if I'm mistaken.
More information about the Pd-list