Tuesday 14 August 2018

A Bank of Max For Live Oscillators - revisited

When I created BankOSCmr0v01, I thought that it was quite a neat, simple multi-oscillator sound generator, and so I released it into the wild...

After a bug report, followed by careful investigations by myself, Ableton and Cycling'74, it looks like  we could not reliably generate the problem, and so I went back to playing with it and seeing where this took me - which is where it started to get really interesting...

The problem with large numbers of oscillators is always one of control. Additive synthesis suffers from this because there are lots of harmonics that you need to control. BankOSCmr has 32 oscillators, and so suffers from similar problems, although I was determined not to do a traditional 'separate envelope for each oscillator' and I was equally focussed on not going anywhere near the standard FFT-based 'draw a response' approach either - the beauty of having 32 separate oscillators with a few Hertz resolution across the audio band is that you have a very different audio palette to FFT-based generators. (Plus I have already done a couple of those!)


So I played around with logical extensions of what I already had, and this rapidly expanded into the control method that is in BankOSC0v03f. The main new additions are the Freq and Volume 'damping' controls, and these affect the way that the density of the oscillator frequencies and volumes are affected by the scanning across the oscillators. Low values of damping create thick clusters of frequencies, whilst high values of damping give more open, thin whips of frequencies. I also added a timed 'Update' function, which resets the frequencies and volumes of the oscillators to random values, just to add a bit of variety in how the oscillators can be controlled. You can also click on the 'New' (at the top of the Van De Graaf) to force a new set of random values for the oscillators.

And it was great fun. The additions allow a lot more control over the sound pallete that BankOSCmr could create, and widened the possible sounds as well. In fact, it felt like you could almost use it for performance as it was, and so I put it through 3rd hand, the automatic volume fader, and just played around for 12 minutes or so, capturing it on video.

The result is available on YouTube.

The (Updated) video demo of BankOSCmr0v03f was recorded live, and the only effect is Zynaptiq's superb free SubSpace plug-in to add a bit of spatial variety (If I could afford it, then I would be using their astonishingly wonderful Adaptiverb instead, which I fell in love with at NAMM, and which comes incredibly highly recommended by me!). 3rd Hand is just an automatic volume control. In more skilled hands than mine, then the demo would be better, and there's a few warts in the audio (this is version 0v03 remember!), but this was my first time putting everything together of a live video demo... and now I have added better text commentary...
So what's going on in the demo? Well, the Update time is set to just under 15 seconds, so there's a bit of timed underpinning in the background for much of the time, although I do turn it off, and then back on again, just to show how this is simple to do. Then I just explore the various controls. High and Low set the range of frequencies generated by the 32 oscillators, whilst the Time sets how long it takes for each oscillator to change frequency, so you can go from very quick jumps, to very slow glides. Freq and Volume control the damping, and the Run control sets how quickly the scan runs across the oscillators. Fill has two functions: above 0.1s it just generates ramp functions, whilst below that it generates random values. The ramps allow the generation of some very cool Shepard tones, as you can hear in the middle part of the demo. The random values can give some astonishing bell-like timbres, again in the middle of the demo. At the end, I break with convention, and keep altering things as the fade out progresses. One of my more commercial songs introduced a blistering lead solo just after half way through the final fade, just so that anyone who was listening got the feeling that there was more - kind of the reverse of Roxy Music's intro to Virginia Plain (Sound of lots of people looking this up on iTunes and Spotify...).

What intrigues me is that there are lots of videos on the Interweb that show people playing Modular synths live and 'DAW-less', whilst I haven't been able to find very many that show an Ableton Live plug-in being played live, sans any sequencing or pre-recorded backing. Well, now there is one. Enjoy!

Getting BankOSCmr0v03f

You can download BankOSCmr0v03f for free from MaxForLive.com.

Here are the instructions for what to do with the .amxd file that you download from MaxforLive.com:


(In Live 10, you can also just double-click on the .amxd file, but this puts the device in the same folder as all of the factory devices...)


Adaptiverb is incredibly highly recommended, and comes from Zynaptiq.

Modular Equivalents

In terms of modular equivalents, then reproducing this functionality in my modulars either involved 32 VCOs and four 8-step sequencers, or advanced oscillators banks or sequencers that I can't count as 'basic' modules, so I would rate this version as being about 46 ME (or 12ME if bank oscillators are allowed, or 8ME with fancy sequencers!).

Buy me a coffeeBuy me a coffee

Sunday 12 August 2018

Quantising MIDI controllers in a MaxForLive device for Ableton Live

Forums and Groups are interesting places to lurk. If you ignore the incessantly repeated questions and the obvious trolling, then you occasionally get a query from someone who wants to do something unusual and interesting, and can't see how to achieve it. Recently, just such an enquiry turned up on on one of the popular synthesizer forums, and here, belatedly, is a response.

The enquirer asked about how to make a movement-sensing MIDI controller more predictable or repeatable. If you have ever tried to use any location-dependent controller that relies on where you hold your hands in the open air, then you may already be resonating with the difficulty. If you have ever played a Theremin, then you probably already know one of the challenges: making rapid, precise and repeatable movements of your hand between a small number of locations in 3D space is difficult. There's also the 'two different actions at once' problem: making the 'pitch-controlling' movements as rapid as possible (but don't forget precise and repeatable!) with one hand, to reduce the portamento between notes (and making the pitching as accurate as possible), whilst at the same time, making slow back and forth 'volume-controlling' expression movements with the other hand. It's tricky to master, and one of the ways that the 'not in tune' pitch variability can be mitigated is to apply 'quantisation': constraining continuous values to a small set of fixed values. For note length then DAWs have quantisation as a standard function. For MIDI controller messages then I assumed that there would be lots of utilities readily available...


