Showing posts with label MIDI Effect. Show all posts
Showing posts with label MIDI Effect. Show all posts

Wednesday, 13 May 2020

Minimalistic octave remapper plug-in in Max For Live for Ableton Live

Gregory Taylor's article for Cycling'74, where he talks about 'One Big Knob' effects plug-ins, made me think...You might have noticed that I'm not exactly a 'minimalistic' user interface person - some might say that I provide too many controls. So I'm trying an experiment...

Recently, I released MIDIchromatixN, a 128x128 MIDI note number remapper that has quite a few controls... Well, I have just released the exact opposite, a remapper with one big rotary control, and one small rotary control! It does something different with remapping, but the core code for doing the remapping is identical - the differences are all in the fine detail of the controls and what they do. Because I really wanted to boil it down to a single 'big knob', but failed, I have called it MIDIchromatixONE, in an attempt to distract you from the two controls.

MIDIchromatixONE


MIDIchromatixONE creates inversions of notes or chords in sequence clips - musical transformations of some of the notes, and not the 'invert' function where low notes become high and vice-versa. There are two controls (but you already knew that!); a big 'Map' rotary control that selects from the initial  20 presets, and a smaller 'Pitch' rotary control that 'tunes' the internal mapping to suit different input notes. Preset number 1 on the Map rotary control is a 'Thru' setting, where notes pass through unchanged, so it is more accurate to say there are 19 presets (at the moment) that do stuff other than nothing. The presets are arranged in 5 groups, based around modifying in groups of twelve notes, six notes, four notes, three notes or two notes. In each of the groups, the mapping starts out sparse and open, and gets more complex and thicker for higher numbered presets. So 'Preset 5 : Six Notes 1' is simple, whilst 'Preset 8 : Six Notes 4' is complex. The best thing to do is to put some notes from a clip through it, and listen to the presets.

The Pitch control shifts the internal mapping by up to +/- 24 semitones. This doesn't mean that it pitch shifts the output, it means that the way that the remapping is done can be shifted by 2 octaves up or down. I did wonder if I should call it 'Tune' instead of 'Pitch', but the word 'Tune' sounded too vague - this is one of the 'not fully nailed down yet' bits of the design, so it may still change in the future. Again, the best way to see what it does is to put some notes through it and to listen. Kind of what you might do with a plug-in with just 'One Big Knob', really.

Note really a control, the '!' button is a 'Panic' button that attempts to clear up any hanging notes, and also sends an 'All Notes Of' MIDI Controller message. I did think about restricting the Map button to changes only when the Ableton Live transport was stopped, but discovered that using an LFO to change the presets was rather cool, so I didn't put any limits on it - which means that if you change the Map button whilst a chord is held, then you may get held notes... Take care!

Inside

