How to : use midi remote script Major Update (sparkle)

Discussion of music production, audio, equipment and any related topics, either with or without Ableton Live
Raztua
Posts: 24
Joined: Fri Dec 20, 2013 7:38 pm

Re: How to : use midi remote script Major Update (sparkle)

Post by Raztua » Tue Jun 02, 2015 5:56 pm

i think you should try do the way i have done it:
First i recommand you to use

Code: Select all

self.song().add_current_song_time_listener(self._song_time_listener)
this seems to be the most precise callback
then in my script it it calls the function:

Code: Select all

    def _song_time_listener(self):
    if self.actual_mode_button==self.mode_buttons[2] or self.actual_mode_button==self.mode_buttons[3] :
        value=self.actual_clipslot.clip.playing_position
        if int(4*value)!=self.blink_position and (int(value) in range(4*(self.pattern_position-1),4*(self.pattern_position))):
            if self.pattern_buttons[(int(4*value)-1)%16].status:
                self.turn_led_on(self.pattern_buttons[(int(4*value)-1)%16].identifier)
            else:
                self.turn_led_off(self.pattern_buttons[(int(4*value)-1)%16].identifier)
            if self.pattern_buttons[(int(4*value))%16].status:
                self.turn_led_off(self.pattern_buttons[(int(4*value))%16].identifier)
            else:
                self.turn_led_on(self.pattern_buttons[(int(4*value))%16].identifier)
        elif (int(4*value))%16!=self.blink_position and (((int(4*value))==16*(self.pattern_position)) or int(4*value)==0):
            self.turn_led_off(self.pattern_buttons[(int(4*value)-1)%16].identifier)
Let me know if you don t get something

ygdgtl
Posts: 1
Joined: Thu Mar 17, 2011 7:24 am

Re: How to : use midi remote script Major Update (sparkle)

Post by ygdgtl » Fri Sep 04, 2015 4:06 am

Helo, My name is yogie im using ableton live 9.1.7
Im using python 3.4

but, im still find error like this :
10819 ms. RemoteScriptError: Traceback (most recent call last):

10819 ms. RemoteScriptError: File "MIDI Remote Scripts\a\__init__.py", line 4, in create_instance

10820 ms. RemoteScriptError:
10820 ms. RemoteScriptError: return Transportasi(c_instance)
10820 ms. RemoteScriptError:

10820 ms. RemoteScriptError: File "MIDI Remote Scripts\a\Transportasi.py", line 26, in __init__

10821 ms. RemoteScriptError:
10821 ms. RemoteScriptError: TransportComponent.set_play_button(ButtonElement(True, 0, 0, 48))

10821 ms. RemoteScriptError: File "c:\Jenkins\live\Projects\AppWebConnector\Resources\third_party\lib\contextlib.py", line 33, in __exit__
10822 ms. RemoteScriptError: File "c:\Jenkins\live\Binary\Core_Release_32_static\midi-remote-scripts\_Framework\ControlSurface.py", line 661, in component_guard
10822 ms. RemoteScriptError: File "MIDI Remote Scripts\a\Transportasi.py", line 26, in __init__
10822 ms. RemoteScriptError:
10823 ms. RemoteScriptError: TransportComponent.set_play_button(ButtonElement(True, 0, 0, 48))
10823 ms. RemoteScriptError: TypeError
10823 ms. RemoteScriptError: :
10823 ms. RemoteScriptError: unbound method set_play_button() must be called with TransportComponent instance as first argument (got ButtonElement instance instead)
10824 ms. RemoteScriptError:


in my script im just trying to control the global play button.
here is my code :
__init__.py

Code: Select all

from Transportasi import Transportasi

def create_instance(c_instance):
    return Transportasi(c_instance)

transportasi.py

Code: Select all

from __future__ import with_statement
import Live
from _Framework.ControlSurface import ControlSurface #Central base class for scripts based on the new Framework
from _Framework.TransportComponent import TransportComponent #Class encapsulating all functions in Live's transport section
from _Framework.ButtonElement import ButtonElement #Class representing a button a the controller

class Transportasi(ControlSurface):
    __module__=__name__                  #name of the class
    __doc__="transport function"           #documentation

    def __init__(self, c_instance):
        ControlSurface.__init__(self,c_instance)   #import the components of a ControlSurface
        self.log_message("ikilho")
        with self.component_guard():               #don't know the us of this, but it is recquiered in live 9 scripts
            self.__c_instance = c_instance

            transport = TransportComponent() #Instantiate a Transport Component
            transport.set_play_button(ButtonElement(True, 0, 0, 48))

Whats wrong with my code? Anybody can help me please?


Thx...

snappyass
Posts: 60
Joined: Sat Jan 04, 2014 1:40 pm

Re: How to : use midi remote script for the SparkLE

Post by snappyass » Wed Dec 16, 2015 5:45 am

Raztua wrote:Hi followers,

