Tuesday 26 November 2019

Redundant MIDI Note On Messages Used to Set the Probability of a Drum Event

The Ableton Live piano roll display for MIDI Events is interesting, in many ways. As someone who has been using hardware sequencers since the 1970s (ARP's model 1601 Sequencer, for example, or the Roland...,), and software sequencers since the 1980s (The UMI-2B/4M on the BBC B, for example... http://www.muzines.co.uk/articles/umi-4m-midi-composition-system/3975 from September 1988, or Dr.T's on the Atari...), then I have seen and used a lot of ways of representing and controlling musical data. Ableton's piano roll is quick and easy for some tasks, but I have always liked a list-based view for adding things like program changes, or tweaking the order of 'simultaneous' events that are serialised by MIDI transmission.
(Picture from Reverb.com, where you may be lucky enough to find and purchase classic devices like this one!)

However, most seriously of all, it has always been my exposure to Intelligent Music's RealTime sequencer that has had the most profound effect on me (with John Hollis's Trackman just behind it...). RealTime was arguably one of the first sequencers that showed the road away from tape recorder emulations and towards modern DAWs (When I reviewed it, I didn't return it: I bought it! http://www.muzines.co.uk/articles/realtime-intelligent-sequencer/5624 ). And one of the killer features for me was the randomisation control - a little toggle box with a random pattern inside it that turned boring hi-hat lines into much more interesting decoration, and which sounded much less like a robot playing. Some things get under your skin and into your head, and you may have noticed that many of my MaxForLive devices (and more) have a significant bias towards using probability as a control source.

Which is where Ableton's piano roll comes in. Power users probably already know about the 'select a note, press the '0' (zero) button' shortcut that disables or enables notes (it is in the pop-up menu for the piano roll), but I've always wanted a Modifier key version (Shift-Zero, or Control-Zero, or something else, that doesn't disable a note, but sets the probability of it happening. Having 'greyed out' disabled notes is okay, but I would like more!

Now, it is possible to make a MIDI Effect Rack that extracts a single MIDI note and uses MIDI velocity processing or the Arpeggiator to provide control over the probability of a note, but it is pretty awkward, and not very elegant. All of which sounds like a cue for a simple, neat MaxForLive MIDI Effect that lets you control the probability of notes happening.

MIDIprobD4 does exactly that - for four notes simultaneously (It is a 'quad' or four-channel device...). The D indicates that its primary intended use is for drum sounds - you put it just in front of the Drum Rack. I use it to make hi-hats less robotic, to make snares unpredictable... You get the idea. If I'm bored, then I assign all four channels to kick, snare, closed and open hi-hat, and fill the Clip piano Roll with drum notes, and it produces oodles of random drum patterns. In a world currently overflowing with Black Friday deals (and what are the from/to dates for that?) then the deal is my standard one - it is FREE and will remain so (unless something extraordinary happens!).

Redundant MIDI Note Offs

MIDI has some interesting back alleys. In the classic reference specification, Complete_MIDI_96-1-3.pdf', on Page 10. In the 'Note-Off' section, it says that a Note On message with a zero velocity is roughly equivalent to a Note Off message.

( For more MIDI documentation, please visit: https://www.midi.org/specifications ) 

Now for any MIDI device that is velocity sensitive, a velocity value of 1 (one up from zero) is going to tend to be quite low in volume - maybe only fractionally just above no sound at all. The opposite value, 127, is maximum volume, of course, and so in many cases, zero and 1 sound pretty similar - one is totally quiet, the other is as quiet as it can be without not playing at all. There's one other interesting feature of drums - they are almost always velocity-sensitive. Further, on page A-4 in the 'Assignment of Note On/Off Commands' section, it says that 'Since there is no harm or negative side effect in sending redundant Note Off messages then this is the recommended practice' when talking about ensuring that Note Ons and Note Offs are always paired together, eventually.

The 'Velocity of zero is a Note Off' feature and the 'Redundant Note Offs are ok' feature are the mechanisms that I exploited to control the probability of MIDI note events in MIDIprobD4. Yes, I could have produced a complex device that keeps track of Note On messages and waits for the corresponding Note Off messages, and controls the probability of a note happening by removing the complete pair of messages, but it is far easier to just change the velocity of a Note On message to zero - which changes it to a Note Off, and redundant Note Offs are ok. So the MIDI processing is vry simple - just a multiplier for the velocity value of zero or 1. With a multiplier of 1, then the velocity of the note is unchanged: 1 x any value from 1 to 127 is the value. But with a multiplier of zero, then any value from 1 to 127 is changed to zero, which is the equivalent of a Note Off message, and it is okay to send redundant Note Off messages!

The Max code is shown above. This is inside a patcher that handles the velocity, and so outside this is more code that separates the MIDI messages into Note Number and Velocity streams, and so this is just the velocity stream processing. The yellow number box is a buffer so that the time it takes for the 'Random' object to generate a random number doesn't affect the processing time of this patcher - the previous value is available immediately from the number box. The output of the '<=' object is either zero or 1, and this drives the multiplier. The Probability control is a 0-100 rotary percentage control. I have to confess that whilst this approach follows the MIDI Specification, the actual device isn't perfect (but then, many of my devices have quirks...) and so sometimes it shows a note with a high probability that doesn't actually make any sound. I have spent quite a while trying to find out what the problem is, but haven't been able to discover the cause. Perhaps a reader of this blog may be able to enlighten me?

Anyway, MIDIprobD4 has simple controls. From left to right the first rotary control in each of the four channels is the MIDI note selector (0-127, although most drum notes are typically going to be 36-60ish), then some memory slots/squares (shift-click to save, click to recall), then an indicator blinker to show that a note event has been received, then the rotary Probability Percentage control, and finally a second indicator blinker to show that an note event has been transmitted to the output. Minimalistic, although I'm sure it could be made even smaller...

And that's it. Put MIDIprobD4 just before your Drum Rack and you have control over the probability of four of the drum sounds. Enjoy!

Links from this blog post:

UMI-2B/4M on the BBC B (from muzines.co.uk)
ARP model 1601 Sequencer from Reverb.com
RealTime sequencer review (from muzines.co.uk)
MIDI Documentation

And a special mention for a wonderful repository of music magazines from what now seems to have been a 'golden age':

Mu:zines - an amazing resource!

Getting MIDIprobD4

You can get MIDIprobD4 here:


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

Oh, yes, and sometimes last-minute fixes do get added, which is why sometimes a blog post is behind the version number of MaxForLive.com...

Modular Equivalents

In terms of basic modular equivalents, then MIDIprobD4 would probably require four Random Noise Generators plus a quad MIDI Utility module to do the velocity multiplying, giving a total of about 5 ME (without all the stored memories, of course).

If you find my writing helpful, informative or entertaining, then please consider visiting this link:

No comments:

Post a Comment