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
regretfullySaid
Posts: 8913
Joined: Thu Apr 22, 2010 5:50 pm

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

Post by regretfullySaid » Wed Jun 18, 2014 11:53 pm

Hey man, congrats on all the house/marriage/weather combo:). Perfect time for an Ableton vacation :P
ImageImage

reganjo1955
Posts: 5
Joined: Sun Apr 10, 2011 2:13 am

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

Post by reganjo1955 » Mon Nov 03, 2014 10:05 pm

I was pulling my hair out until I found this post. Thanks so much.

the key takeaway for me was:

Code: Select all

from __future__ import with_statement 
I kept getting dependency errors until I did this.

A couple of questions
you show:

Code: Select all

import Live
I don't see any packages or modules with that name in the MIDI Remote Scripts directoy. Is this defined inside the Ableton / Python runtime? How and when do you use it. I see one short mention in your text but not in code. I will look more deeply and expect to find all the API in the LOM.
You also show

Code: Select all

__module__ = __name__
Did this have a purpose? When I exclude this nothing breaks (yet).

I will continue reading the thread for more solutions. This has definitely made my day.

Kithara

JuSchu
Posts: 122
Joined: Sat Mar 08, 2008 5:12 pm
Location: Wuppertal (Germany)

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

Post by JuSchu » Sat Jan 24, 2015 5:35 pm

akamed wrote:I have one question about the "add_value_listener" function.
When I assign this:

self.Pad1.add_value_listener(self.button1,identify_sender= False)

It calls "button1" that is "def button1(self, value): ...." and works great.

But if I want to do this:

self.Pad1.add_value_listener(self.button1(99),identify_sender= False)
This is not about the function add_value_listener is's about the concept of "callbacks".
If you write "button1" you give add_value_listener the function "buton1" as the first parameter. If you append the braces (no matter if something is in it or not), you give add_value_listener the value wich is returned by button1 as the first parameter.

You need the function partial from functools
At the top of the file isert this

Code: Select all

from functools import partial
Then you can do this

Code: Select all

self.Pad1.add_value_listener(partial(self.button1, 99))
As far as I remember "identify_sender= False" is the default. So you only would have to use "identify_sender=True". Of course just if you want to identify the sender.


Here is an other solution without partial which is easy to understand.

Code: Select all

def func(self):
    self.button1(99)

Code: Select all

self.Pad1.add_value_listener(self.func)
I would still recomend partial. This was just for edicational reasons to explain what's going on behind the scenes of partial. Not exactly, but it's something like this.

S4racen
Posts: 5207
Joined: Fri Aug 24, 2007 4:08 pm
Location: Dunstable
Contact:

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

Post by S4racen » Sat Jan 24, 2015 8:59 pm

ttilberg wrote:That looks really helpful!

The two things that I feel would be awesome with my BCR2000:
1) Context aware synth control for more than 8 parameters, without having to shuffle pages.
i.e.: With Operator selected (blue-hand style), I can have the 24 main nobs controlling the 24 parameters I find most helpful. With Analog selected, they are different. And ideally, a way to do the same for VSTs, perhaps through config routing and saving a rack with it in there. This seems so damned straightforward in pseudo code, but I just couldn't make the right connections.
Working on this at the moment., well at leaf the 24 Knobs controlling the parameters of the blue handed device...

The choice of parroters can be achieved with the ubermap project i believe....

Cheers
D

NSU_Spray
Posts: 45
Joined: Wed Mar 02, 2011 11:24 am
Location: Russia, Saint Petersburg
Contact:

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

Post by NSU_Spray » Mon Mar 16, 2015 4:11 am

Raztua wrote:
shadx312 wrote:Thanks for sharing, very cool.

I don't think you need to open and close Live everytime you want to re-actualise the script.
Try unselecting the script in the preferences, like 'none', and then reselect the script.
That might re-actualise it.
I didn't talked about this, because sometimes it works, and sometime it doesn't work.
So sometime your correct a mistake, reload the script, but everithing isnt reloaded, and you this your correction is false.
If you restart each time, even if it is Damn Boring, Your are sure that the script is refreshed.
Eureka! You just need to create a New Live Set (Ctrl+N) :)

soall
Posts: 9
Joined: Wed Apr 15, 2015 3:49 pm

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

Post by soall » Mon Apr 20, 2015 2:53 pm

Hi guys, I have a problem I try to fix since 2 weeks now and I can't get over it. May be somebody can help me ?
I've done a script which give me a red box for my launchpad. Actually, I use the set_track_bank_buttons to navigate but I would love to be able to move 8track by 8 track (to fit my launchpad with full new track) my redbox. My first idea was to use the offset fonction but it can't go over 4 track offset (0,1,2,3 then the all the value make no difference and are taken like 0 offset). Do you have some idea to make this work ?
Thanks a lot and sorry for my bad english ! :roll:

