Close

Waveforms, Graphs, and Equations

A project log for NanoEgg Music Synthesizer

A powerful little music synthesizer with a classic look!

t-b-trzepaczT. B. Trzepacz 05/19/2016 at 11:430 Comments

I've been thinking for awhile now about a better way to handle the waveform select knob. I'd like to have one knob smoothly transition between all of the standard waveforms, with the option of selecting something in between. It would be easy to have several knobs that control the mix of all of the waves, but that is a lot of knobs, input lines, and panel space.
Let's see if we can do it in one!

In order to generate these smooth transitions between waveforms, I need to actually have equations for them. Making equations for sawtooth waves that turn into triangle waves is pretty easy, just line slope calculations after all. But making a sine wave that can skew was a little trickier..

It is a lot easier to debug this stuff when you can see what you are doing, so I looked around for some sort of equation graph viewer and found one at desmos.com. The great thing about this web app is that you can specify the range of values (aka window) for each equation, which is really handy when you are combining multiple equations to make one graph.

The equations and graph can actually be viewed online here: https://www.desmos.com/calculator/6efi3uujjr

So I currently only have a moving saw - triangle wave, and a deforming sine wave. Fortunately, the other inbetweens for the other waveforms can easily be generated by using LERP interpolation between the points. I'll store waveforms for Saw to Triangle, then LERP from triangle to sine, and then again to square.

From there I might start decreasing the pulse width, then transition to an exponential saw and back to the regular saw for full circle.

I'm worried about how much RAM I am going to take up with waveforms. It would be nice to calculate them on the fly, but I think it would be too slow...

Discussions