Inside MIDIchromatixONE, there are lots of lookup tables, kind of 'hand crafted' by myself, using assistance from a variety of tools that I wrote in Max For Live. (Which may or may not be a good thing - there's certainly quite a lot of 'tool artefact' in most of the presets... This might end up in a blog post one day - how do you avoid your tools affecting what you do?) I used source note clips from monophonic 'synth' sequences and polyphonic orchestral arrangements, and deliberately went for a range of effects, rather than just choosing the most complex ones - kind of how you would create presets for a real device...


The screenshot above shows part of the development environment for MIDIchromatixONE, where I'm using my 'Huge Noter' tool devices to show the input and output notes. Eagle-eyed viewers will also spot that I'm still in my 'Muted Impure' phase...


And above you can see just one or two of the simple tools that I use to assist me... Normally, you never get to see what happens behind the scenes... One programmer that I know told me that his tool-to-release ratio was about 100:1, so he wrote one hundred times as much code for the tools that he wrote to enable him to write the one final device that he then released.

Sometimes tools and utilities DO get released - examples from me on MaxForLive.com include the following:

- Aud Colours (inspired by Adam Neely @adamneelybass)
- Huge Noter (big display of notes, as used in this blog post!)
- DLS Helper N (Explore MIDI DLS...)
- MIDI cc tool (MIDI Continuous Controller message analysis...)
- MIDI cc  (simulation of a MIDI Continuous Controller...)
- Wavetable Creator ('512 sample' wavetables are increasingly becoming 'retro', these days...)

Regular readers may have spotted that one of these is closely related to my 'should be famous' M4L device which still has zero downloads!

Demo

There's a demo on SoundCloud here. It starts off with 16 bars of plain source material, then fades out and is followed after a pause of one second, by the same material processed by MIDIchromatixONE with a slow LFO running gradually through all of the presets - even the 'Thru'. There's also a bit of probability-based note pruning and some added random velocity from my MIDIprobNV plug-in. they sound gratifyingly different, at least to my ears. The material is not quite in 'Lamb of God' territory... and it isn't done using the Spitfire Audio BBC Symphony Orchestra Discover! Instead it uses an edited version of one of my 'mrOrchestra' Instrument Racks, and so exploits some of the articulation capabilities very nicely. (which is based on 'Quick_Arranger', which is still available...) I really should do another blog post about the 'Quick_Arranger' Instrument Racks...

In Use

MIDIchromatixONE doesn't do anything other than a few note transpositions, which sounds easy and trivial until you look at all of those lookup tables. My advice would be to start with Preset 1: Thru to create your clip, and then to audition the presets and find one that you like the sound of. There's a tiny bit of influence from the MiniMoog front panel design for waveshape selection, because the presets tend to get more complex and thicker as you go to the higher values. This doesn't mean that Preset number 20 is the best, of course! Don't forget to explore fine-tuning things with the 'Pitch' control, and remember that the effect it has depends on the source material, so don't expect huge changes!

One important thing to remember is that MIDIchromatixONE is not your standard effect plug-in. It is perfectly possible that many of the presets will have little or no effect on most of the MIDI Notes that you pass through it. Conversely, it can change notes in ways that would take quite a lot of manual editing time. Finally, the presets are my first pass through creating ways of using the underlying transposition engine - I intend to make more presets (probably less than 107 more!) for a future update when I have time, and these might use the tools less and be be done with more manual editing of the tables - I did worry that the tools were doing too much of the driving...

A final thought: the presets so far are very tame: chromatic and very constrained inversions. If you look at MIDIchromatixN, then there's lots more power lurking in the underlying engine... In the 107 available preset slots that are left (can you figure out why?) then there is space for more 'challenging' presets, but would people like something that would produce discordant outputs? For a while I have been considering releasing some of the 'broken' abandoned devices that don't, and in many instances, can't work properly, or whose output is imperfect in some way. Maybe MIDIchromatixOOPS will get released one day...

Getting MIDIchromatixONE_mr

You can get MIDIchromatixONE_mr here:

     https://maxforlive.com/library/device/6273/midichromatixone

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... and pictures may not always be the current version... but Schrodinger's cat's status is permanently uncertain...

Modular Equivalents

In terms of basic modular equivalents, then implementing MIDIchromatixONE_mr is just about as awkward as MIDIchromatixN, even though the transpositions are much simpler. The 'mapping' of the 128 MIDI notes is the problem, unfortunately, and I still haven't found a neat solution. The Make Noise 'Maths' module starts to get somewhere close, but not entirely. The Expert Sleepers 'Disting mk4' also gets close, and maybe the Quantizer can be tweaked suitably, or possibly the Waveform Animator, maybe. But I couldn't find a direct equivalent. This means, of course, that I will get a comment pointing me to a classic module that I have overlooked, or never heard of, or forgotten, or didn't know about - there are lots of modules out there. Anyway, until then, I don't have an ME for this device...

The obvious solution goes outside of a purist interpretation of 'Modular' and 'DAWless' synthesis, and takes us into 'Hybrid' territory: use a dual DC-coupled 'audio' interface to connect Ableton Live into your modular system so that you can use MIDIchromatixONE (or N).

---

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









Monday, 23 March 2020

Swapping MIDI Note Number and Velocity Value in a Max For Live plug-in for Ableton Live

When I produced the MIDI Note Filter recently, I realised that the internal processing would allow some other interesting MIDI processing functions to be carried out. One thing that I have always wanted to experiment with spans across two different topic areas: music and steganography (hiding data in other data), and it builds on my recent explorations of Note On and Off messages, as well as a recent twitter message that talked about security.

(I have also been busy producing material for Christian Henson's 'Pianobook Pianoday 2020' collaborative 'systems music' project due to be released on the 28th March 2020 as 'Music by 300 Strangers'. Search for '#pianobookpianoday2020' on YouTube to see some of the contributions... This has put me in a more experimental and explorative mode than my usual analytical one, so what follows is not my usual type of Max For Live plug-in... but this is a good thing!)



MIDIswapNVmr01 is a Max For Live plug-in that swaps the note number and the velocity value in MIDI Note On messages that pass through it, and it works with the implied Note Off messages that occur when the velocity value is zero. A button is provided that toggles between 'Swap' mode and 'Thru' mode, and the usual '!' panic button is also there to stop hanging notes (I have called it 'ANO' here because it flushes out hanging notes, but note that it does not send a MIDI 'All Notes Off' message - Ableton Live does that when you press 'Stop', which is why the dark blue ANO is shown by the monitor...). Yep, a minimal user interface!

One thing which I hadn't thought about until I created the MIDIfilterNOTEmr plug-in was what happens when you turn off a Max For Live plug-in using the 'Power' button in the top left hand corner. It turns out that if you turn a M4L plug-in off, then it is bypassed, so you can use the power button as a kind of secondary 'Thru' button. So I have included this in the screenshots!

Screenshots


The screenshot above shows the plug-in swapping note numbers and velocities. I have put two MIDI Monitor utilites before (on the left side) and after (on the right side) so that you can see what is happening. Looking at the very last note (just before the dark blue 'All Notes Off' ANO MIDI message), then you can see a Note On (shown as 'NON' in the Monitor utility) for E3 with a velocity of 65 goes through the plug-in and comes out as a Note On for F3 with a velocity of 64. You won't be surprised if I reveal that F3 is the note that corresponds to note number 65, so the incoming velocity of 65 has been converted to a note number (F3) as intended. The E3 incoming note is note number 64, and so this turns into the velocity of the outgoing note as 64.

Let's pause for a moment here whilst you get your head around this. The incoming note is E3 (65) with a velocity of 65. The outgoing note from the plug-in is F3 (64) with a velocity of 64. So the note number and the velocity value have been swapped.

A quick note about note offs. As I've mentioned several times recently, a MIDI Note On message with zero velocity is treated as if it is a Note Off message. So in MIDIswapNVmr01, a Note Number of 0 (C-2) turns into a velocity of zero, which means that whatever the value of the velocity of an incoming note, if the note number is zero (C-2), then the output will appear to be a Note Off message. As it happens, the 'hanging note' suppression mechanism that I use ignores Note Off messages that haven't ever had a preceding Note On, and so nothing comes out of the plug-in!


I wasn't sure how to capture 'nothing' happening, so for the screenshot above I played several C-2s and then an A-2, and then C-2 again. As you can see, the only output from the plug-in is an E6 with a velocity of 9, which is because the incoming note's A-2 is note number 9, and the incoming note's velocity of 100 maps to  E6 when it gets turned into a note number. The C-2 notes thus turn into pairs of 'Note Ons messages with zero velocity acting as Note Off messages', which are then stripped away by the hanging note protection, and so never even make it out of the plug-in.

So there's a caveat / warning / note for this plug-in:

If you input a C-2 into this plug-in, it will never get out!


The screenshot above shows the inputs and outputs in the 'Thru' mode - so the MIDI messages pass through with no changes.


And the 'Power Off' mode, where the power button in the top left hand corner is clicked to turn off the plug-in. This gives the same result as the 'Thru': the MIDI messages are not affected.

As an interesting extra, here's what happened when I tried the MIDI Monitor from the Max for Cats 'Gratis Hits' bundle pack of free Max For Live devices:


As you can see, the MIDIswapNVmr01 plug-in is disabled (powered off) and so the MIDI messages are unchanged, but the Monitor utility on the right has added an octave to each note number: C3 becomes C4, C4 becomes C5, and C5 becomes C6. I'm very used to seeing different octave numbers in MIDI software because there are various interpretations of the standard, and I tend to use whatever the software uses, which in the case of Ableton Live and Max is C3=60, so this has probably been fixed in an update, and I just don't have that update! One area that I steer well away from are any discussions about Middle C and MIDI.

Because this post has talked a lot about MIDI Note Numbers, then this seems like a good place to share two charts that I use a lot when I'm playing/programming. The first is a classic that you have probably seen in various forms before:


So the table above has notes along the top, and caves up and down, and lets you find the note number of any of the 128 MIDI notes. You can also use it in reverse - look up a number in the grid, and then read the note and octave from the two axes.

The second is more unusual...


This is a kind of 'inverted' version of the first table. It has decades (10s (tens)) on the vertical axis, and units (1s (ones)) on the horizontal axis. So to look up 65 (note F3 from earlier) you go down to the row that starts with 60, and then go across that row until you are in the column with 5 at the top. For 65 you get F 3 in the two boxes (note/octave). What is interesting about this are the patterns that you get when you take the usual '2 and 3' pattern of accidentals that you see on a normal music keyboard and wrap it around decimal numbers. The columns have either 3 and 3, or 2 and 4 patterns of notes, and the diagonals have more patterns: 3 and 4 and 2 and 3. if you are into patterns, then the last row of blocks of 2 always repeat the octave in the cell underneath, whilst blocks of 4 repeat the octave value of the cell above the first row. Block of 3 do different things depending on if they contain accidentals or not! If you are familiar with chess, then 'Knight's moves' on this table give you the cycle of fifths...

If you have ever seen one of my Tweets about cryptography, then my fascination with patterns now probably makes more sense. Music and cryptography both contain a lot of maths underneath, and so patterns are not unexpected!

Controllers and control

Swapping the note number for the velocity value renders makes it very difficult to play keyboards and MIDI controllers because the velocity value is often difficult to control with the same amount of precision as you would find on a keyboard where each key produces a specific note number. Velocity is determined by the rate at which the key is pressed down, and so is based on a time measurement. By swapping these two values, keyboards and MIDI controllers gain precise control over velocity (what used to be pitch control is now velocity control!), but lose the precision of pitch control.

Steganography


Steganography is all about hiding information in places where it is not visible. One example is in JPEG picture files, where it is possible to hide data inside them by spreading it across the whole picture in ways that are not obvious. So there might be slight and gradual changes to brightness, colours, levels of noise or other parameters, that are not visible o the human eye, but that can be detected.

In this case, MIDIswapNVmr01 increases the precision with which changes can be made to the velocity value, but the pitch becomes less precise - in fact, trying to control pitch by how quickly you press a key spreads out pitch control into a very imprecise form! In graphical form, this might be represented by the amount of blurring (as a metaphor for the spreading out of data):

So a conventional music keyboard has precise control over pitch, so the word 'Pitch' is in focus, whilst the velocity control is less precise, and so the word 'Velocity' is blurred.


What MIDIswapNVmr01 does is swap the blurring - so now the word 'Pitch' is blurred, whilst 'the word 'Velocity' is in focus.


At Synthfest UK 2019, I spoke to Paul Ward about some of the FM sounds that I had programmed anonymously for the UK DX Owners' Club (many of which are widely available in various Public Domain collections - one set of my sounds have distinctive titles like : '-=[V]=- 1', for example), where there was a high amount of velocity sensitivity built into many of them. Controlling them can be tricky for fast runs of notes, and so Paul said that he preferred to use controllers like Mod Wheels to give more precise control.


What MIDIswapNVmr01 provides is precise velocity control from a keyboard, but sacrifices pitch control. With a fixed velocity from a keyboard, then MIDIswapNVmr01 only outputs one pitch, but you have precise control over velocity - and in fact, even a 88-note keyboard is going to give you access to only part of the full 1-127 velocity range (in exactly the same ways as it only normally lets you play 88 of the 0-127 range of MIDI note numbers!).

Which is why I said right at the start that this was for experimental purposes. I'm not expecting a sudden change in workflow so that people enter pitches very precisely (as usual!) and then use MIDIswapNVmr01 to enable them to add precise velocity as well. But my thinking is that given recent developments with MPE, and with sophisticated controllers like the Roli Seaboard, Haken Continuum and Expressive E Osmose or Expressive E Touche (others are available!)  then it might make people think more about additional control other than the pitch, timing and a very imprecise velocity value that you get from a traditional music keyboard.

Real-world instruments often have a lot of ways that the timbre can be influenced in real-time, and their players know how to exploit this - so I reckon that electronic musical instruments should be controllable in multiple dimensions as well. One very interesting illustration of this is in sample libraries of sounds produced using FM synthesis - what you get are very nicely sampled 'snapshots' of specific timbres, but you lose a lot of the subtle velocity control that programmers like myself put into sounds, and so the timbral variation is missing. I always remember when the first mass-market sampled pianos came out in the 1980s (Technics et al) that they were described by many players as sounding like:

'A very good recording of a piano, but not a piano.' 

Inside

As I mentioned, this plug-in is based on the MIDI processing core of the MIDIfilterNOTEmr utility, so let's see how it works:


As usual, I have tidied my normally untidy code in the screenshot above. The right hand side is very similar to the MIDIfilterNOTEmr code, with the 'select' object switching between two values depending on the incoming value. But here the 'swap' object at the top is used to change the note number and velocity over (as well as changing their 'right=-to-left' processing order), and so the velocity value does the same switching depending on 'Note On' or 'Note Off', but now switches the note number value because that is what will end up in the middle 'velocity' input of the 'note out' object.

On the left hand side, the 'select' object is again doing switching, but this time it is actually making sure that the velocity value is stored. The velocity value that comes out of the 'swap' object contains two values, the velocity value from the incoming notes, or zeroes from the Note Off messages. So the left hand side is all about capturing the non-zero velocity value, and making sure that it is stored when the zero velocity is output by the 'swap' object. So the two grey message boxes are just two stores in series, and the trigger for the storing is produced by the 'select' object when it detects a Note On or Note Off message. Finally, that captured and stored velocity value is fed into the left hand 'Note number' input of the 'note out' object. 

This approach could be extended to longer serial chains, and might open up additional possibilities for doing more complex MIDI processing. Because some previous posts have talked about Max's sample-level lower-level programming, then the message box approach used here could be thought of as being kind of half-way between ordinary Max and Gen: MIDI-event-level, perhaps? 

Fun!

One unintentional side effect of MIDIswapNVmr01 is that it makes playing a music keyboard in the conventional way almost impossible... So if you are every visited by a highly skilled concert pianist, and they want to play one of your keyboards, then using MIDIswapNVmr (to swap the MIDI note number and the velocity value of their playing) will considerably impede them...

Alternatively, sometimes, changing a familiar constraint (like pitch control from a keyboard and changing it to being controlled by velocity) can break you out of creative road-blocks... Inverted keyboards are another way to do this, and I have produced a Max For Live plug-in that does 'proper' inverted MIDI keyboard mappings and lots more!), but just using a Scale utility over an octave can achieve a similar 'writer's block' mitigation.

Actually, combining the ideas in the previous paragraph - adding a Scale utility after MIDIswapNVmr01 so that the MIDI notes are constrained to a specific scale - is a very practical and useful way of using many of my weirder plug-ins (like my MIDI note range expander/compressor and offset utility). What the Scale utility is doing is constraining the variability from the velocity measurement, which takes us to the several variations of 'constrained randomness' in another of my plug-ins.

I'm wondering if I can find time to do a 'how to use my plug-ins in combination' tutorial...

Getting MIDIswapNVmr01

You can get MIDIswapNVmr01 here:

     https://maxforlive.com/library/device/6081/midiswapnvmr

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 implementing MIDIswapNVmr01 depends on your MIDI/keyboard interface. If that produces CV outputs for Note Number (Pitch) and Velocity, then a couple of patch cables crossed over and connected to the output (with a gate cable as well) will do this directly, giving an ME of 1! This is the lowest modular equivalent so far, if my memory serves me correctly...

Links from this post:


Roll Seaboard (Company web-site)

Haken Continuum (Company web-site)

Expressive E Osmose (Company web-site)

Expressive E Touche (Company web-site)

MIDIfilterNOTE (MaxForLive.com)

MIDIfilterNOTE (Blog post)

Christian Henson (YouTube channel)

#pianobookpianoday2020 (YouTube search)

---

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











Friday, 28 February 2020

Low-latency MIDI Note Filter (& Monitor) in Max For Live for Ableton Live...

I can't remember where I saw the question.

But, anyway, here's the answer. A Max For Live plug-in that does MIDI Note filtering (maybe sieving is a better word), polyphonically, with quite low-latency (in the MIDI path, there's a single look-up table, no multiplies, and definitely no modulus or division operations.) and it even monitors the incoming MIDI notes so you can see what notes you might then want to filter. It might be possible to speed things up more using Gen, but that's for another day or two...


