Tuesday 24 November 2020

DJ Tech Tools MIDI Fighter Twister - Showing Bank Titles and Labels via Max For Live in Ableton Live

In the run-up to Black Friday, lots of companies now do previews of prices, and so I recently visited my usual 'go to' source of coloured cables and knobs: DJ Tech Tools, to see what they had. I ended up buying some neon orange 'Chroma Caps' replacement knob caps, plus a MIDI Fighter Twister to join my MIDI Fighter 3D that I bought at a previous preview. (Dangerous things, previews!).

Now if I didn't already have a 'button masher' MIDI Fighter 3D (and wanted to have a 'matching pair'!), then my fallback solution for 'lots of rotary MIDI controllers in a box' would have been the Faderfox EC4. The EC4 is more expensive, but has little OLED displays for each control, so that you can label them. Which set me thinking...

After a bit of programming, I produced a new Max For Live plug-in, with the snappy title of 'MIDImftLABELSfloat' that provides a floating window in Ableton Live which gives you named banks and named labels for each rotary control, plus a way to set the colour of the little colour-bars in the window. (- and ONLY the window. I didn't manage to decode the colour mapping that the MIDI Fighter Twister uses, and so sending the commands to set the colours in the MIDI Fighter Twister will have to be a future enhancement, if I ever find the time...). 

To set the colours LOCALLY in the plug-in, you use the little grey number next to the coloured rounded box under each almost-square box (with the user-editable text inside!). Select it and use the cursor keys to change the colour, or drag it up and down with the mouse (as you can do with all Ableton values...). What I do is set them to more or less the same colours as on the Twister itself, and this also serves as a useful indicator of which rotary controls are active. The mapping of colours to numbers is not obvious, and although I'm sure there is a simple algorithm that drives it, I haven't been able to find out what it is, so this version gives you the default mapping... Sorry.

As a not-very-well-hidden additional control, the little grey number on the left hand side, nestled at the end of, and in-between the second and third rows of boxes, is a 'global colour' control. Select it and use the cursor keys, or drag it up and down with the mouse, and all of the 16 colour boxes will change. Now, if I was Pioneer DJ (okay, now kind of Toraiz as well), then I would take a cue from the SP-16 and make these boxes really big and bright...

In the course of developing this plug-in, I discovered something that I didn't know about how Ableton Live handles MIDI messages, and had to solve some interesting problems in Max For Live. 

MIDI Routing...

I tend to be an experimentalist rather than a documentation reader, probably as a result of many years of discovering that hardware data sheets often have errors. So the first thing I did was decode the MIDI messages that the MFT (henceforth abbreviated to MIDI Fighter Twister in this post) sends when you move between banks using the little middle buttons on the sides of the MFT. The documentation says that the MFT sends a MIDI Controller 0 off message, followed by a MIDI Controller 1 On message when you switch from Bank 1 to Bank 2, etc. So I initially unpacked the MIDI Controller Output of a 'MIDIparse' object, and then tried to figure out how to detect pairs of numbers like the 0 0, 1 127 sequence that I mentioned previously. Eventually I realised that automatically unpacking the pairs of numbers wasn't the best approach, and I removed the 'unpack' object and used my new favourite object, the 'zl compare' string comparison object. one thing that I don't like about the 'zl compare' object is the need to send a bang to message boxes to get an output from the zl, and so I over-use 'button' indicator objects as usual. 

The final patch is shown above, although it is encapsulated in the real thing. Showing everything in one place makes it easier to see what is happening. The 'sel 1' object converts the 'zl compare' output into a bang which forces a '1' out of the message object and this goes into another message box that is usdto display the Bank number. The middle part (around the 'zl compare') is repeated four times to detect 0 127, or 1 127, or 2 127 or 3 127 for the four bank switches. I know that I should have detected the full Off and On sequence of messages, but this worked okay. Actually it doesn't work perfectly because Ableton Live rechannelises all incoming MIDI to Channel 1, and so if you do too much rotary controls twisting in Bank 1, then you can confuse the plug-in. I tired in vain to figure out how to detect the full 0 0, 1 127 sequence, but didn't have any success. I may drop Cycling '74 a support question about how to do this, because I couldn't get it to work...

I also decoded the 16 rotary control MIDI Controller messages so that I could indicate which rotary control was being twisted... I used '% 16' modulo arithmetic to decode all four banks, but then I ran into my standard 'display' problem. I've talked about this before with the dual step sequencer, but in this case I needed a variation: something that would highlight a 'panel' object border when that rotary control was being twisted, and that would un-highlight it when any other rotary control was twisted. The standard technique to achieve this is to have two different message objects that send the highlight and un-highlight commands to the 'panel' object. So here's the essential parts of the encapsulation that I produced:


As before, I'm only showing two of the 16 sections. As I've rediscovered many times, there's a 'trap' in the 'sel' object - the left hand output sends a bang when the input matches the number following the 'sel', but the right hand output is the number that doesn't match, not a bang! I know with absolute certainty that I will forget this again, because I keep doing it! So that's why I use a 'button' indicator object to convert the number into a bang so that it triggers the message output. As it turns out, for many applications, having the number as the 'doesn't match' right output is very useful, and actually that's what some of the 'zl' comparison objects do... 

With the bank selection and control decoding done, I then mapped a few of the rotary controls to some parameters, and the decoding of the controls stopped working - just for the mapped controls. Now I have never looked at the Ableton M4L documentation in great detail, so I did some confirmation, and realised that when a MIDI Controller is not mapped to a parameter, then it appears in Max For Live, but when it IS mapped, then it does't appear in Max For Live. I bet this is in the documentation! Anyway, here's some diagrams that explain it in pictures (I like pictures!):


 Above is what I was doing when I first tested the decode patch. The MIDI Controller messages go into Ableton Live, and then into Max For Live...


 Above is what seems to happen when a parameter is mapped to the MIDI Controller - it no longer gets sent to Max For Live (or at least, it doesn't for me!). 

Doesn't Do Anything!

Yep, that's more or less correct. Apart from the Bank select tracking, the colour indicators, and the rotary control decoding, the MIDImftLABELSfloat plug-in doesn't do anything other than show a floating window with some user-editable text in it. In terms of MIDI or audio functionality, it is probably the least functional M4L plug-in that I have made, but I find it useful, because I'm always forgetting what I have mapped to what with all of my MIDI Controllers when I come back to a project some time later. I may make more versions of it for my other MIDI Controllers... 

Plus, whenever my mind spends time with something, it tends to come up with something different, and that's exactly what has happened here. So expect something eventually... I'm struggling with an M4L project at the moment - it is much harder than I thought, and I've been trying to find ways to do stuff in M4L that I haven't done before... But that's another story and another blog post, and there's part 4 of the 'Single Cycle Waveforms' series to finish as well...

Getting MIDImftLABELSfloat

You can get MIDImftLABELSfloat here:

     https://maxforlive.com/library/device/6726/midimftlabelsfloat

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 MIDImftLABELSfloat is quite tricky - there's very little applicable functionality to translate across. You could use a MIDI processor to detect the Bank Select or rotary control messages, but I'm not aware of any obvious ways to store general text messages. So I'm going to declare this as an ME of zero. Pencil and paper storage is probably the way to go for modular, (and definitely 'analog' as well!) or maybe a mobile phone photo as 'instant documentation'.  

---

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


Synthesizerwriter's StoreSynthesizerwriter's Store
 (New 'Modular thinking' designs now available!)


    

     

  

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete