# Best way to morph between waveforms

I am making an low-frequency oscillator (LFO) that should be able to output different kinds of waveforms. If I, say, want to be able to create a smooth transition from a sine wave to a square wave, what would the best approach be? I have thought about creating several hardcoded lookup-tables and "scroll" between these, but I am worried about the transition not being smooth enough, unless there are many of these tables.

If anyone knows about the best way/usual way to solve this problem, I would be happy to hear about it.

• The result of that is very simple and it's normally done with wavetables of very complex sounds, because additive synthesis of simple sines/pulses gives simple results. wavetable is a way to research it. it should be used to mix together many variables of the synth, filters, 50hz type lfo's, for physical modelling, other speeds, all into a coherent mix including the waveshape, not just the wavetable, which is for 8bit sounds and an 8 bit processing bank. – aliential Nov 18 '18 at 15:30

• @AranMulholland, the answer is circular cross-correlation. look for the $m$ that gets you the maximum $R_{xy}[m]$ where $$R_{xy}[m] = \sum\limits_{n=0}^{N-1} x[n] y\left[(n+m)\mod(N)\right]$$ we are assuming the two wavetables, $x[n]$ and $y[n]$, are of the same length $N$ and represent exactly one period of a periodic waveform. – robert bristow-johnson Oct 10 '15 at 21:02