Page 1 of 1

help needed modifying push scripts

Posted: Thu May 02, 2013 2:57 am
by neuromodulator
I want to modify the push script so that I can toggle a step sequencer on or off for a particular track, whether it's a drum rack or no. One way that occurred to me to do that would be to modify the script not so it queries the track about the existence of a drum rack, but only whether the selected device is a drum rack. Then by toggling the selected device, I could be toggling between the two modes. But I can't get the wording right; all my attempts to redefine the presence of a drum rack result in a non-working Push. A little help?

(An alternate method would be to be able to set the value via a max for live toggle, but I figure this is more complicated because Live wants to do other things (for instance, select a drum pad) based on the presence of a drum rack that the first method would comply with but this alternate method would not...)
def _select_note_mode(self):
"""
Selects which note mode to use depending on the kind of
current selected track and its device chain...
"""
track = self.song().view.selected_track
drum_device = find_if(lambda d: d.can_have_drum_pads, track.devices)
self._step_sequencer.set_drum_group_device(drum_device)
if track == None or track.is_foldable or track in self.song().return_tracks or track == self.song().master_track:
self._note_modes.selected_mode = 'disabled'
elif track and track.has_audio_input:
self._note_modes.selected_mode = 'looper'
elif drum_device:
self._note_modes.selected_mode = 'sequencer'
else:
self._note_modes.selected_mode = 'instrument'
I assume it's all in here, and I've tried redefining drum_device with stuff like "= self.song().view.selected_track.view.selected_device.can_have_drum_pads" but I've obviously got something wrong.

Cheers!

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 3:17 am
by neuromodulator
I guess the other issue is whether my proposed method would refresh the controller properly (i.e. with a selected device change only, without toggling the track or what have you). I have no idea how to read the script to determine if that's the case, so any advice on that front would be great as well.

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 7:47 am
by neuromodulator
Gah, it appears to be more complicated. It's not just that I haven't got the syntax right above, but also that I can't insert any modifications in the remote scripts successfully. Like, including just opening the push.py and inserting a single character in one of the comment lines. Any modification breaks it. Is there some kind of error correction going on? Are the existing scripts online out of date and incompatible with the current scripts?

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 8:34 am
by irrelevance

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 10:48 am
by Because789
neuromodulator wrote:Are the existing scripts online out of date and incompatible with the current scripts?
They are definitly out of date and very probably incompatible. The Push scripts are under heavy development, with each update there is a chance that you have to start from scratch (if you only want to make minor changes to the default script).

No help on you other questions, since I didn't dig into the scripts yet (because of the above reason).

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 2:10 pm
by djlimbs
neuromodulator wrote:Gah, it appears to be more complicated. It's not just that I haven't got the syntax right above, but also that I can't insert any modifications in the remote scripts successfully. Like, including just opening the push.py and inserting a single character in one of the comment lines. Any modification breaks it. Is there some kind of error correction going on? Are the existing scripts online out of date and incompatible with the current scripts?
yea the scripts Julien decompiled are out of date (last time I checked). some files weren't changed in updates but others were. you might get more luck if you contact NativeKontrol, get the PXT-Live script and ask about source for the file you wanna mod. Or try decompiling yourself (which was a pain to do, but possible on a Mac).

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 4:17 pm
by lo.key

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 5:09 pm
by neuromodulator
Yeah, I tried that like an hour ago. There were bits of the test file I tried that it couldn't do. It's probably a later version of Python.

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 5:43 pm
by lo.key
hmm, this one supposedly takes up to python 2.7

https://github.com/wibiti/uncompyle2

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 8:13 pm
by neuromodulator
Yeah, we're on the same page, lo.key. Don't know how the hell to use it, though. :)

I know I'm trying to do things that are beyond my knowledge, but it's fun. I love poking about with this stuff.

Re: help needed modifying push scripts

Posted: Thu May 02, 2013 10:21 pm
by irrelevance
djlimbs wrote:
neuromodulator wrote:Gah, it appears to be more complicated. It's not just that I haven't got the syntax right above, but also that I can't insert any modifications in the remote scripts successfully. Like, including just opening the push.py and inserting a single character in one of the comment lines. Any modification breaks it. Is there some kind of error correction going on? Are the existing scripts online out of date and incompatible with the current scripts?
yea the scripts Julien decompiled are out of date (last time I checked). some files weren't changed in updates but others were. you might get more luck if you contact NativeKontrol, get the PXT-Live script and ask about source for the file you wanna mod. Or try decompiling yourself (which was a pain to do, but possible on a Mac).
Says the last update/upload for push script was 20 days ago. There hasn't been any Live updates in this time has there?

Re: help needed modifying push scripts

Posted: Fri May 03, 2013 9:52 am
by Because789
irrelevance wrote: Says the last update/upload for push script was 20 days ago. There hasn't been any Live updates in this time has there?
Only a change to BrowserComponent.py was added the 12th of april, all other Push scripts were uploaded the 3th of march. They are outdated.

Btw: the Live 9 scripts use python 2.5