MIDIccQuant_mr is a utility device for Ableton Live, produced using MaxForLive, which quantises MIDI controller messages. Version 0v01 is the first release, and quantises to 4 levels, mainly because the UI for more than this starts to get awkward - but feedback should tell me if this is not enough levels.

Here's the overall flow diagram for what is happening, with the relevant bits of the UI above or below:

MIDIccQuant can process any one of 15 inputs, and the choices are the basic low-end simple controllers: Modulation, Breath Controllers, Foot Controller, Data Entry, Expression, and the general purpose controllers. These are the sort of controller numbers that a lot of MIDI Controller devices will be mapped to. I have always disliked the way that many utilities expect you to know what the controller numbers are, and so MIDIccQuant shows a number in the lower left hand corner that indicates what controller number incoming messages are from. Assuming that you don't have more than one controller active at once, then all you do is wiggle the MIDI Controller (or move your hand if it is a movement/position sensor) and look at the number that is displayed. To make it even easier, then clicking on the 'Copy' button will set the 15-button pad to that controller. If you prefer, and you already know the controller number, then you can just select the appropriate number on the pad!

The big 'CC' button controls the output of the processed controller value. When it is bright, then the controller value is quantised and sent out as a controller message. When it is dim, then the controller value is not quantised, and passes through the device unchanged. There's a big vertical indicator that shows the controller value.

There are seven rotary controls for the quantiser: three that set the levels at which the quantisation happens, and four that set what value is output for each of the four output states. This is slightly different to the way that note length quantisation does, because for that there is an assumption that you want to quantise a note to either slightly shorter or slightly longer, and so if you have an input that is just slightly longer than an 8th note, then you would expect it to be quantised to an 8th note, or a dotted 8th note, or maybe even a quarter note, depending on the quantiser settings. But MIDIccQuant allows the result of the quantisation to be any of the 128 MIDI controller values, and so if you set the lowest level to 15, then that output will be active for any incoming controller values between 0 and 15, and this could be set to output anything from 0-128. Rather like the Theremin, this might require some getting used to, and so the recommendation is that you set the outputs to get higher as you move up in the device UI.

Let's look at levels and outputs in more detail. The three 'Limit' rotary controls divide the 0-127 MIDI Controller values into 4 Levels:

So the lowest level (Level 1) is from 0 to Limit1 (0-18 in this example). The next level is Level 2, from Limit1 to Limit2 (19-65). Level 3 is from Limit2 to Limit3 (66-103) and finally, Level 4 is from Limit3 to 127 (104-127). Note that although the Levels are always arranged from 1 to 4, where Level 1 always starts at 0 and Level 4 always ends with 127, the same is not true for the Outputs - you can put any value you like (0-127!) for any level. If an output always has steps that increase as the input increases, then it is called 'Monotonic', and so this quantiser is non-monotonic. So if you want Level 1 to output 127, and Level 4 to output 0, then MIDIccQuant will do this.

In the above example, on the left hand side, as the input controller values increases, the output jumps UP from 30 to 48, then jumps UP to 82, then jumps UP to 101. So it always goes up as the input goes up - this is monotonic behaviour.

The right hand side has swapped the outputs for Levels 2 and 3, so Level 2 is 82, whilst Level 3 is 48. So as the incoming controller value increases, it starts out outputting 30, then when the input reaches 18, the output jumps UP to 82. As the incoming controller continues to increase, the output stays at 82 until the input is 65, at which point the output jumps DOWN to 48. When the input reaches 103, then the output jumps UP to 101. This is non-monotonic behaviour.

All you then need to do is make sure the whatever device you are controlling is getting the quantised controller value. Remember that if the 'CC' button is bright, then it will be receiving quantised controller values, and so the usual 'just testing' technique of waggling the mod wheel (et.) may not work if your quantisation is set with extreme values. So, slightly counterintuitively, you need to click the 'CC' button so that it goes dark, which bypasses the quantisation, and then do the testing. When the target device is confirmed to be receiving the controller values, then just click again on the 'CC' button to restore the quantisation.

To make the utility more useful, then there is a second output. The right hand side is my standard controller mapper, which lets you optionally invert the controller value, add an offset, scale it with the  'Depth' control, and map this to any controllable parameter in Ableton Live (and unmap it, of course). The 'Quant' button controls if the output from the parameter mapping is quantised or not, which can be useful if you want to have different consequences from the controller in two different places. The big 'Param' button disables the parameter output when dim, and enables the output when bright.

To visualise the quantisation levels, there's a display that shows the four levels - it builds up as you input values, so if you change the levels, then you can click on the 'Clear' button to clear the display. This can also be used as a simple MIDI controller debug facility.

More than just MIDI Controllers...

Version 0.02 adds a small input number at the top of the input bar indicator. This allows you to map any controller so that it can be processed by MIDIccQuant. So you can now take an LFO (or any other MaxForLive device that has a 'Map' button) and quantise its output! I'm expecting some interesting applications of this from my users...

Getting MIDIccQuant_mr_0v02

You can download MIDIccQuant_mr for free from MaxForLive.com.

Here are the instructions for what to do with the .amxd file that you download from MaxforLive.com:


(In Live 10, you can also just double-click on the .amxd file, but this puts the device in the same folder as the factory devices...)

Modular Equivalents

In terms of modular equivalents, then reproducing this functionality in my modulars was quite a challenge to achieve using standard 'basic' modules. My best simplistic solution required 4 separate 'brute force' quantisers plus several utility voltage processors, so I would rate this version as being about 9 ME. I'm intrigued that many modular quantisers assume that you want to quantise to fixed identical steps and monotonic levels, but I'm sure that there are loads of exception devices out there...

Buy me a coffeeBuy me a coffee