Variable Triangle Waveform & Reverse Saw

I am upgrading a simple oscillator project from an Arduino to Teensy 4.1 and saw that the audio library will save me a ton of coding. One key aspect of my project is that it lets you slowly change from a sawtooth wave, to a triangle then to a reverse saw (changing the slope of the rise and fall similar to changing the duty cycle on a square wave). I saw in the code there was "WAVEFORM_TRIANGLE_VARIABLE‎" but I didn't know if it only did saw to triangle or it kept going to reverse saw.

At the moment my Arduino calculates a table of 256 samples with Bresenham any time the control knob is changed, but this looks like an easy way to do it on the fly and not need tables. I only keep half the waveform in memory now, when I hit the end I count backwards and do some subtraction to get the right value for the negative half of the wave. At the moment all the values are unsigned ints and I deal with the DC offset in hardware. It was just easier to get rid of bugs using unsigned plus my DAC was just 2 RC filters on a PWM output. A real 12bit I2C DAC is on the way.

I did try to search, but no luck. Thanks in advance.
 
Hi, sorry I’m reasonably new here.

The variable triangle is triangle to saw so not saw, triangle reverse saw.

But the library is excellent and you can add in more options if happy to change the source code.

But another simple option is to use arbitrary waves with this you can load in a wave table and sweep the table.

Many AKWF tables have been converted already.

Look forward to seeing what you come up with.
 
Well may
Hi, sorry I’m reasonably new here.

The variable triangle is triangle to saw so not saw, triangle reverse saw.

But the library is excellent and you can add in more options if happy to change the source code.

But another simple option is to use arbitrary waves with this you can load in a wave table and sweep the table.

Many AKWF tables have been converted already.

Look forward to seeing what you come up with.
be I should have put a scope on this 1st. Mid point is triangle and shape extremes are saw. So exactly what you need 🫣
 
Back
Top