Today i ll try to make a simple program that uses 5 buttons to browse instruments
I will use:
  • button 60 to activate the browser
  • button 61 to navigate up
  • button 62 to navigate down
  • button 63 to navigate left
  • button 64 to navigate right



here is the script :

Code: Select all

import Live #you import Live, in order to be able to use its components
from _Framework.ControlSurface import ControlSurface
from _Framework.ButtonElement import ButtonElement
from _Framework.InputControlElement import *



IS_MOMENTARY=True

class sparkLE2(ControlSurface):
    __module__=__name__
    __doc__="Sparkle function"
    
    def __init__(self, c_instance):
        ControlSurface.__init__(self,c_instance)
        with self.component_guard():
            self.__c_instance = c_instance
            self.view=self.application().view
            self.show_message('initialiasation du script')
            #initialisation and setup of the pad          
            self.Pad_browser=ButtonElement(IS_MOMENTARY, MIDI_NOTE_TYPE, 0,60)
            self.Pad_browser.status=False            
            self.Pad_up=ButtonElement(IS_MOMENTARY, MIDI_NOTE_TYPE, 0,61)
            self.Pad_down=ButtonElement(IS_MOMENTARY, MIDI_NOTE_TYPE, 0,62)            
            self.Pad_left=ButtonElement(IS_MOMENTARY, MIDI_NOTE_TYPE, 0,63)
            self.Pad_right=ButtonElement(IS_MOMENTARY, MIDI_NOTE_TYPE, 0,64)
            
            self.Pad_browser.add_value_listener(self.browser,identify_sender= False)
            self.Pad_up.add_value_listener(self.up,identify_sender= False)
            self.Pad_down.add_value_listener(self.down,identify_sender= False)
            self.Pad_left.add_value_listener(self.left,identify_sender= False)
            self.Pad_right.add_value_listener(self.right,identify_sender= False)
            
            self.view.hide_view('Browser')

    def browser(self,value):
        if value!=0:
            if self.Pad_browser.status==False:
                self.Pad_browser.status=True
                self.view.focus_view('Browser')
                self.view.show_view('Browser')
                
            elif self.Pad_browser.status==True:
                self.Pad_browser.status=False
                self.view.hide_view('Browser')
                
    def up(self,value):
        if value!=0:
            self.view.scroll_view(0,'Browser',False)
            
            
    def down(self,value):
        if value!=0:
            self.view.scroll_view(1,'Browser',False)
            
    def left(self,value):
        if value!=0:
            self.view.scroll_view(2,'Browser',False)
            
    def right(self,value):
        if value!=0:
            self.view.scroll_view(3,'Browser',False)
How ever i am unable to simulate the return key with a midi inforamtion.
-> I can't add the device to the selected rack.

I have checked the Browser.tags.children etc etc and i am able to load a device using the browser method,

But i am unable to link the View object and the browser object.

if someone has an idea :)
when i try this i keep getting 5301 ms. RemoteScriptError:

5307 ms. RemoteScriptError:
5314 ms. RemoteScriptError: with self.component_guard():

5321 ms. RemoteScriptError:
5327 ms. RemoteScriptError:
5335 ms. RemoteScriptError:
5342 ms. RemoteScriptError:
5349 ms. RemoteScriptError:
5356 ms. RemoteScriptError:
5363 ms. RemoteScriptError:
5371 ms. RemoteScriptError:
5377 ms. RemoteScriptError:
5384 ms. RemoteScriptError: ^

5391 ms. RemoteScriptError: SyntaxError
5398 ms. RemoteScriptError: :
5408 ms. RemoteScriptError: invalid syntax
5415 ms. RemoteScriptError:

snappyass
Posts: 60
Joined: Sat Jan 04, 2014 1:40 pm

Re: How to : use midi remote script Major Update (sparkle)

Post by snappyass » Thu Dec 24, 2015 4:32 am

sorted that. "from __future__ import with_statement" was needed. did you ever work out how to simulate the enter/ return key? i can use a keystroke as a workaround but with multiple monitors i have to make sure ableton is my screen in focus with a mouse click. so this can be a bit annoying.

b_gamut
Posts: 1
Joined: Wed Jul 23, 2014 2:56 pm

Re: How to : use midi remote script Major Update (sparkle)

Post by b_gamut » Thu Mar 15, 2018 9:38 pm

wrote a little script for those who might want to decompile the .pyc to readable .py recursively. Please change the root address according to your settings.

https://gist.github.com/bgamut/3b19d3f4 ... f993fbb57e

IMage_Engine
Posts: 89
Joined: Sat Jun 07, 2008 10:38 pm
Location: Sydney, Australia

Re: How to : use midi remote script Major Update (sparkle)

Post by IMage_Engine » Wed Sep 16, 2020 10:37 pm

Raztua wrote:
Mon Dec 23, 2013 4:28 pm

Edit january 2014 : link to the Video: Enjoy
https://vidd.me/HiH

Sources are avaliable on the 9th post

Your work is still being used!

Unfortunately the video is not working...possible to post on youtube and change the sticky note?

Post Reply