Raztua
Posts: 24
Joined: Fri Dec 20, 2013 7:38 pm

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

Post by Raztua » Sat May 09, 2015 10:56 am

hi all,

Soal,
I am not sure to understand what you want, but ill try to explained what i have understood fro your post and how to solve it:
you whave a 8*8 pad matrix on your launchpad,
what you want is:
-to be able to launch the 8 clips from the 8 first track,
-to be able by pressing a button to launch the 8 clips from de 9 to the 16 tracks etc etc...
with i think the light on the pad button light when the clip is present and get it sprkling when the track is playing.

I dont have a launchpad so ill try to explain a way to do this, but it can't give you the exact solution

but before ill need a few informations:

What is your version of live?
Did you start your script from scratch?
Can you post you script on gitub or something like that for a easier understanding of what you have done

JuSchu,
Why do you want not to identify sender??

S4racen,
The easiest way to do this would be an easy to implement trick:
You have to add a listener on the selected track
then you just depending on the track selected modify the midi channel associated with to this CC
and then by hand (in live) you link the cc with the correct channel to you vst parameter


cldt,

soall
Posts: 9
Joined: Wed Apr 15, 2015 3:49 pm

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

Post by soall » Mon May 18, 2015 6:22 pm

Hi, thanks a lot for your answer. I managed how to get over my problem but a new one happen. I use rebuild_midi_map() on my script and it works great but I have a color issue. When I assigne a parameter in live to a pad the color is either Amber(on) or Amber Blinking(off). How can I change that ? I tried:
for track_index in range(8):
for scene_index in range(8):
self._matrix.get_button(track_index, scene_index).set_on_off_values(127, LED_OFF)
But it doesn't seems to work. :oops:
Sorry for my bad english. And thanks again for your Help !
PS: My version of live is 9.1

Raztua
Posts: 24
Joined: Fri Dec 20, 2013 7:38 pm

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

Post by Raztua » Mon May 18, 2015 8:53 pm

hi,

what s the value of LED_OFF.
For whats i see from official script it seems to be 4.
is that right ?

soall
Posts: 9
Joined: Wed Apr 15, 2015 3:49 pm

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

Post by soall » Mon May 18, 2015 10:20 pm

It's ok I find the solution to my problem !
Juste one question: in your script for the sparkle, in step sequencer mode, if you add a note directly in ableton is there still a feedback on the sparkle ? Or is the feedback only in sparkle=>ableton direction ?
Thanks !

Raztua
Posts: 24
Joined: Fri Dec 20, 2013 7:38 pm

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

Post by Raztua » Thu May 21, 2015 6:21 am

hi,
it works in both directions:
For the live -> Spark update check this part of the script:

Code: Select all

    def update_cache(self):
        if self.actual_clipslot!=None and self.actual_clipslot.clip!=None :
            note_tuple=self.actual_clipslot.clip.get_notes(0.0,note_pitch,self.actual_clipslot.clip.length,1)
            self.cache=64*[False]
            if len(note_tuple)>0:
                for tuple in note_tuple:
                    self.cache[int(4*tuple[1])]=True
it gets an array for the 64 beat ( 4 beats for 16 mesures) for one pitch. then i just update leds according to the boolean value of Self.cache.

Have you ever checked th launchpad95 Script ?
Might help you to script the launchpad

soall
Posts: 9
Joined: Wed Apr 15, 2015 3:49 pm

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

Post by soall » Tue May 26, 2015 3:48 am

Yep ! thanks a lot I succeed doing my own step sequencer for my launchpad but I still have a problem :oops:
if I write:

index = -2
for scene_index in range(2):
for track_index in range(8):
index = index + 2
self._matrix.get_button(track_index, scene_index).add_value_listener(partial(self.navigation_fonction, index))

How can I then remove this ? I try with:

for scene_index in range(2):
for track_index in range(8):
self._matrix.get_button(track_index, scene_index).remove_value_listener(self.navigation_fonction, index)

But it doesn't work :cry:

I also try this:

index = -2
for scene_index in range(2):
for track_index in range(8):
index = index + 2
self._matrix.get_button(track_index, scene_index).remove_value_listener(partial(self.navigation_fonction, index))

But it doesn't work too

Can you help me with this ? it will be so great !

soall
Posts: 9
Joined: Wed Apr 15, 2015 3:49 pm

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

Post by soall » Tue May 26, 2015 3:59 am

ps: this is the function:
def navigation_fonction(self, index, value):
self._half_bar_position = index
self.update_notes()

Raztua
Posts: 24
Joined: Fri Dec 20, 2013 7:38 pm

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

Post by Raztua » Thu May 28, 2015 6:08 am

hi soal,

good luck with the script then,

try this:
for scene_index in range(2):
for track_index in range(8):
self._matrix.get_button(track_index, scene_index).clear_value_listeners()

soall
Posts: 9
Joined: Wed Apr 15, 2015 3:49 pm

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

Post by soall » Sat May 30, 2015 12:45 am

Thanks so much it works.
Just a last question: I try to get 2 feedback on the metronome of ableton. The first feedback is a beat/pad
and my code is something like this:

def auto_update_playhead(self):
clip = self.clip
self.update_second_playhead()
if not clip.playing_position_has_listener(self.auto_update_playhead):
clip.add_playing_position_listener(self.auto_update_playhead)
if self._index > 0:
self._index = -1
self._index = self._index + 1
self._index_position[self._index] = int(clip.playing_position)
if self._index_position[self._index] != self._index_position[self._index - 1]:
self.update_first_playhead()

It works well even if it looks dirty hahaha :oops:
But the problem is my second feedback I want it to be a quarter-beat/pad: so, to light 8 pad each 2 beat.
My problem is that the function add_playing_position_listener is not accurate and set a trigger each 1/16 beat (so it's to fast) i want it to be (1/4). I could try to make a function to slow it like the other code but the trigger doesn't look to be accurate enough to works. Here is an idea of what I get in 4 bar without the int:
I just did a simple function with add_playin_position in trigger and clip.playing_position in log:
=======================
51320 ms. RemoteScriptMessage: (Launchpad) ================ 0.0564625478688 =================
51388 ms. RemoteScriptMessage: (Launchpad) ================= 0.156462547869 =================
51439 ms. RemoteScriptMessage: (Launchpad) ================= 0.256462547869 =================
51499 ms. RemoteScriptMessage: (Launchpad) ================= 0.356462547869 =================
51568 ms. RemoteScriptMessage: (Launchpad) ================= 0.556462547869 =================
51628 ms. RemoteScriptMessage: (Launchpad) ================= 0.656462547869 =================
51679 ms. RemoteScriptMessage: (Launchpad) ================= 0.756462547869 =================
51738 ms. RemoteScriptMessage: (Launchpad) ================= 0.856462547869 =================
51789 ms. RemoteScriptMessage: (Launchpad) ================= 0.956462547869 =================
51868 ms. RemoteScriptMessage: (Launchpad) ================= 1.05646254787 ==================
51928 ms. RemoteScriptMessage: (Launchpad) ================= 1.15646254787 ==================
51978 ms. RemoteScriptMessage: (Launchpad) ================= 1.35646254787 ==================
52029 ms. RemoteScriptMessage: (Launchpad) ================= 1.45646254787 ==================
52089 ms. RemoteScriptMessage: (Launchpad) ================= 1.55646254787 ==================
52149 ms. RemoteScriptMessage: (Launchpad) ================= 1.65646254787 ==================
52208 ms. RemoteScriptMessage: (Launchpad) ================= 1.85646254787 ==================
52328 ms. RemoteScriptMessage: (Launchpad) ================= 2.05646254787 ==================
52388 ms. RemoteScriptMessage: (Launchpad) ================= 2.15646254787 ==================
52448 ms. RemoteScriptMessage: (Launchpad) ================= 2.25646254787 ==================
52509 ms. RemoteScriptMessage: (Launchpad) ================= 2.35646254787 ==================
52569 ms. RemoteScriptMessage: (Launchpad) ================= 2.45646254787 ==================
52629 ms. RemoteScriptMessage: (Launchpad) ================= 2.55646254787 ==================
52689 ms. RemoteScriptMessage: (Launchpad) ================= 2.75646254787 ==================
52718 ms. RemoteScriptMessage: (Launchpad) ================= 2.85646254787 ==================
52798 ms. RemoteScriptMessage: (Launchpad) ================= 2.95646254787 ==================
52848 ms. RemoteScriptMessage: (Launchpad) ================= 3.05646254787 ==================
52899 ms. RemoteScriptMessage: (Launchpad) ================= 3.15646254787 ==================
52959 ms. RemoteScriptMessage: (Launchpad) ================= 3.35646254787 ==================
53039 ms. RemoteScriptMessage: (Launchpad) ================= 3.45646254787 ==================
53069 ms. RemoteScriptMessage: (Launchpad) ================= 3.55646254787 ==================
53149 ms. RemoteScriptMessage: (Launchpad) ================= 3.65646254787 ==================
53198 ms. RemoteScriptMessage: (Launchpad) ================= 3.75646254787 ==================
53258 ms. RemoteScriptMessage: (Launchpad) ================= 3.85646254787 ==================
53309 ms. RemoteScriptMessage: (Launchpad) ====================== 0.0


We can see that it doesn't look nice. Some time it send more than 8 trig in a bar. Do you have an idea to solve this problem ?
Thanks a lot !

Post Reply