[PD] Analog/good-sounding oscillators in PD

Mathieu Bouchard matju at artengine.ca
Sat Apr 8 04:28:39 CEST 2006


On Thu, 6 Apr 2006, Christian Klippel wrote:

> you can achive the same effect by using kind of a table, where the input
> sample from the perfect osc is used to select an output sample of a
> table.

Isn't that called waveshaping?

This may also be achieved by some [expr~] formula. It's sometimes faster
or more accurate, depending on which table sizes you use normally.

Mapping the whole range in 16-bit using an array requires at least 128k
RAM (256k in Pd); mapping it in 24-bit requires 48M RAM (64M RAM in Pd). 

A modest-sized table can be used together with [tabread4~] and that's how
[osc~] works internally so if the speed of [tabread4~] is ok then you can
get something super accurate.

> that way you can map nonlinearities of any osc, amp, speaker, whatever
> to any other signal.

I'd suspect that the rate of change of the current also affects the 
signal, due to reactance, right? Then how would you model it?

> instead of the sudden change from 0 to +1 (or -1 to +1), wich introduces
> a high frequency part, you may interpolate that through some samples.

This is equivalent to introducing some kind of low-pass after the 
squarewave. A low-pass doesn't exactly interpolate because the signal 
doesn't necessarily go thru the control points, but it may be close 
enough and/or correctable.

> you will see that there is sometimes kind of overswing at the corners.
> so instead of 0..1 it goes more like 0...1,1...0,9.....1.....

Doesn't that look like the Gibbs effect on a truncater Fourier series?

Or maybe a higher-order IIR low-pass (not sure)

> some stuff i tried once was to "filter" signal just by a sine
> function....  this already gets out the digital distortion, in case a
> signal is below/above -1/+1 ....

I'm using tanh() instead because it doesn't bounce back: very high
amplitude signals thru sin() sound like white noise, whereas thru tanh()  
they sound like squarewaves. If I wanted to emulate overswing I'd prolly
try to combine tanh() with something else.

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada




More information about the Pd-list mailing list