Monday, 2 December 2019

Free random velocity repeated notes without using MaxForLive!

In the run up to Christmas, I have been known to release something seasonal, and this has usually been in MaxForLive... This year, in a break from that tradition, I'm releasing something that any Ableton Live user can use! Now I have done non-MaxForLive things before (the Quick Arranger 01 Rack was popular and is still downloadable), so until I gather them together and do a 'recap summary' like I did ages ago for my audio effects, then they will remain in that special 'He doesn't do these very often...' bubble universe reserved for such rarities.

I've allowed myself to break my naming rules, since this is NOT a MaxForLive device, and so I proudly present:

Random Velocity Repeater (RVR) - a MIDI Effect rack for Ableton Live

The left-hand 'control panel' part of the RVR rack...

The Random Velocity Repeater Rack for Ableton Live is built from a MIDI Rack and two standard 'factory' MIDI effects, and so should work in any of the intro/standard/suite variants of Ableton Live 10 (I haven't tested it in Live 9...). It has four channels (red, yellow, green, and blue), each of which processes a single specific MIDI note number. It uses the 'Velocity' MIDI Effect to produce random MIDI Velocities for notes, and the 'Apreggiator' MIDI Effect to repeat notes. Any note events that are processed will have their MIDI velocity values changed, maybe even to zero (and thus turning the MIDI message into a Note Off equivalent) - this is because of two vitally important considerations:

1. My rule of thumb has long been: never repeat a note with the same length, velocity...
2. Random velocities sound cool on repeated notes!
3. Sometimes missing notes are good too! (As well as the third point in a list of two!)

To save you the effort of producing your own RVR Rack, it will be available to download from the Interweb. It will not be available from MaxForLive.com, much as I wish it was possible - and I'm not going to make a MaxForLive version - one of my other rules is that I don't normally make MaxForLive devices that are relatively straight-forward to produce using keyboard shortcuts or standard devices in Racks, unless there's a reasonably good excuse for doing it: simpler UI, less mouse clicks and various other justifications are all acceptable.

As always, in this blog post I'm going to try to provide some basic background information of how my software works. You can now skip to the 'Using it' and then the 'Download' sections if you don't want to grow your own version!

There is also now a YouTube video, which contains several audio examples.

Making it

If you haven't ventured into making Audio (Effects), Instrument, or MIDI Racks, then you may need to read the Ableton Manual first before proceeding, because not everything is obvious. The first thing to do is to create the 'splitter' that extracts out the four notes that will be processed using four separate channels, and a fifth 'Thru' channel that does nothing. To create the first processing channel you drag the 'Arpeggiator' MIDI Effect from the 'MIDI Effects' category in the Browser on the left hand side of Ableton's screen into the gap on the right after the bit that says 'Drag MIDI Effects Here'. (I said it was best to read the manual!) Then drag the 'Velocity' MIDI Effect to the right of it. Then go to the 'Key' view and set the upper and lower limits to a single note by dragging the left and right sides of the green bar left or right as appropriate. Then name the channel - I called it 'Note 1' because it is the first note processing channel. Then 'Duplicate' it three times, using the pop-up menu, and rename them to Note 2, Note 3, and Note 4. Finally, drag and drop the 'Pitch' MIDI Effect, and name it 'Thru' - making sure that for this fifth 'Thru' channel you set the key range to everything - drag the ends of the bar all the way to the left and right so the bar is right across the whole MIDI note number range.

The left hand 'Macro' control panel, plus the 'Drop MIDI Effects Here' middle bit, and the start of the right-hand 'Key' mapping panel...
The four duplicated copies of the Arpeggiator and Velocity channels, which are called Note 1-4, will all be mapped to the same note number, so you need to change them to four different notes (and this is a good time to think about a good colour scheme - mine is a bit rainbow-like...

What the key mapping panel should look approximately like for typical drum note numbers...
The graphics in the key mapping panel are quite small, so here's a close-up of the important bit where the four channels are mapped to four drum notes (shown as red on the keyboard):

When MIDI notes are received by the MIDI Effect rack, the keyboard highlights the appropriate keys on the keyboard graphic in red. Here, three notes (36, 37 and 42) are highlighted, and 38 is not. The 'bar for the Note 1-4 channels should only be 1 note wide, as shown here.
All you need to do is set the narrow bars so that they are underneath the note numbers which correspond to the drum sounds that you want to process. I set the four channels to MIDI note numbers in this way:

42 Closed Hi-Hat
38 Snare
37 Rim shot
36 Kick drum


The velocities of the drums in this pattern clip are not very imaginative! (But remember that they will be randomised...)

The settings of the Arpeggiator and Velocity MIDI Effects are shown here:


The Arpeggiator MIDI Effect is set so that itjust repeats the incoming note several times at a particular rate. The number of repeats and how quickly they repeat can both be set. You can see two small green dots on each of the rotary controls that indicates that I have already mapped these rotary controls to the Macro Controls in the left-hand control panel. To do this, you need to go into 'Map' mode by pressing the 'Map' button (various bits of the UI will go green-tinged at this point) and selecting the appropriate Macro rotary control and the control that you want to map to it. Full details are in the manual! You need to do this mapping process twice for each of the channels: once for the 'Repeats' control, and once for the 'Rate' control, making 8 mappings in total.

The Velocity MIDI Effect does quite a lot of processing of the incoming MIDI. The 'Random' rotary control is set to maximum (64) and the 'Out Hi' rotary control is set to its middle position (63) so that the output velocities will hit the maximum of 127 and all the input velocities will be scaled so that they contribute half their value to the output. So half of the output velocity will be the input, whilst the other half will be random. The 'Out Low' rotary control is set to 0 so that it can produce Note Off messages - you will need to click on the number below the rotary control to change it from the default value of 1. Finally, the 'Lowest' number box can be changed to 0 if you wish. This changes the probabiliity of the output notes slightly - as you can see in the screenshots, I didn't do this, but if you wish to make your own custom version... You could also customise the 'Comp' compression setting as well if you want to compress or expand the dynamic range of the MIDI velocities.

For the 'Thru' channel, you don't need to do anything, and the Thru channel will do that as well!

Using it


Here's the MIDI Effect Rack expanded out to show everything, then the Drum Instrument that makes the drum sounds. In normal use, you would probably only have the left hand 'Control Panel' section of the MIDI Effect rack visible - so just the Macro Controls would be visible:


After the Drum Instrument, you can add any Audio Effects that you want. I used a Reverb Effect. But before the Reverb I added a Limiter, because lots of repeated notes played quickly can be louder than a single instance of the note!

Here's a Limiter Effect before the Reverb
For each note number channel, you need to set a Clip Envelope and map that to the appropriate Macro Control in the left-hand control panel. If you haven't done this before, then you should read the Ableton Live manual because I'm not going to give full and complete details of every mouse-click... 

For Note 1, the Kick drum, the repeats are mapped to a clip envelope that rises from 1 to 8...

This is what the clip envelope looks like... The clip envelope starts at 1 on the left, and rises to 8 on the right hand side.
This means that at the start of the bar, the first Kick drum will be repeated once, the second kick will be repeated twice, the third 4 times and the fourth 6 times. The rate at which the repeats happen is set by the 'Synced Rate' rotary Macro control, which is set to 1/128th note. This is very fast repetition, and turns the Kick drum sounds to  sound more like a pitched note. ( - this is a form of sound synthesis called FOF, and you might be interested in looking up what it means and how it works...)

A slightly more conventional use would be to have a slower repeat rate, and this gives drum sounds where you can actually hear the individual repeats! Here's an example using a Rim Shot drum sound:

The Rim Shot drum sound used with Repeats plus variable Rate - it sounds quite a lot like a Guiro at times...
The clip envelope selection doesn't number the 'Repeat' or 'Rate' parameters, so you have to go by the position: top is Red (1), then Yellow (2), then Green (3), then Blue (4).  This clip envelope is for the Rate at which the notes are repeated.
The Rate starts out slow, speeds up in the middle of the bar, and then slows down again. Unfortunately, I didn't invert the Rate mapping, so faster speeds of repeat are at the bottom, and slower are as you move upwards. You could make your home-grown version do it correctly, of course!

Tints and Hips

Also known as Hints and Tips, but it probably got your attention!

SPARING Ok, so there are four channels to play with, and they are colour-coded in bright colours - this does not mean that you need to use all four channels every time! Sometimes just a single note in a single bar is all you need, or a single note repeated for every chorus. And yes, there are some genres of music where repeating it several times every bar is currently fashionable. But all four channels, all the time, is probably over-kill and may make your music sound ever-so-slightly cliched. 

SUBTLE Clip envelopes can wazz parameters from min to max very quickly, and then wang them back again just as fast. This does not mean that huge variations in the number of repeats, or the rate of those repeats, will sound better - sometimes less is more. Having said that, completely 'way-over-the-top' rate and repeat settings with a Rim Shot sound can occasionally sound just like a Guiro! 

CONFIDENCE Once you have tweaked the Repeats and adjusted the descent of the Rate control so that the Kick drum sounds like an 'FOF' cross between a drum and a monosynth, then you might be tempted to try and hide it deep in the mix. Based on what I hear these days from 'popular beat combos', then you may as well just have the confidence to put your carefully honed special sound effect loud, front and centre. 

CONFLICT When two or more tips contradict each other, as in SPARING, SUBTLE and CONFIDENCE, then just do whatever you want. If you have the Spinal Tap extension fitted to your DAW, then simply turn up all the controls to 11.  

REPETITION I mentioned it earlier, and it bears repeating: Fast repetitions of the same drum sound (particularly if your drum sounds are polyphonic) can be louder than a single instance of the same sound. A Limiter might be useful to keep things under control...

YouTube video!

I have struggled putting videos into blog pages successfully, so I'm going to turn all of this blog post into a YouTube video, so that you will be able to see these happening in a full audio-visual experience!

Getting the Random Velocity Repeater Rack

You can get the Random Velocity Repeater Rack here:

       https://drive.google.com/file/d/1H6U6k2FVQy_n5gekCm5prVwsp488done/view?usp=sharing

You just need to drop the .adg file onto Live's screen and it should appear in the MIDI Effects folder.

Modular Equivalents

In terms of basic modular equivalents, then the Random Velocity Repeater Rack would probably require four Random Noise Generators plus a quad MIDI Utility module to do the velocity multiplying, plus 4 LFOs to do the repeats, and a final quad MIDI Utility to create the repeated notes, giving a total of about 10 ME (without all the stored memories, of course).

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









Saturday, 30 November 2019

Free Quad Modulated Probability MaxForLive plug-in for Ableton Live

Okay, three closely related releases in a few days is unusual, even for me, but there's a strong family bond between these three siblings:

1. MIDIprobD4 is the basic 4-channel 'set the probability of 4 drum sounds.
2. MIDIoffGRID4 adds flexible control over time delays.
And now:
3. MIDIprob+D4 allows the probability to be modulated with LFOs.



MIDIprob+D4 adds four Sync/Free LFOs (Nothing clever, just the same 'borrowed from Ableton' design that I've included in most of my old 'classic' plug-ins like Comber) - Hey, this might be a good time to revisit them...) so that the probability can be modulated instead of being fixed. This adds variability to the unpredictability, and so you may need to get familiar with using the basic 'skinny' MIDIprobD4 first, and then go for the 'full-fat' version.

The LFO in Comber...
Extrapolators have probably realised at this point that there's room in this unified scheme for:

4. MIDIoffGRID+4 and I can neither confirm nor deny that this is in development.

MIDIprob+D4's four channels make using my sophisticated 'modulation widget' difficult because of limited space. I have used it in some of my 'Hex' series of effects, and it allows easy control of modulation depth and offset in a single 2D X-Y control instead of two rotary controls.

The 'Modulation Widget' in AUDhexPPD...
MIDIprob+D4 is literally 4 LFOs added to MIDIprobD4, so the things you need to know are:

1.If you set the Probability rotary control (with the triangle) to 100%, then the LFO isn't going to be able to modulate it fully - you can pull it down to 50%, but that's all. Similarly, if the Probability rotary control is set to zero% then you won't be able to LFO modulate it above 50%. For full modulation of Probability, you need to set the rotary control to 50% - where there's a triangle to remind you. And yes, the 'modulation widget' would have made this obvious, but changing the size is tricky...

2. The 'Sync' speeds are locked to Live's transport, and most of them are very fast in comparison to the 'change the probability slowly over several bars' that you are likely to expect. But try the slower speeds (1/1, etc.) and see what happens when you are locked to a single bar, and then see what happens at shorter time intervals. They may be more useful than you think!

3. Yes, the first time you use the 'Free/Sync' toggle switch, strange things happen with the enabling of the graphics. I'm working on this...

4. Left for future additions...

As always, MIDIprob+D4 is free!

Getting MIDIprob+D4

You can get MIDIprob+D4 here:

     https://maxforlive.com/library/device/5851/midiprobplusd4

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

     https://synthesizerwriter.blogspot.co.uk/2017/12/where-do-i-put-downloaded-amxd.html

(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 MIDIprob+D4 would probably require four LFOs, and four Random Noise Generators plus a quad MIDI Utility module to do the velocity multiplying, giving a total of about 9 ME (without all the stored memories, of course).

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




Friday, 29 November 2019

Off-Grid (as near as I can) extension to MaxForLive Probability MIDI Device

Sometimes a quick comment can trigger something much bigger. When I wrote about the Ableton Live Piano Roll editor for the MIDIprodD4 blog post, I mentioned that the piano roll had a not-so-well-known shortcut (the 'zero' key) for disabling notes...

This got me thinking, and there's another slightly obscure feature in the piano roll editor that got me thinking and then coding... So let's look at the shortcut first. If you have some notes on the piano roll grid, then you can move them backwards and forwards in time (clip limits permitting!) using the left and right arrow keys on the qwerty keyboard. The movement follows the quantisation setting, so if you have the quantisation set to 16th notes, then the notes can be shuttled back and forth in 16th notes.

Moving the snare to the right (time delay) by a 16th note, so that it is no longer aligned with the kick drum.
However, if you turn off the quantisation, then you can shuttle the notes back and forth (left and right) without the jumps being quantised to specific note lengths. This give you very fine control over the timing sloppiness.


But, after having moved a note (or several notes),  if you then put the quantisation back on again, when you use the arrow keys to move the notes left and right, something very interesting happens!


The notes don't do what you expect. Instead, they jump first to the quantisation places for the grid, so they are aligned as you would expect, but the second arrow key press moves the note by the amount that you set when quantisation was off! The next arrow press goes back onto the grid, and the next arrow press goes off it again, so if you had moved by a 128th note then the quantisation was off, when it is back on again, then the arrows move it by one 128th note, then a 16th minus one 128th note, then one 28th note, then a 16th minus one 128th note, etc. Once you know what it is doing, it makes perfect sense and is very useful.

Quantisation set to 16th note, Snare is on grid.

Quantisation set to 16th note, Left arrow key = Snare is off grid by one 128th note

Left arrow key = Snare is back on grid again, one 16th note later...

Left arrow key gain = Snare note is off grid again by one 128th note...

Here's another way of looking at what it is doing. Imagine you move a note by a 128th note when quantisation is off, so each arrow press moves the note by an amount of time that I'm going to call an O (for 128th) time period. Then when you put the quantisation on set to 16th notes, the arrow keys will move the note by S (a 17th note amount of time), then O, then S, then O.

I'm not sure if this is a feature or a bug, but it is very intuitive and very useful, and it got me thinking.. Maybe probability isn't the only thing that could be controlled between the clip piano roll and the Drum Rack?

MIDIoffGRID4


MIDIoffGRID4 is the result of that thinking, plus quite a lot of coding. It takes the basic idea behind MIDIprobD4, and extends it so that you get sophisticated control of the time delay of four specific drum notes (or ordinary notes, if you prefer to try it with synths and samples). The control isn't just fixed as the probabilities are in MIDIprobD4 (Ooh - now there's anther idea! Give me a few days!), instead it is dynamic, so each time a note is delayed it can be different (or the same, if you prefer), or it can be changed using an unusual kind of LFO (That I haven't seen used much either, which is another idea you may see soon - time willing!). Oh, and then at the end, you get control over the probability of the delayed notes happening. If these two devices were simulations, then MIDIprobD4 would be an unreliable drummer, whilst MIDIoffGRID4 would be an unreliable drummer with poor timing. Not that there are any drummers like this, of course!

In short, MIDIoffGRID4 lets you shuffle specific notes to the right (and then back to the left) without needing to open the piano roll and turn the quantisation off and use the arrow keys or dragging the notes sideways. And it lets you automate how much the notes are delayed. And it lets you control the probability of a note happening - which is pretty awkward to do in the piano roll (there are ways, but they can be ugly).


So, delay first. The screenshot above shows a setting of 52 128ths note 'ticks' for the time delay for Note 38 - the Snare drum. The 'Random' rotary control is set to 4 (by accident), but it isn't having any effect on the large white 'Delay Time' number on the right - that shows 52. This is because the 'Delay' rotary control goes straight into the 'Delay Time' display that affects the note timing, whilst all of the other three rotary controls (Random, Count, and Multiply) are affected by the 'Limit' rotary control (of which more in a moment), and this is set to zero. In a future update, I will try to remember to change the colours so that this is more obvious!

Anyway, the Snare has been made slightly late, so it doesn't exactly coincide with the Kick any longer, and so we get a sloppy second beat...


Here's no 'Delay', but the same value set on the 'Random' rotary control. This time the 'Limit' control is set to 52 as well, and so it will 'limit' the value of the previous three rotary controls to a maximum of 52, but it wraps round, so a value of 53 will be 1, 54 will be 2, etc. Technically, it is a modulus limiter. The 52 value for the 'Random' rotary control means that it will output values from 0 to 52, and so the value of 23 that is shown in the large white 'Delay Time' number is just a random value between 0 and 52. If the 'Delay' rotary control had been set to 10, for example, then this would be added in to the 'Random' value, and the 'Delay Time' large white number would show 33 in this case.

So now the Snare is variably late after the Kick! Sometimes it will be in time, and sometimes it will be slightly late, and sometimes it will be very late...


Here's the 'LFO'-type effect in operation. The 'Count' rotary control sets the maximum value of a counter that increments each time a drum note happens in the channel. In this case, the count will start at zero and go up to 104, then it will return to zero and count up again. The 'Multiply' rotary control affects the count as the name suggests: a setting of 1 should mean that the count goes 0, 1, 2, 3, 4, 5... etc. But a programming bug means that it actually goes up in 2s! So it counts 0, 2, 4, 6, 8, etc. A setting of 2 counts up in 4s, 3 counts in 6s, etc. I quite like that it does it wrong! But the 'Limit' is set to 52, so when the counter gets to 54, the delay time that is sow in large white numbers is 2 again. In other words, by setting the Count, Multiply and Limit rotary controls, you can control how the delay time changes, from slow increments of 2 ticks, up to complex repeating patterns caused y the modulus limiter.

In this case, the Snare gradually lags further and further behind the Kick, until eventually it resets and is in time again, but then it starts to lag behind again.

The 'Count' 'LFO-type effect is not easy as first to get your head around, but if you treat it like a synth and just noodle with the controls until you get a good sound, then you are following a process that has served generations of synth players very well for decades!

Oh, yes, and the 'Quantise' control lets you quantise the 'Delay Time' for each channel, although this isn't shown in the display... The default setting of 128th note 'ticks' is as unquantised as I could make it using the standard Max 'pipe' object - but see below for more thoughts on this.

Assigning channels to drums is up to you. You might want to not change the Kick drum timing, or there again, you might want to! For synths, then you could adjust the timing of four separate notes using a single instance of MIDIoffGRID4, whilst an Effect rack with multiple instances could give you control over many notes. Strums are one obvious application, but I'm sure you have wilder imaginations than that! Especially on Black Friday!

MIDIoffGRID4 gives you four channels of drums that can be time delayed in various ways, plus the final probability control. I'm hoping that this will result in some very interestingly time-varying and unpredictable drum tracks!

Oh, yes, and a liitle glitch during development means that some of the screenshots have this device shown as MIDIprob4, instead of MIDIoffGRID4. Sorry - I'm not a very disciplined programmer these days! 

Inside...

The Max / MaxForLive code inside MIDIoffGRID4 uses the same redundant Note On/Off 'Velocity of zero' approach as MIDIprobD4, but the way that I have delayed the MIDI notes and velocities is slightly left-field... Here's the essential bits of the code:

The left hand side has the MIDI note selection, which is done with a 'routepass' object that just routes the specific note to one output, and all other notes to another output. (Note that the split of MIDI note events into a stream of note numbers and a stream of velocities happens before this - outside of this code snippet.) The 'specific MIDI note' is set by a MIDI note number from the 'Selected MIDI Note' input - just a rotary control with a range of 0-127. I did debate as to whether I should restrict the range to something more appropriate to the conventional GM MIDI drum note number range, but decided to leave the range at its full extent so that non-drum events could be processed. I haven't explored the possibilities with synths and samples very much yet, and as with my Drum Flammer, I suspect that repeats and time delays on individual notes may be a bit unexplored, unpopular, unfashionable - which sounds like fertile territory to me...

The middle section contains two 'pipe' objects to delay the note stream and the velocity stream. The Help file and Reference for 'pipe' show the Cycling '74 thinking on how to use it - you send the packed stream of note and velocities thru the 'pipe' object. But I was thinking that it might be interesting to put different delays on the two streams, and so I split the 'pipe' into two, so there's a chance that a forthcoming MIDIoffGRIDpro might explore this in more depth.

The 'quantize' message to 'pipe' is interesting. There isn't a 'quantize off' message, and so the smallest time interval that you can set the pipe quantisation to is one 128th note. So this sets the 'tick' of MIDIoffGRID4's processing. I might try playing with a sample-rate version of 'pipe' in Gen to see if there's scope for shorter notes, but in order to work out if that is worthwhile then we need to consider the 'not-talked-about-very-often' MIDI transmission rate limit - oh dear, it looks like I'm talking about it...

MIDI Transmission Rate Limit

MIDI's serial connection is at 31.25 kbaud per second ('bits per second' in this context), and a minimalistic MIDI Note On and Off message takes 4 MIDI 'bytes' (2 for On and 2 for Off) when Running Status is active, so that's 31, 250 divided by 8 (to get it into 'bytes', and then divided by 4 to end up with messages, which gives an absolute maximum rate of 976.5625 messages per second. Now with serial communications, then limits like 'absolute maximum rate' are not something you want to be too close to...especially since a real-world MIDI data stream will probably have more than just MIDI Note On and Off messages in it ((MIDI Clock, Active Sensing, Controllers, etc.). For more typical 'in-stream' three byte MIDI Note On and Off messages then that second division is by 6, which gives  651.04166... messages per second.

To put these numbers in context, they need to be expressed relative to tempo and note lengths. I'm a 120 bpm sort of person, so 120 beats in a minute is 120 beats in 60 seconds, which is 2 beats per second, or 1 one beat every half second. For 4/4, then 4 beats per bar, so a quarter note is going to last half a second. From the previous calculations, we know that in that half second we could have just slightly over 651 MIDI note messages - which seems like quite a lot, and reflects the sort of engineering thinking that the original MIDI designers must have considered carefully. So a quarter note is one out of those 651 possible MIDI note messages, and so an 8th note would be one out of just over 325 MIDI note messages. A 16th note would be one out of just over 162 note messages, a 32nd note would be one out of just over 81 note messages, a 64th note would be one out of just over 40 note messages, and a 128th note would be one out of just over 20 note messages (and takes 1/64th of a second, which is 15 milliseconds). Now, depending on your medical source, 10 milliseconds seems to be somewhere near the middle of the measured range of the perception limit of human timing, and we are at similar amount of time with 128th note quantisation...

Gen into the pipeline?

So the calculations suggest that it might be worth looking into a Gen version of 'pipe' to see if using one 256th note quantisation (or finer) can be perceived, but only just. So I'm going to add this to the pipeline, but not with a huge urgency, and when I have a spare moment... Until then, I would be interested, as always, in any feedback from users of MIDIoffGRID4 about the timing resolution of one 128th note for the quantisation.

Getting MIDIoffGRID4

You can get MIDIoffGRID4 here (it is free!):

     https://maxforlive.com/library/device/5846/midioffgrid4

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

     https://synthesizerwriter.blogspot.co.uk/2017/12/where-do-i-put-downloaded-amxd.html

(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 MIDIoffGRID4 would probably require four delays, four LFOs, eight Random Noise Generators and four Utility modules to do the Limit modulus function, plus a quad MIDI Utility module to do the velocity multiplying, giving a total of about 24 ME (without all the stored memories, of course).

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



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:

     https://maxforlive.com/library/device/5844/midiprobd4

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

     https://synthesizerwriter.blogspot.co.uk/2017/12/where-do-i-put-downloaded-amxd.html

(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:




Thursday, 31 October 2019

Sound Synthesis Role Models 1 - Daphne Oram

All through my life, I have been inspired by many people who also had an interest in sound synthesis. Here is the first of an occasional series:

Daphne Oram (1925-2003)
Picture by Clusternote - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=61052771
One of the first British composers to create sounds electronically full-time, and a founder member of the BBC Radiophonic Workshop, where she worked from 1958-59. She did pioneering work on creating sounds by drawing with ink on 35 mm film stock, a technique known as 'Oramics'. With many people assuming that the earliest mechanical music reproduction was the music box or even the vinyl record, it is interesting to see that there are alternative techniques that have been used to produce music for a long time... 

Oramics and other opto-electronic devices like the Optigan use light to control the current that flows in an electrical circuit, and if the light varies, so does the current. If the light varies fast enough, then the current represents an sound - just like the varying current that an amplifier sends to a loudspeaker. 

When I was younger, I used to play around with opto-electronics a lot. The ORP12 was a common device (and you can still get them!) - it is a 'light dependent resistor (LDR), meaning that the resistance changes when light falls on it. The active substance is cadmium sulphide, and it comes in a small button package made of clear plastic - it looks exactly like one of those hobby or craft 'potting' projects where you put things inside clear resin.  The resistance of the ORP12 reduced as light fell onto the active 'window' at the end, and so you could use it to make all sorts of useful gadgets: from alarms that sounded when a light beam was broken, to things that could detect a square moving on a TV screen (Yes, the 'gun' accessories from video game consoles used to have an LDR at the end of a tube, and it detected the flashing light from the white square on the (probably a CRT) TV screen.) That was always one of the things about the ORP12 that surprised people - it responded quickly to light falling on it - you could modulate light at hundreds of Hertz (cycles per second). Other LDRs had even better frequency responses.




Picture by Kevan Davis - Flickr: Oramics Machine, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=17150394
In these digital times, it is interesting how electro-mechanical and opto-electronic devices have gradually vanished - and so the concept of putting something between a light and a photo-detector to vary the amount of light that falls onto the detector is probably unfamiliar to lots of people. 



By tpholland - Flickr: Oramics: waveform slides, CC BY 2.0, https://commons.wikimedia.org/w/index.php?curid=24611604

But this is how the sound was stored on movie film - alongside the picture, a wavy line looking very much like a modified audio waveform was used to generate the sound that you heard in the cinema. The idea of drawing in ink on film to make sounds flows from seeing film with an 'optical soundtrack' and understanding how it works. 


By Oramics Machine details 2.jpg: linearclassifierderived work: clusternote - This file was derived from: Oramics Machine - details 2.jpg:, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=32980388
By Iainf 09:33, 12 July 2006 (UTC) - Own work, CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=941554
Nowadays, movie sound is stored in a virtual 'container' that holds digital bits of data that represent the pictures and the sounds, and there's nothing much to look at, and certainly no easy way to draw the data bits... 

(All images via commons.wikimedia.org - Captions contain attribution information.)

Daphne Oram is the first of my role models because she made music from pictures!

Daphne Oram - Wikipediahttps://en.wikipedia.org › wiki › Daphne_Oram
Daphne Oram Collection | Goldsmiths, University of Londonhttps://www.gold.ac.uk › ems › oram Daphne Oram | British Music Collectionhttps://britishmusiccollection.org.uk › composer › daphne-oram
Daphne Oram on BBC4 - BOILER ROOMhttps://boilerroom.tv › recording › daphne-oram-bbc4
Culture - The woman who could 'draw' music - BBCwww.bbc.com › story › 20170522-daphne-oram-pioneered-electronic-music


Sunday, 27 October 2019

Different every time - changing parameters with M4L in Ableton Live

I've always worked according to the principle of 'Never the same thing twice'. Whilst most important for things like drums, I try to apply it to most sounds - although I also like flams, which kind of goes completely against the principle! Maybe 'Be inconsistent' is a better way of putting it? (Just to be consistent, I have added in the updates made to version 0.02 into this blog...)

In Ableton Live, there's an obvious way to control the parameters that are one major way of changing sounds on the fly: the 'Clip Envelopes'. The name is slightly misleading, because clip envelopes are just a way to draw parameter values onto the piano roll. Anyway, the clip envelopes are normally hidden by default, and you need to click on the 'E' inside a round button to open up the overlay in the piano roll pane. Selecting a device and a parameter from the two pop-up menus then lets you draw lines and curves either with a rather blocky pencil tool ('Steps') or with a 'lines and breakpoints' ('Ramps') tool. I prefer the 'lines and breakpoints' approach...



One of the 'classic' parameters that is controlled this way is filter cutoff (with an appropriate level of resonance) and I have spent quite a lot of time zooming out from a clip, setting the cutoff frequency for a bar, then clicking to get a new point and dragging it up and leftwards to get a new parameter level for the next bar, and so on. It requires quite a lot of clicking, but once it is complete, then editing each of the levels is quite quick to adjust. However, if you want to change the timing, for instance, to a change every other bar (or an arbitrary length), then it can require more clicks. There's also another non-obvious thing to consider that requires more clicks - you need to have the parameter set before the fist note on in the bar. This is why the orange clip envelope line is shown in the diagram as changing just before the first note in the next bar - if you don't do this then you hear the note start and then the filter cutoff change, which sounds like a mistake.

What this means is that you start off zoomed out, setting the parameter levels for each bar (or other interval), and then you need to zoom in to each of the ends of the bars where the parameter changes, the nudge the parameter change a little bit earlier in time. Then you zoom back out again. For me, there's a point where repeated mouse clicking gets a bit tedious, and I've never found any keyboard shortcuts for some parts of the clip envelope editing. So setting up several clip envelopes for a few parameters, and then changing the timing, starts to exceed my trigger level, and I stop and go looking for alternatives.

LFOs are the obvious alternative, and I've explored all sorts of variations of Slow Oscillators, including quite a lot of my own MaxForLive devices. The trouble with LFOs is intrinsic: they want to change, slowly; whilst for parameter changes I'm really looking for sudden changes followed by long steady fixed values. Lots of LFOs come with various 'Random' or 'S&H' (Sample and Hold') outputs that do give the stepped change, but then the values aren't under my direct control. Okay, so S&H on a filter cutoff can sound cool, especially a quarter note intervals (of which more later), but when you are controlling a build then you want to be able to set the parameter value for each bar. So LFOs are 'almost' the solution, but what would the ideal look like?

My ideal would have a LFO like 'Rate' control, followed by some way of controlling the parameter setting for each time period - from quarter bars up to every 8 bars or so. Which kind of sounds a bit like a weird step sequencer... but one that that enables each bar (or other interval) to have different parameters!

MIDIdifferentONE


MIDIdifferentONE is a deliberately 'different' step sequencer for parameter values that works a bit like an LFO, except that it is always synced to the sequence timing, and it is optimised for setting parameter values and then replaying them at various rates. Best of all, it always changes the parameter value just before the end of the bar, so you don't get the note followed by the parameter change!

It turns out that the requirement for something to happen 'just before' something else is one of those programming tasks that keeps cropping up again and again in electronic music, and I've struggled many times with getting it to work correctly. So this time, I was determined to spend some time solving the problem, and then some time showing how I came up with my solution. As always with these things, there's probably a much better, cleverer, shorter and neater way to do it, but I will leave that to other programmers!

LFO timing and step sequencer design is all standard 'home territory' for MaxForLive, but the requirements for the timing of the parameter change are more interesting - we need the parameter to change 'just before' the end of the bar (or some other interval). 'Just before' might be loosely defined as something like 'after the last beat, and as late before the end of the bar as we can manage without the parameter change happening in the next bar'. I decided to simplify 'as late as' to mean ' the last 16th note tick before the end of the bar, which is probably going to work with most situations - although if you put very short notes right at the very end of a bar then MIDIdifferentONE might start to change the parameter to the value for the next bar as your last note of the bar plays...


For 16th note quantisation, Live's transport outputs bars as numbers, beats as the numbers 1 to 4, and 'ticks' as the numbers 0, 120, 240 an 360. If you don't quantise the timing, then you get tick numbers like 205.74 and the processing is more complex. For MIDIdiffrentONE, making sure that the parameter changed before the end of the bar was the most important thing, so I kept things simple and applied quantisation, but only to the timing for these parameter changes! So MIDIdifferentONE will not affect the quantisation of any other timing in your music.

The definition of 'after the last beat and when the last tick happens' translates to beat=4 and tick=360, so all that is needed is a bit of Boolean logic in MaxForLive... Now the easiest way to do this kind of goes against the 'visual programming' metaphor that MaxForLive uses, and uses the 'if' object and requires some typing! Suddenly MaxForLive is going a little bit 'programmer'y! What you type in the Max object is something like 'If ($i1=4 and $i2=360) then 1 else 0', which means that when input 1 is equal to 4 (beats) and input 2 is equal to 360 (ticks) then output a '1', otherwise output a '0' (zero). Yep, that's a traditional text programming 'if statement' inside a MaxForLive object. Some of you may need to sit down at this point...

That covers how to make something happen at the end of every bar - whenever the beat=4 and tick=360. Other times like every other bar or every quarter bar just require slightly different 'if' statements and additional processing. I hid the end result inside a patcher box to keep things neat and tidy:


So you can see the 'metro' object that provides timing from the master clock source, a 'transport' object that outputs bars, beats and 'ticks' into those three number boxes, and then the 'before_mr' object that contains all of those hidden-away 'if' statements. The 'switch' object selects the desired timing, and after a special 'counter' object, you can see the top of the 'step sequencer' object.

Inside the 'before_mr' patcher? I'm not one to hide stuff away, so here goes:


If you look across the lower part of the patch, then you should find the 'every bar' output, (fourth from the left) and above that a blink object, some tidying up, and then an object with 'if $i1==4 && $12==360 then 1 else 0' inside it. This is the 'just before the end of the bar' requirement turned into an 'if statement' using MaxForLive terminology - so '&&' means 'AND', and '==' means 'is equal to'. You might like to try and work out how the other outputs are generated as well.

There's a trap with this 'just before' approach, and it happens in the very first step. As always, you should consider the 'edge effects', and this is one case where I didn't think enough about the initial step. The 'before_mr' patcher outputs a 'bang' event just before the end of the set time period: from every 8th bar to every quarter beat. So what happens in the first step? If we take the middle case of 'every bar' then the 'bang' event will not happen until just before the end of that first bar. This means that until that happens the counter is in the 'reset' case, which is a count of zero, so the step sequencer stays on whatever step it was before we started Live's transport running. Only when it gets to just before the end of the bar will a bang event occur, and the counter will increment, and step 1 will begin - almost a whole bar late! What actually need to happen is that the counter needs to be set to step 1 at the beginning of the bar, not just before the end. This can be achieved by using a 'timepoint 1 1 0' object, which produces a bang event when Live's transport starts running, and if this resets the counter, then step 1 starts correctly. This means that the first step is slightly less than a bar long in this case...

That's what is happening inside, now let's look at outside.

Using MIDIdifferentONE



The plug-in has has three sections, and from left to right, these control the setup, the step sequencer, and the value output and mapping. On the left hand side, the top shows the beat indicator and count, where the blinker can also be clicked on to reset the sequencer. Underneath that, the pop-up menu allows selection of the step sequencer rate: from every 8th bar, down to every quarter note (slow to fast, with the fast setting being the 'classic' S&H filter modulation effect). The cluster of thirteen buttons are used to fill the step sequencer, and the 'Random' button generates a different pattern each time. The 'Scramble' button jumbles the sequence of the values, and below it is an 'Undo' button that will restore the last edit you made - it isn't very sophisticated and there's only one level at the moment.

The middle section is the step sequencer. Every fourth step is highlighted in white instead of light purple, and the bar at the top can be used to set the length and looping points. The default is 16 steps from 1 to 16, but you can vary it to anything to 2 steps from 1 to 2, to 16 steps from 1 to 6, and back to 2 steps from 15 to 16. When you stop Live, then the step sequencer area can be edited 'live' using the mouse - just hover the mouse near the top of one of the step 'circles' in the middle 'step' section,  and that value will be displayed. Click and you can change the value of the step. If you move the mouse across the step sequencer area then you can 'draw' in the values very quickly. - the background of each step will go grab as the mouse selects that step...

So the workflow for setting the controlled parameter is now very simple: Stop Live playing, and then you can set the step values as you want with the mouse and they will be saved. Note: If you select one of the preset patterns, then you will lose your edits!

The right hand side shows the output value for each step, as well as a vertical bar indicator. The 'Normal'/'Invert' switch inverts the value, so high values become low and vice-verse. The 'Offset' and 'Depth' controls allow the value to be adjusted to suit the target parameter. Finally, the 'Unmap' button undoes any pre-existing mapping of the value to a parameter inside Live, and the 'Map' button allows you to mp the value to any available parameter inside Live.


Here is the 'classic' LFO S&H filter mod setting, except that it repeats, the steps can be edited, and it can be slowed down to as slow as once every 8 bars. This example is set for every other bar, and so the end effect sounds like a different setting (or different preset) every 2 bars. And switching to quarter beat cliche is just a single pop-up menu selection, whereas you would need to edit the timing of every value in a clip envelope.


Here's the output remapped to an instance of Analog inside Live, where the controlled parameter is the octave for Oscillator 1. The Offset control is set so that the centre position is no stave transposition, whilst the depth is set so that the oscillator goes up and down by one octave. LFO modulation of the octave control with an 'S&H' type of waveform would not give you any way to edit the waveform, but MIDIdifferentONE lets you set when the octave transposition happens.


Something that you may not have tried before is to change the filter type. Doing this every half beat is quite extreme, and the sound of a filter jumping from his-pass to band-pass to low-pass quickly is unusual. Remember that unlike an LFO doing Random or S&H waveforms, you can edit every step of the sequencer, so you can get exactly the results you want for each step.

ONE?

After a long run of 'hex' MaxForLive plug-ins, you might not be surprised by the 'ONE' suffix to the name of this device. I can neither confirm nor deny the future existence of any multi-channel versions of this utility...

Getting MIDIdifferentONE

You can get MIDIdifferentONE on  https://www.maxforlive.com/library/device/5805/mididifferentone-mr

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

     https://synthesizerwriter.blogspot.co.uk/2017/12/where-do-i-put-downloaded-amxd.html

(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 the blog post is behind the version number of MaxForLive.com...

Modular Equivalents

In terms of basic modular equivalents, then MIDIdifferentONE 0v01 would probably require an LFO plus a step sequencer, and a Utility module to do the scaling, giving a total of about 3 ME (without all the stored patterns, of course).

And here's a link to click on if you find my writing informative: