An Ableton Musical Key Picker Tool
A good tool improves the way you work. A great tool improves the way you think. –Jeff Duntemann
Building a scale tool in Ableton and max
This is a tool to have Ableton only display notes in the midi editor in the key you choose using the max programming environment.
Humans create tools to help offload what the brain needs to know how to do, so that the brain can then focus on doing other things. Tools can allow people to do superhuman tasks that they wouldn’t normally be able to do, thus progressing what humans can do forward.
This is a tool to make it easier to compose music if you don’t have all the scale memorized by only showing you the notes in the current scale (thus freeing up your mind to do more creative things like composing music.)
Music theory for building major and minor scales.
To calculate the notes that are shown for a scale, you need to know the root note that you want to start at, and then what type of scale you want to show (major/minor). Every scale has it’s own pattern on how many semitones you need to jump between notes, so for a whole jump, you move 2 notes forward, and for a half note jump you only move 1 note forward. This is pretty easy with midi notes, since you just add either 1 or 2 based on the pattern.
you can see how this is laid out in the code:
var scales = [ [2,2,1,2,2,2,1], // major [2,1,2,2,1,2,2] // minor ]
Interfacing with the Ableton interface with Max
To get Max to update the midi note editor, you need to interface live through the
Live Object Model (LOM).
A little of example of setting the first channel to mute using the LOM:
api = new LiveAPI("live_set tracks 0"); post(api.info) api.set('mute',0)
Before I create the notes of the scale, I need to first clear out any previous data that might have already been there:
api.call("remove_notes", "-0.25", 0, "0.25", 128);
This wipes out all notes from the time -0.25 to 0, so I can come back in and add the notes of the scale.
adding notes to the midi editor is done in multiple steps:
api.call("set_notes"); // start the note adding transaction api.call("notes", noteCount); // tell it how many notes you plan on adding api.call("note", total, "-0.25", "0.25", 100.0, 0); // the note infomration to add (call this noteCount times) api.call("done"); // tell the api you are done adding notes.
Now you should have the scale filled out on the piano roll, before 0 (so it can be hidden). Using the fold button will hide all the notes that aren’t in the key you selected.
Using the Tool
To use the patch, pull an instrument over, add the effect, select your options, click the create scale button, and then go to the midi roll for that instrument and click the “fold” button to show the notes of your scale. If you change anything, you just need to click the fold button twice to get it to refresh.
You can get the patch and see the code here: https://github.com/analogpixel/maxShowPianoInKey