transitioning between waveforms

iulius's icon

currently using menu to switch between waveforms for a frequency, obviously there is an audible click each time i select a new waveform and this is something I'm trying to fix.

i've attempted to multiply the output of cycle~ into a clip~ object which results in something much like a square wave or rect~ but its not completely similar as much as i would like it to be.

what i'm trying to achieve is something much like the moog voyager where you have a knob that gently crossfades between various waveforms without audible clicks.

any help is greatly appreciated

Roman Thilenius's icon

you could let them run both and simply crossfade using *~

mackfisher's icon

I would recommend scanning a wave table. Cross fading between sources will create an audible dip in volume when you are transitioning between oscillators.

Peter Castine's icon

The main cause of a "dip" in crossfading is using a linear crossfade (and, if you do that, then you sort of deserve the results you get:-)

Using a quarter-cosine mapping is the standard approach to maintain equal power over a crossfade. Exactly how well that works will depend on your source material, but it generally does a good job.

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

What Peter said:

we use this a lot

iulius's icon

thanks for all the replies. i was hoping to get a little more elaboration on n00b_meisters patch... very interesting but i'm lacking the understanding as to how I could create that crossfade between waveforms smoothly, while interpolating the various points between each waveform.

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

As Peter says, the success of the non-linear crossfade is dependent upon source material, and with simple waveforms in the -1. +1. range you will get some cases where they exceed (=clipping) this range, so a linear crossfade might be better; for example:

Brendan

ps
Incidentally, there's a great patch from Gregory Taylor somewhere on the forum with a catalogue of waveform shapes built in gen, if you have that add-on. Might be of interest?

Roman Thilenius's icon

it seems to be easier to do *~ 0.5 when the range really is a problem. which it shouldnt be as long as we are inside the actual synth patcher.

not crossfading linear – and the use of interpolation – is a given. ;)

roger.carruthers's icon

Note that the 2d.wave~ patch that I posted (not mine) will alias at higher frequencies so you wont be able to do fun things like FM with it, so implementing a decent cross-fade is probably a better solution (it's just not as much fun ;-)

Axiom-crux's kink~ solution is pretty neat too, but again, you'll need to put it in an up-sampled poly~ to reduce aliasing,
Cheers
Roger

Peter McCulloch's icon

Instead of clip~ with cycle~ to make a square wave, use tanh~. It will generate odd partials but can be band limited. There's a CMJ article (Lazzarini, IIRC, is one of the authors) on distortion synthesis that presents a simple formula for calculating the multiplier. It works well.

Also, if you go the cross-fade route, you'll notice that there's a difference in average volume between cycle~ and rect~.