Monday, 8 September 2014

Waveshaping with a wavetable

Having tested a simple waveshaper with Squarer, I wondered if I could take the audio processing part and add it to the Wavetable Creator and make a more flexible wave-shaping utility. As it turned out, doing this went a lot faster than I expected and I rapidly had it working. So please welcome ShaveWapery 0v04.


ShaveWapery uses the same user interface as Wavetable Creator, but changed to the more fashionable 'dark' look, and using my standard lilac as the key color (there's now no chance of mixing the two utilities up!). You choose source waveforms from the on/off boxes at the top, set their amplitude and other parameters, and then press the 'Generate' button. The resulting waveshape appears in the box on the left and its spectrum is displayed underneath. But instead of just allowing you to export the wavetable, in ShaveWapery, it immediately becomes available as a transfer function for a waveshaper.

As always with transfer functions, starting off with a linear input/output relationship is always a good idea. In this case, a sawtooth produces a linear transfer function:


 and any audio should pass through mostly unaffected. Moving the 'Sharpen' control anti-clockwise should give a very similar 'squaring' of the sound to Squarer. And unlike the 'Saturator' built-in effect in Live, ShaveWapery allows you to add randomness to the transfer function:


which can produce some very interesting effects that are noise-like but also structured. There is an enormous range of things to try here, so explore away. As with all such waveform-based processing, if you input monophonic audio, then you will get monophonic output, but if you input polyphonic audio, then you will get distortion. I did thinking about calling this the Intermodulator, but I prefer ShaveWapery!

I'm currently working on improving the user interface - I'm not happy with the 'Generate' button, for instance. But this is just the first iteration.

As usual, ShaveWapery can be downloaded from MaxForLive.com .

Sunday, 7 September 2014

Square Power!

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...