0
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – aliential Nov 18 '18 at 15:30
0
$\begingroup$

this is what we sometimes call "Vector Synthesis" and other times call "Wavetable Synthesis". linear crossfading between equal-sized circular lookup tables usually suffices.

but make sure the waveforms are aligned. you can circularly delay (or "rotate") one lookup table relative to the other. choose a relative rotation so that the cross-correlation between the two waveforms is maximum. if you somehow crossfade between a sine wave and a square wave where the fundamental of the square wave is outa phase with the sine, you'll get a glitch in the crossfade.

| improve this answer | |
$\endgroup$
  • $\begingroup$ How do you calculate optimum rotation of the wave so they are aligned. How do you properly align a square wave with a sine wave? If all of your wave tables are single cycles will this be less of an issue? $\endgroup$ – Aran Mulholland Oct 10 '15 at 8:29
  • $\begingroup$ @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. $\endgroup$ – robert bristow-johnson Oct 10 '15 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.