| 96kHz.org |
| Advanced Audio Recording |
|
A Virtual Analog Oscillator in C This page shows an example of replacing an analog circuit with digital equations.
classical analog sine circuit The following image shows an interesting analog circuit to produce accurate sine waves with, presented in the LINEAR design journal 10 years ago. It has a remarkable distortion of less than 0,025%. Funnily it uses lamps to smoothly control the current in the path and linearize its behavior especially for low frequencies. Never tried to build it but WIEN bridge circuits generally come with high quality sine waves indeed.
a self oscillating circuit Such an oscillator equivalent can easily be built using two accumulators with a feedback and scaled factors in the path, realized with simple mathematical functions (dy/dt and dy/dt2):
The adders accumulate the incoming scaled
values and thus act as integrators. While the first accumulated
value represents a kind of "velocity", the second is the "position"
= "stress" in the system and directly determines the inverted
acceleration. The resulting equations for this case are a classical
differential equation system and result in a sine wave - the
familiar solution for oscillating mechanical and electrical systems.
To function as an oscillator finally, the blocks must have a time
delay, just as they do in reality. In a digital design, this means
they must be stateful, i.e., operate on a clock. The circuit then
generates time-discrete integration and multiplication for the
feedback factors. Clocking the last signal is generally sufficient.
Using appropriate constants or scaling factors, sustained undamped
oscillations can be generated in this way. In DSPs, floating-point
numbers are sufficient for this purpose.
virtual oscillating circuit in integer For INTEGER calculation see this page here: One has to use intelligent rounding and noising techniques to obtain a sufficient accuracy and avoid issues caused by vector truncation: Virtual Analog Oscillator
|
| © 2002 J.S. |