[sdiy] triangle to sine converter
Seb Francis
seb at is-uk.com
Sat Oct 12 04:37:39 CEST 2002
Damn, I knew there was a catch! Still, it'll do nicely in my MIDI2CV as a low-CPU way to generate pseudo-sine LFOs. It'll be easy in a PIC to scale the amplitude of the triangle wave with frequency - as the frequency doubles, double the amplitude.
Seb
Tom May wrote:
> What you've got there is a curve made out of parabola pieces. Running
> the triangle through an integrator will do this. An integrator is
> just a low pass filter. Your output amplitude will be inversely
> proportional to frequency, which won't make a very good tri-sine
> converter unless you tune the filter simultaneously with your
> oscillator.
>
> Tom.
>
> Using Mozilla 4.79, Seb Francis <seb at is-uk.com> writes:
>
> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > Hi,
> > <p>I was working out how to generate a sine wave LFO in my MIDI2CV converter
> > without wasting loads of PIC CPU on floating point maths routines, and
> > I managed to work out the following simple algorithm (written in tcl -
> > great language for quickly trying out ideas):
> > <p>set dy 0
> > <br>set ddy 1
> > <p>set y 0
> > <br>set t 0
> > <br>while {$t <= 100} {
> > <br> incr y $dy
> > <br> incr dy $ddy
> > <br> if {$dy >= 10 || $dy <= -10} {
> > <br> set ddy [expr {0 - $ddy}]
> > <br> }
> > <p> set valueAtTimeT($t) $y
> > <br> incr t
> > <br>}
> > <p>This produces what _looks_ like a perfect sine wave (see gif below),
> > and it got me thinking about analog triangle to sine converters.
> > Basically the above algorithm increments "y" by the level of a triangle
> > wave ("dy" is following a triangle wave pattern, symmetrical about 0).
> > That is to say the gradient of a sine wave is a triangle wave about 0.
> > I'm not sure that this sounds totally right to me (although the result
> > looks like a sine) - I don't remember enough maths from school unfortunately.
> > <p>Now isn't the rate of voltage change (voltage gradient) across a capacitor
> > proportional to the current charging/discharging it? So a triangle
> > wave through a resistor, into a transistor-pair current mirror, charging/discharging
> > a capacitor would produce a perfect sine wave.
> > <p>Does this work? I can't remember ever seeing a triangle to sine
> > converter circuit like this.
> > <p>Just some ramblings of my brain ... ;-)
> > <p>Seb
> > <br>
> > <p><img SRC="cid:part1.3DA610ED.432086F0 at is-uk.com" height=190 width=600></html>
More information about the Synth-diy
mailing list