Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Twitter

Modifying amounra Ohm control script for custom controller

edited June 2014 in Hardware

Hi all, I have build a custom controller with the brain2 and i m modifying amounra`s script.  I m no programmer.

My system is: osx 10.9.2, Brain2, Live 9.1.2
Until now i m able to communicate with the script, i have re size de "highlight clip trigger"  box AKA "redbox" to fit my controller (16x4), i can move it around. But i can't seem to understand how to assign the midi notes to the grid.  My controller has a matrix of 16x4 but i want a grid of 15x3 to have scene lunch and select track.
Here is the button matrix part of the script: 

session = SessionComponent(15, 3) = 'Session_Control'

session.set_track_bank_buttons(right_button, left_button)

session.set_scene_bank_buttons(down_button, up_button)

matrix = ButtonMatrixElement() = 'Button_Matrix'

scene_launch_notes = [31,47,63]

scene_launch_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, scene_launch_notes[index]) for index in range(3) ]

#track_stop_buttons = [ ButtonElement(is_momentary, MIDI_NOTE_TYPE, index, 52) for index in range(8) ]

for index in range(len(scene_launch_buttons)):

scene_launch_buttons[index].name = 'Scene_'+ str(index) + '_Launch_Button'

#for index in range(len(track_stop_buttons)):

# track_stop_buttons[index].name = 'Track_' + str(index) + '_Stop_Button'

#stop_all_button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, 0, 81) = 'Stop_All_Clips_Button'




#button_notes = [15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63]

for scene_index in range(3):

scene = session.scene(scene_index) = 'Scene_' + str(scene_index)

button_row = []



for track_index in range(8):

button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, (track_index * 3) + scene_index) = str(track_index) + '_Clip_' + str(scene_index) + '_Button'

Can someone point me in the right direction? Thanks in advance !



  • I think you're probably using the Ohm_64 script, which I didn't actually write....I think Michael Chenetz wrote that one.  Regardless, though, the magic you're looking for happens in the second to last line there, where the buttons are assigned.  Basically its saying:

    for track_index in range(8):   # here we create a recursion for an arbitrary variable (track_index) and assign to it on the first recursion the value 0, the next 1, the next 2, until finally we get to 8 where the recursion stops.

    button = ButtonElement( is_momentary, MIDI_NOTE_TYPE, CHANNEL, (track_index *3) + scene_index

    In this line we create the ButtonElement class for each button;  the main thing we're concerned with here is the NoteID for each one, which is the last assignment on that line:  (track_index*3) + scene_index.

    We're already in another recursion at this point, which starts with:

    for scene_index in range(3): #this does the exact same thing as I explained above with the variable scene_index.

    So, basically, we have two nested recursions that set up our grid, one for the y coordinate (scene_index) and one for the x coordinate.

    The first time that you go through the loops, the ID will be:

    scene_index = 0
    track_index = 0*3 = 0
    Button_ID = 0.

    When you get to the end of the recursion cycle, you'll have:

    scene_index = 2
    track_index = 7*3 = 21
    Button_ID = 23

    Does that make any more sense?

  • Amounra, fist of all, thanks for taking the time to look at it.
    And true, i saw one to many of your scripts, but as you said, this is  Michael Chenetz' s Ohm script.   

    Ok, i understand (theoretically (:).
    I did as you said, and it worked. Now the buttons are working, but i would like to change the order of them without reconfiguring the Brain, is this posible with this recursive technique? 

    Thanks a!
  • edited July 2014

    No problem.  

    You've got the recursion thing, so now we just need to create a list of numbers that we're going to assign the buttons' values from.  We use what is called an array.  Each member of an array has an index, and we can fetch an index's value by referencing its position in the array.

    So, for instance, we create an array:   

    my_array = [8, 2, 7, 9, 14]

    The value of my_array[0]  is 8.
    The value of my_array[2] is 7.

    You can use the code you've already written, but set up your array with 15x3 = 45 values.

    button_notes = [0, 1, 2, ....... , 43, 44]

    Then, instead of using the raw number we calculated as the assignment for the button, we use the raw number as the index of the array:

    button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, button_notes[(track_index * 3) + scene_index])

    It may look a little confusing that way, so we can break it down like this:

    my_index = (track_index * 3) + scene_index
    button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, button_notes[my_index])

    Make sense?


  • edited July 2014

    A, when you say it, it sounds amazing, (:  

    But no so much when i try.  I understand the theory, but i can't apply it. 
    I have created an array  button_notes = [0,1,2,3,4,5,6,7...47  
    Then i need to feed that into button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, button_notes[(track_index * 3) + scene_index])

    so something like that?
    button_notes = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24..

    for scene_index in range(3):

    scene = session.scene(scene_index) = 'Scene_' + str(scene_index)

    button_row = []



    for track_index in range(16):

    button = ButtonElement(is_momentary, MIDI_NOTE_TYPE, CHANNEL, button_notes[(track_index * 3) + scene_index])

    Its not working so is obviously wrong.
    im walking in the dark here, its a shame that those MRScripts with are not working for me. they look so much easier for end users to customize. But eh, lets try to learn something for a change. 
    Thz a!
  • The problem I see there is that you're setting up the second recursion for 16 times, instead of if your array is only 45 elements, long, it's running out of numbers at the end of the array.  Change it to:

    for track_index in range(15):

    and you should be good.  FWIW, if you keep an eye on your log.txt file in Ableton's preferences, it will tell you as soon as you hit an error in your Python code and usually will tell you where the error is and what type of exception it caused.  I use in OSX to monitor this, it's built into the operating system and will usually update the view of the log file while its changing.

    Ableton keeps rewriting the scripts at the core level, so it's hard for unsupported developers of this stuff to keep up with the changes.  It's kind of like the Cold War these days ;)  Which scripts are you talking about (MRSCripts) ?

  • edited July 2014

    Yes, you are right, but that's because i change the matrix to be 163 (instead of the 153) and my list has 48 elements. So the grammar is ok? Is still not working.

    I m aware of the Live log file, and i m looking at it. In this case it gives me no error.

    aaa.. yes saw it around... is hard to understand the policy of Ableton in this matter.  Hanz Petrov, Julian Bale, You! Fabrizio and more people are fighting a stupid war really, they should open it, help and end up with a better product. I guess they may be want to get money from the hardware developers to? 
    Bitwig is very aware of this "weakness". 

    For example the one you did CNTRLR_Live9_beta_031913 has a structure thats calls the the and one could re map the midi according to necessity from there?.    

     thanks again a!
  • Couple of things:  make sure you haven't autoupdated to'll need a new script for that, since they changed a bunch of stuff in the _Framework  (see my other post from today, or my blog....).

    Grammar looks right....

    Can you send me or link a copy of your log.txt and script?  I can probably see what's up from there.

    Abe's have their own reasons for wanting to keep it private.  I'm glad they let us use the stuff, but could be soooooo much easier, and more powerful if they released it to the public.

    You can add a to this too, but obviously the script isn't really set up for it and it's a hassle if you don't know what you're doing yet.  What's not working about the other scripts?  It might just be a version mismatch....this happens all the time now, b/c of the constant changes to Abe's _Framework.  You've gotta be careful that you're working with scripts that are built for your particular version of Live.

  • edited July 2014

    I m sure is 9.12.

    i saw your post in your blog. It sounds horrible and a waist of time. Also to go over a work again for some reason we think is arbitrary or non justify is depressive indeed. 

    I will send you a copy of the code and log by mail. It`s alight ? If is ok, where should i email you? Or.. 

    All scripts that have are not working out of the box. If a try to load them i get error in log file: 
    2913165 ms. RemoteScriptError:   File "<string>", line 1, in <module>

    2913165 ms. RemoteScriptError:   File "MIDI Remote Scripts/Livid_CNTRLR/", line 3, in <module>

    2913188 ms. RemoteScriptError:     
    2913188 ms. RemoteScriptError: from Cntrlr import Cntrlr

    2913188 ms. RemoteScriptError:   File "MIDI Remote Scripts/Livid_CNTRLR/", line 34, in <module>

    2913188 ms. RemoteScriptError:     
    2913189 ms. RemoteScriptError: from _Mono_Framework.CodecEncoderElement import CodecEncoderElement

    2913189 ms. RemoteScriptError: ImportError
    2913189 ms. RemoteScriptError: : 
    2913189 ms. RemoteScriptError: No module named _Mono_Framework.CodecEncoderElement
    2913189 ms. RemoteScriptError: 

    2913189 ms. Exception: Traceback (most recent call last):   File "<string>", line 1, in <module>   File "/Applications/Ableton Live 9 Remote Scripts/Livid_CNTRLR/", line 3, in <module>     from Cntrlr import Cntrlr   File "/Applications/Ableton Live 9 Remote Scripts/Livid_CNTRLR/", line 34, in <module>     from _Mono_Framework.CodecEncoderElement import CodecEncoderElement ImportError: No module named _Mono_Framework.CodecEncoderElement 

    My primitive approach to all this was: i looked for a script that could load the "redBox", that could communicate with my controller and then try to modify it.
    So i end up with the Ohm, Code and CodeRemote scripts. The others (i don't know if thats the reason)  that contain a could not by loaded.    


  • I sent you a PM with my email addy.   You're welcome to send me stuff there, I prefer to keep this sort of thing on the forums though as it may help others that are trying to do the same sort of thing ;)

    It appears the problem with the other scripts not working is that you don't have a copy of the _Mono_Framework folder from our installer in you MIDI Remote Scripts has a bunch of files that our necessary for the newer scripts to work.  You can either get it from the installer image or from my github repository, here:

    FWIW, you might want to hold off messing with this stuff until we get the scripts published for 9.13 compatibility.  The ones in my repository already work AFAIK, they are in the "Livid Python Scripts"'ll have to pull _Mono_Framework from the "Python Scripts" folder, though, as there isn't a separate copy in the Livid folder.  I made some further changes last night and everything should be working with 9.13 now.

    Let me know how it turns out!


  • edited July 2014

    Ok, cool. I have copied the Mono_Framework and now i can load the other scripts to. Nice!.

    So, i will send you a email and transfer the results to here so, as you said, everybody can benefit from it.   

    On the other hand it's kind of sad.. or i never upgrade A.L again or i will have to actually learn and update scripts on regular basis. Its sure i choise i wouldn't make freely.

    Anyway, i will keep going. 
    For this particular case, do you think i should i upgrade live and try to start over with the new scripts? or wait till they are more tested or stable? 
  • There's only a few changes Ableton made in the _Framework that are of any consequence to plain-jane scripts and they only required very straightforward changes to the scripts to get everything working. The only area I'm not sure about is using mods with the scripts that support them....if you're not using mods, the scripts will work fine (and probably will work fine even if you do, but I haven't had time to test everything yet).  I would update and start using the most current versions that I pointed you to, it will save you time in the longrun.


Sign In or Register to comment.