(What usually happens with these things is that despite me diligently searching around, I won't have found any examples of this type of utility... But the moment that I publish one, I then discover that there are zillions of them already out there, normally with one standard 'classic' that 'Everyone' uses. So I will apologise in advance, now, up front, for releasing Yet Another MIDI Note Filtering Utility. (YAMNFU) I think of this as a 'discoverabilty' paradox, and I nearly got a patent based on something related, but that's another story, and this isn't that type of blog...)

MIDIfilterNOTEmr


The screenshot above shows MIDIfilterNOTEmr actively filtering C3 and D#3 out of a MIDI stream. Here's a conceptual diagram of what it does:


Imagine all the notes being sorted and separated into separate flows, and then going through tubes: one tube per note. Unfortunately, the C2 and D#2 tubes are sealed up with rubber bungs, and so no C2 or D#2 notes will get through. MIDIfilterNOTEmr is like a 'sieve', really.

So those two highlighted light purple notes mean: 'remove these note from the MIDI stream.'


Here's a diagram that shows the filtering or sieving process happening with piano rolls:


And in detail for MIDIphiles... (One thing does intrigue me about the timestamps in the screenshot below - the time delay through MIDIfilterNOTEmr seem to be negative. I would love to know what is happening!):


Finally, a screenshot of what you would see in Ableton Live during debugging or testing:


The MIDI flow is from left to right, so the first MIDI Monitor shows the six notes that are coming from the clip. These then pass into INSTfilterNOTEmr, where the D, D# and E are highlighted, and finally, the MIDI flows into the right hand MIDI Monitor plug-in, which  shows that the highlighted notes have been removed.

(I changed the highlighted notes because the MIDI Monitor plug-in starts at C, and I wanted a gap in the block of notes!)

Walkthrough



Probably the first thing to do with INSTfilterNOTEmr is put it in Monitor mode, so that you can see the notes which are passing through it (When it isn't Monitoring, it is Filtering or Thru'ing). Notes that are detected are highlighted in what I will call light purple - the phrase 'light blue with a hint of purple' is too long.

Based on those notes, you then select the ones that you want to pass through, and you press the 'Run' button. So whilst it technically is a 'filter', a better description might be to call it a 'sieve' - because you can set individual notes to be removed. The notes you have selected (one note is fine, too!) will be shown as light purple in colour, and they will then be removed from (filtered out of) the MIDI stream that is passing through the plug-in - actually, if you look at the MIDI stream, then you will find lots of MIDI Note Off messages, which is something that I previously exploited in the MIDIprob devices. Basically, if you set the velocity in a MIDI Note On message to zero, it becomes a Note Off message. To stop the filtering, then you press the 'Clear' button, and all notes will then pass Thru the plug-in, unimpeded.


If you want to add or remove notes, then click on them in the keyboard graphics so that they are no longer light purple, and then click on the 'Run' button again to update the filter.

If you want to turn off the filtering then you can just use the 'Power' button in the top left hand corner. If you click on the 'Clear' button then that does indeed put the device into 'Thru' mode, but it also clears the notes! I did wonder about adding another button called 'Thru/Filter' that doesn't clear the highlighted notes, but the 'Power' button does this already!

(Because I'm using Max For Live and Ableton Live here, then I'm using the 'C3=60' MIDI Note numbering convention. I know there are other conventions, and the whole 'MIDI and Middle C' topic is one that I steer well away from.)


In Monitor mode, incoming notes are shown as light purple.

In Run / Filtering... mode, notes that will be filtered out are shown as light purple.

In Clear / Thru... mode, all notes should be white or black as usual.

The '!' button is a  panic button that should stop any stuck MIDI notes. My usual 'borax-object-based 'held notes' prevention stuff is built-in, so hopefully you should never need to press this button.

The block of squares are 18 preset memories. Shift-click to store a filter. Click to recall a filter. Shift + (option/alt) to delete. MIDI Program Change messages (0-17) can be used to recall presets (1-18).

The presets are stored with the plug-in when you save a Set in Ableton Live.

MIDIfilterNOTEmr01 does something that I'm not very keen on with its user interface. Instead of being modeless, there are several different 'states' that it can be in. Now I know this is bad design, but in this case the alternative would be real coding, and Max For Live is quite tricky enough for me.

Using it.


Please. Try it on the output of arpeggiators, on the output of drum clips (to save muting with those little buttons), or on the output of clips that have too many notes! You can thin out pads or melodies, or even create motifs from blocks of notes that are too dense and unstructured to be usable conventionally. You can bring order to chaos by restricting the output to just a few notes, even though the input is lots of notes (so perhaps in installations and performance...).

You could even use it as a huge version of the factory Scale plug-in that isn't restricted to a single repeated octave - with MFNMR the entire MIDI Note range is available to you. (Ah, and that's an important consideration - one way of doing a similar type of filtering/sieving is just to transpose the notes that you don't want to note number zero, or note number 127, and to rely on most synths not being able to make a noise that low or that high. MFNMR allows you to create music for whales and for bats, and anything in between, with no restrictions.)

So, nothing much in the way of applications then... I'm kind of intrigued that there isn't something like this in the Ableton factory set of MIDI plug-ins - and I know that you can do this by using a MIDI Effect Rack and having 128 Velocity plug-ins in it, and 128 rows (one per note), and a lot of time and effort, and you get a 'less than perfect' user interface for your time and trouble. But you can do it - I just prefer something a little neater. (but don't look inside: I'm not noted for my tidy M4L coding...

Inside

Oh, and here we are inside.

The Max For Live code to do this 'sieve' or 'filtering' process is quite simple:


1. Clicking on the keyboard graphic object highlights the notes in light purple, and these are sent to a 'list'. The 'list' is the contents of the grey box full of 127 '1's: one per MIDI note number. Highlighted notes would replace the 1 with a zero in the list. In the case shown, there are no highlighted notes, so there are no zeroes in the list - but imagine that there are one or two!

2. MIDI arrive at the input of the device.

3. Only MIDI note and program change messages are needed for processing in this device, so the 'midiselect' object extracts those from the MIDI stream and sends the remaining MIDI messages to the 'idiot' object, which acts as a MIDI 'Thru' to the next device in the chain in Ableton Live.

4. The MIDI Note messages are decoded into 'note number' (the left hand output) and 'velocity' values (the right hand output).

5. This section processes the MIDI velocity value. The 'zl lookup' object takes the 'list' and treats it as a look-up table: it 'looks up' each MIDI note number and sees what value is stored in the list at that position, and then outputs that number. So if MIDI note number 0 had been highlighted, then the first number in the list would be a zero. The output of the 'zl lookup' object goes to the 'select 0' object, which does one of two things: if the input is a zero, then the left hand output activates, and that little grey box will output its contents: a zero. if the input is a 1, then the right hand output will be activated, and this time the little grey box will output the value of the velocity from the 'unpack' object. So when there is a zero in the list, the velocity is going to be zero, but when there is a 1 in th list, the velocity is going to be left unchanged. So when there is a zero in the list, whatever the velocity value was is replaced with a zero, and a zero velocity value means a Note Off, so the Note On is changed to a Note Off, and the note has effectively been removed, filtered, sieved...

(Those little grey boxes are very useful. Notice how one of them is just a store for the value zero (which never changes), whilst the other is a store for the velocity (which changes all the time). So the same little grey box does two different things!)

6. The MIDI note number and the processed velocity value are turned into a MIDI Note message and sent to the MIDI output, thus going to the next device in the chain in Ableton Live.

Getting MIDIfilterNOTEmr

You can get MIDIfilterNOTEmr here:

  https://maxforlive.com/library/device/6023/midifilternotemr

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 MIDIfilterNOTEmr is tricky. I'm not aware of a MIDI processor utility module or CV processor module that does this type of filtering for more than one note at once, and so we enter the awkward territory of needing 128 pretty-sophisticated utility modules, plus loads of parameter storage, and an ME of over 150-ish. Using programmable utility modules then you might be able to customise something, but that tends to be at the 'specialised skills' end of the modular user spectrum. Of course, someone is now bound to let me know about a new bit of 'under the counter' custom firmware for the OxyProceyBlue75 module that makes this sort of thing a complete doddle...


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:




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:




Sunday, 10 February 2019

Scales and inverted keyboards

Some time ago, I looked at the 'factory' Ableton Live MaxForLive device called 'Scale', and in particular the 'Inverted and Useless' preset, which is both a good and a bad description. Behind the scenes, I was working on my own 'scale' device, and this has recently been updated to the point at which it is probably releasable. Yes, I know that I often seem to release things too early, but sometimes things that I don't release go through slow and tortuous development behind the scenes (Waverne 2 is one example), and there are also devices where the beta testing takes longer than expected. Anyway, NoteScalery is now at the point where I think it is ready for people to play with, and it will be followed by a number of other related devices that depend on having some way of controlling the mode/scale of the notes that they produce. All of the data spreadsheets that I produced in order to create NoteScalery will be made freely available for download.

Scales

So what's a scale (in the genre of conventional 'Western' music that MIDI 1.n kind of assumes)? For MIDI notes then it can be thought of as a mapping between all of the possible notes (128 of them, numbered from 0-127) and a smaller set of notes that follow a (normally) musical rule. So example rules might be along these lines: 'All of the white notes', or 'The notes in the key of C Major', or All notes except sharps or flats'...

Now because of the way that notes have an interesting property related to multiples of pitch, then, if you go up in semitones from a given note, after 12 semitones, you end up at the same note, but one octave higher, and this note has double the pitch or frequency of the note where you started. Octaves are very special intervals because of this doubling (or halving if you go down in pitch), and when you combine this with the equal intervals between the semitones (in equal temperament), then this hugely influences the way that people think about the way that notes work together. 12 notes in a familiar black and white pattern, and it repeats every octave, so everything must repeat every octave, yes?

Unfortunately, it isn't quite as simple as this. You can see this when a piano tuner 'tunes' a piano. Actually, whilst they do 'tune' the piano, they also have to make compromises because those 12 neat semitone notes are only an approximation that sounds reasonable in most key signatures - and the piano tuner is adjusting the notes so that various intervals sound okay 'overall'...

You can also see a problem when you have minor scales that are different when they are ascending or descending, and when you start to invert the notes in a scale then things can go very weird. So the idea that a scale applies to an octave of notes is a nice tidy approximation that works in a lot of cases, but it isn't perfect for all cases.

In musical terminology, the correct word for the mapping of notes is a 'mode', but scale is often used synonymously...

Implementation

So how are MIDI Scale devices typically implemented? Well, they use octaves - they show which notes are in the scale for an octave, and just apply this across the whole the note range. Simple.

And sometimes things really are that simple. If you look inside the MaxForLive PitchScaler device that comes with the M4L examples in Live 9, then you get code that fundamentally exploits octaves:


On the left is the raw Max code. In the middle I have marked up the main sections, and on the right is the block diagram of what is happening. So after the decoding of the incoming MIDI messages, then there is the split into two sets of numbers: Note numbers, and Octave numbers. Note numbers go from 0-11 and indicate which note in the octave has been received. To extract this from the raw MIDI Note Number you just do a modulo 12, which is what the '%12' object does - it just repeatedly subtracts 12 until the result is less than twelve. You probably know this as a 'remainder' - the number that is left when you do a division. The Octave number is interesting, because when you 'repeatedly subtract' in the modulo function to get the remainder, then the number of times that you repeat is the Octave number. So if the MIDI Note number that was received was 25 then subtracting 12 gives 13, and subtracting 12 from that gives 1, so we know that the Note number is 1 (if C=0, then 1 will be C#), and the Octave number is 2, because we had to subtract 12 twice to get a remainder which was less than 12. So the MIDI Note was a C# in the third octave.

Now that there is only one octave's worth of Note numbers, then mapping which input numbers produce which output numbers requires just a 12x12 table. Nothing needs to happen to the Octave numbers - they just pass through to the output. The output stage is shown as an addition with a '+' symbol, but actually there's two extra refinements in the code. First notice that the output of the map table has another modulo function, so if there is any unexpected value in the table, then the only Note numbers we can get out will be less than 12. Second, the Octave number is multiplied by 12, so that we undo all of the repeated subtractions. When we add together the mapped Note number and the multiplied Octave number, then we get the MIDI Note number for the mapped note on the scale - as defined in the map table.

So that's how Ableton's own example does it, and you might be forgiven for thinking that we are at the end. We have a working Scale device!


If you look at the standard 'Scale' device that is included with Live, then you can see the mapping table because Ableton made it part of the user interface (it is all those light grey, dark grey and orange squares!), and it is12x12 squares. So it seems likely that this is coded similarly to the PitchScaler MaxForLive example - and the 'Fold' function limits the output to just one octave, which is exactly what happens if the Octave number is not allowed to the output...

Unfortunately, this 'Split' approach is not perfect. As I have mentioned before, the behaviour of this type of scale mapping device breaks down if you want to invert MIDI notes, so that the high notes play low notes, and vice-versa. It is well worth going back and seeing how things can go very weird... But the main problem is those two 'modulo' functions that are cairned out on the MIDI Note numbers. You remember that these are just repeatedly subtracting 12 until they get a remainder of less than 12? Well, this requires a loop that repeatedly subtracts 12, and inside that loop is a check to see if the remainder is less than 12. For a typical MIDI Note number of say 60, then this is going to require quite a lot of operations to be carried out, and it turns out that whilst a '+' operation can be very quick, the 'modulo' function can be a lot slower. If we think what is happening here, then we have two slow operations being carried out on each and every MIDI Note message, and this is going to delay the start of the note being played by the instrument (synth, sampler...) in that channel inside the Live DAW. Unwanted delay is not good.

To remove the delay, then one method is to remove the modulo functions. This can be achieved by using a larger table - and to cover all of the MIDI Note range then we would need a table of 128x128.


Here's a conceptual diagram that shows the 12x12 tables from the Scale device, mosaic'ed together to produce a 128x128 table, so that we can map any incoming MIDI Note number to any outgoing MIDI Note number, and the only operation that is required is to look up the MIDI Note number and see what the output should be - easy to do, and fast!


Actually, most of the time, the inputs and outputs are going to be quite similar, and so if we look at a 'Chromatic' scale, where each input note maps to the same output note, then actually, most of those 'Scale' tables will not have any orange squares in them at all - the only orange squares are gong to be on the lower left to upper right diagonal. So the 'copy and paste'd Scale tables in the diagram are not a fair reflection of reality.


For an 'Inverse and Useful' mapping, then the diagonal just goes the other way. Unlike the 'Scale' device, this mapping works perfectly - it produces low MIDI note outputs for high MIDI input notes, and vice-verse, and with low delay time. In this screenshot the 'Scale' tables are not shown, and you can see that most of the table is empty. In this case, there will be just 128 orange squares along that diagonal: one for each input note (mapping it to the inverted output).

MIDINoteScalery

And that's what is inside my MIDINoteScalery device - a 128x128 table (mostly empty), plus a few utilities and an interesting way of visualising the scale and the way it maps the input notes to the output notes.


The 'zl lookup' object replaces the 'mapping' object in the previous example, and the inversion, transposing and folding are handled slightly differently, but the 128x128 table does all of the scale mapping with a single look-up operation - there are no modulo arithmetic or integer divisions required any longer... Well, as long as you don't use the 'Fold' feature, but I'm working on removing them from that as well - watch for a future release...)


Ableton's Scale device has the incoming MIDI notes going vertically, and the outputs horizontally. This isn't how MaxForLive normally shows keyboards, and so the table needs to be rotated along the diagonal - the input notes now match to the horizontal axis of the table. The orange squares have been replaced with a 'staircase' diagram that makes it easy to see if the interval between output notes is one semitone, two semitones, three, etc. For the 'C Major' scale shown here, the C# isn't present in the output, and so the interval between the C and the D is 2 semitones, so the 'tread' of the staircase is 2 semitones wide. The next interval is from D to E, which is 2 semitones again, and so the tread is 2 semitones wide. The next interval is from the E to the F, which is only 1 semitone, so the tread is only 1 semitone wide, and you can see this in the 'staircase' diagram.

So how do you make a mapping table? In this post I'm going to show you how to create the table, and all of the spreadsheets that I show will be available to download for free, so you can make your own custom tables, and your own scale/mode mapping devices if you want to.

Types of scale


There are lots of scales, and so I chose two sets: scales starting with capital letters are basic scales, whilst scales starting with lower case letters are more unusual. The scales are deliberately organised in this order, with 'invert' as the final scale.


The basic scales (or more correctly, modes) are shown above with a base key (or Tonic) of C. The 'Chromatic' mode is a 1:1 mapping - the output is the same as the input! The Ionian mode shown here only outputs the white notes; C, D, E, F, G, A, and B.


To be able to create the mapping table, then the notes need to be in a form where MaxForLive can work with them.  Here is the same table, converted to numbers instead of note names. When I did the conversion, I didn't subtract 1 from the numbers, and so you need to do this to get them into the form that is used to represent the notes in the octave: so C is 0, C# is 1, D is 2, etc.


In this table, then the numbers from the previous table have been converted again - this time into a form where the output note number is shown, and so there are always 12 outputs for the 12 note inputs in an octave. So, reading across the 'Chromatic' mode, the outputs are '0 1 2 3 4 5 6 7 8 9 10 and 11'. Reading across the 'Ionian (C Major) mode, the outputs are '0 0 2 2 4 5 5 7 7 9 9 and 11' - which means that and C# inputs will only produce a C output (the '0'), D and D# will only produce a D output (the '2'), and so on. Note that some of the modes only have a small number of output notes - the minor 7th has only 0, 3, 7 and 10, for instance.

Now this table is almost useful! If you use the 'Ionian C Major' mode, then the numbers indicate what the output should be for each input. So the numbers are '0 0 2 2 4 5 5 7 7 9 9 and 11', and this means that if the input is a C or C# (note numbers 0 and 1), then the output will be 0 (C). For the next two note inputs, D and D# (2 and 3) then the output is 2 (D), and so on. These numbers are a simple lookup table where you move horizontally for the input note number, and the number in the mapping table is the output note number.


To read this type of table into a MaxForLive 'coll' object, so that the numbers can be fed into a mapping 'zl lookup' object, then additional formatting is required. This is just a case of concatenating columns in the spreadsheet, as shown above.

The tables so far have only shown a single octave. Using a spreadsheet, it is easy to extend the table to higher numbers - all the way to 128 for all of the possible MIDI Note numbers that can be input and output. All you do is add 12 to each of the values in the first octave to get the values for this second octaves, then ad 12 to those for the third octave, and so on. This gives rows with 128 values: one for each MIDI input note number, and each number in the mapping table is the MIDI note number that will be output:


This table has entries from outputs of 0-127 for each of the 128 MIDI Note input numbers. The full table is in the downloadable spreadsheet, and contains complete tables for all of the basic and unusual modes. Note that there isn't any magic or deep maths in the mapping table - it literally is just horizontal rows of numbers that specify what the output number is for a given input number.

Utilities

The default setting for the MIDI NoteScalery device is a straight-forward mapping of input notes to output notes. The output notes are shown as colour (blue or orange - selectable), and when an accidental (black) note is output then that is shown in colour.



The '+' button (blue) allows the output notes to be transposed. If the transposition goes outside of the MIDI note range then the notes will be folded back into range.


The 'Fold' button (orange) allows the output notes to be restricted to a range of 1, 2, 3... octaves, with an offset. So if you want the output notes to be only in the range of 1 octave, then set the range to 1 and the offset to 0. As I mentioned earlier, the 'Fold' function still uses the modulo function internally, but this should be removed in a future version...


The 'Inv' button (yellow) allows the keyboard to be inverted - perfectly. High input MIDI notes will produce low MIDI note outputs, and vice-versa. This can be done for any of the modes, and it is recommended that the 'Chromatic' mode is used initially. inversion can be set to happen around any note - in the examples shown, a C input will be output as an F.


Summary


MIDI NoteScalery is one of a family of utilities intended for exploring scales and modes. All of the devices will be available from MaxForLive.com for free (and in fact, some of them are already available!).


The two devices that are included by Ableton in Live are 'Scale' and 'PitchScaler'.

Getting MIDINoteScalery

You can download MIDNoteScalery for free from MaxForLive.com.

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

Getting the 'Scales and Modes' spreadsheet...

You can download the 'Scales and Modes' spreadsheet from here. It is stored in various formats to try and maximise availability. Whilst it starts out with just music theory turned into notes, the numbers rapidly become somewhat MAX-oriented, so this isn't a general-purpose 'scale development tool', although the mapping should be reasonably easy to apply to other environments. Note that there are three tabs - people often seem to overlook tabs on spreadsheets...

'Basic' - the first tab contains just the basic scales in a 'coll'-friendly format. Just a 'cover'-screen, really.

'One Octave' - the second tab has all of the data for a single octave for the basic and extended/extra scales, and contains just about all of the notes and numbers that should be useful for making your own scales and mapping tables. The data goes quite a long way across the the right... You can use this tab for developing and testing your own scales (and getting used to the 'CONCATENATE' function that is used all over this spreadsheet, and which is indispensable for assembling data into arcane formats...) and reformatting to suit your own development environment.

'Full Range' - the third tab is the 'One Octave' extended to cover all 128 MIDI Notes. This time the spreadsheet goes a very long way over to the right, and it then continues downwards. The final 'big table' actually starts at row 58, so don't miss it. This tab is where you will produce your final 'big table'...

If you are interested in how to use the Excel 'CONCATENATE' function, then you may find this spreadsheet useful - it is used everywhere to assemble numbers into the format that objects like 'coll' expect.

If/when I get around to recoding the 'fold' code so that it doesn't use the modulo function, then the table development spreadsheets will be made available for free as well.

Modular Equivalents

In terms of modular equivalents, then it depends if you count a 'Scale' module as a 'basic' module, and  once again you rapidly get to the point where you want to step outside of the 'basic modules only' rule and go into more specialist modules. I'm going to add a 'Scale' module to the 'basic' set, and so my estimate is that full functionality is going to require a scale module plus some additional CV processing (for invert and fold) and so this gives a grand total of 3 ME.