Dopplator, the audio effects M4L device that I featured in the last blog, takes its sine-wave shape processing from an older Wavetable tool, and I've been playing with the Max For Live 'pow~' object quite a lot. By changing the exponent of the power law, you can do simple waveshaping, which is good for LFO applications, but I wanted to try using it for more direct audio processing.
I really like
Ableton Live's 'Saturator' effect. It's a powerful way to add extra harmonics to sounds, but I'm not a huge fan of the way that you control the
transfer function. So I've taken the 'pow~' function and used it as a simple transfer function to give a 'single-control' harmonics adding device, by using the power law function to 'square' the incoming audio. Compression at the waveform level is one way of thinking about it, although this has the side effect of causing distortion if the input contains more than one set of harmonically related frequencies. But distortion is often useful as well, and this is only a first trial run at an audio waveshaper.
Using an M4L object like 'pow~' on an audio signal isn't quite as straightforward as it appears. 'Pow~' only accepts positive inputs, and so you need to split the audio signal into the positive half and the negative half, and then invert the negative half, then do the processing, reverse the inverted half, and put the two halves back together again. So there's lots of processing around the 'pow~' object, just to enable it to get the right audio signals. Waveshapers can also be very sensitive to input levels, and so I've chosen to restrict the exponent to values less than 1 - higher than 1 and the curve acts like an expander, which increases the sensitivity to input level.
So, Squarer has a single control, which passes the audio waveform through mostly unchanged for a setting of 0%, and adds even harmonics as the percentage increases, with 100% just on the point of instability. If you take a sine wave and look at the output of Squarer with the M4L 'Scope' device, then as you increase the percentage , the waveform changes shape just like the Dopplator LFO control waveform.
And if you play more than one note, then you get intermodulation distortion... (This is why my preference is to put waveshaping just after the VCOs in a synthesizer, where you only get 'one note' at once.)
Squarer can be downloaded from
MaxForLive.com , as usual. I know it is very simple, but you may find it useful, and who knows where it will lead me to next...