gluon / AbletonLive11_MIDIRemoteScripts

https://structure-void.com/ableton-live-midi-remote-scripts/
274 stars 66 forks source link

Bad call and import on Novation Launchpad Scripts. Decompile error? #4

Open dbanshee opened 2 years ago

dbanshee commented 2 years ago

Trying to execute Novation Launchpad Mini MK3 Script, I have experimented a few errors.

2022-06-30T19:35:55.705937: info: RemoteScriptError:   File "<string>", line 1, in <module>
2022-06-30T19:35:55.706239: info: RemoteScriptError:   File "C:\Users\banshee\Documents\Ableton\User Library\Remote Scripts\Launchpad\__init__.py", line 9, in <module>

2022-06-30T19:35:55.706477: info: RemoteScriptError:
2022-06-30T19:35:55.706536: info: RemoteScriptError: from .launchpad_mini_mk3 import Launchpad_Mini_MK3
2022-06-30T19:35:55.706589: info: RemoteScriptError:

2022-06-30T19:35:55.706645: info: RemoteScriptError:   File "C:\Users\banshee\Documents\Ableton\User Library\Remote Scripts\Launchpad\launchpad_mini_mk3.py", line 19, in <module>

2022-06-30T19:35:55.706851: info: RemoteScriptError:
2022-06-30T19:35:55.706906: info: RemoteScriptError: from .skin import skin
2022-06-30T19:35:55.706958: info: RemoteScriptError:

2022-06-30T19:35:55.707014: info: RemoteScriptError:   File "C:\Users\banshee\Documents\Ableton\User Library\Remote Scripts\Launchpad\skin.py", line 33, in <module>

2022-06-30T19:35:55.707211: info: RemoteScriptError:
2022-06-30T19:35:55.707266: info: RemoteScriptError: skin = merge_skins(base_skin, Skin(Colors)*())
2022-06-30T19:35:55.707316: info: RemoteScriptError:

2022-06-30T19:35:55.707376: info: RemoteScriptError: TypeError
2022-06-30T19:35:55.707428: info: RemoteScriptError: :
2022-06-30T19:35:55.707478: info: RemoteScriptError: can't multiply sequence by non-int of type 'Skin'
2022-06-30T19:35:55.707527: info: RemoteScriptError:

Apparently the operation Skin(Colors)*() doesn't works. I thought it can be a mismatch Python core version on mi local Ableton Installation and the target of this source code. So I decompile mi local Ableton Scripts and compare them. Both are equals.

I'm not a Python expert and I have no excesive time so, I look and change the merge_skings call from Ableton10 repository.

Changing in file Launchpad_Mini_MK3/skin.py from this

skin = merge_skins(base_skin, Skin(Colors)*())

to this

skin = merge_skins(*(base_skin, Skin(Colors)))

After that I obtained another error.

2022-06-30T20:17:03.929307: info: RemoteScriptError:   File "C:\Users\banshee\Documents\Ableton\User Library\Remote Scripts\Launchpad\launchpad_mini_mk3.py", line 19, in <module>

2022-06-30T20:17:03.929511: info: RemoteScriptError:
2022-06-30T20:17:03.929567: info: RemoteScriptError: from .skin import skin
2022-06-30T20:17:03.929619: info: RemoteScriptError:

2022-06-30T20:17:03.929675: info: RemoteScriptError:   File "C:\Users\banshee\Documents\Ableton\User Library\Remote Scripts\Launchpad\skin.py", line 34, in <module>

2022-06-30T20:17:03.929873: info: RemoteScriptError:
2022-06-30T20:17:03.929928: info: RemoteScriptError: skin = merge_skins(*(base_skin, Skin(Colors)))
2022-06-30T20:17:03.929979: info: RemoteScriptError20
2022-06-30T20:17:03.930035: info: RemoteScriptError:   File "..\..\..\output\Live\win_64_static\Release\python-bundle\MIDI Remote Scripts\ableton\v2\control_surface\skin.py", line 75, in merge_skins

2022-06-30T20:17:03.930353: info: RemoteScriptError:   File "..\..\..\output\Live\win_64_static\Release\python-bundle\MIDI Remote Scripts\ableton\v2\control_surface\skin.py", line 75, in <lambda>

2022-06-30T20:17:03.930641: info: RemoteScriptError: AttributeError
2022-06-30T20:17:03.930697: info: RemoteScriptError: :
2022-06-30T20:17:03.930750: info: RemoteScriptError: module 'novation.skin' has no attribute '_colors'

Cheking for the types of function args on Launchpad_Mini_MK3/skin.py

sys.stderr.write(str(type(base_skin)))
sys.stderr.write(str(type(Skin(Colors))))

#skin = merge_skins(base_skin, Skin(Colors)*())
skin = merge_skins(*(base_skin, Skin(Colors)))

Result

2022-06-30T20:17:03.934386: info: RemoteScriptError: <class 'module'>
2022-06-30T20:17:03.934499: info: RemoteScriptError: <class 'ableton.v2.control_surface.skin.Skin'>

I check the first argument is not a Skin, it's a module. Analyzing the source code and comparing with Ableton9 i found a bad import.

Changing from this

import novation.skin as base_skin

to this:

from novation.skin import skin as base_skin

Now the Script works succesfully.

At least all Launchpad MK3 scripts has the same issue, but I only tested on Launchpad Mini MK3.

As I said, I decompiled my own Ableton Local Scripts and i check the same error so I suposse the main problem are in the decompilation process.

I used :

decompyle3 --version
decompyle3, version 3.9.0
Henry-White commented 2 years ago

I had the same issue with the same solution but with Launchkey_Mini_MK3 script. Unfortunately I've found your solution too late )) But I got another one: Python: ERROR:ableton.v2.control_surface.identifiable_control_surface:89 - MIDI device responded with wrong product id ((0, 32, 41, 19, 1, 0, 0) != (0, 32, 41, 2, 1, 0, 0)). Have you got this?

dbanshee commented 2 years ago

Hello. Cassually I have a Launchkey Mini MK3 too. Can you share the full fixed code that you are using and I will test it on my environment.

Henry-White commented 2 years ago

With pleasure! My script is here Unfortunately I can not offer nothing new for you. I just a couple of days ago start to study Novation & Ableton libs.

Henry-White commented 2 years ago

Done. Sorry for wasting your time. It was just stupid error because I pointed out wrong MIDI in preferences.

dbanshee commented 2 years ago

Don't worry Henry. I'm Happy for you. Whats your objetive?. Some improvements or new Features?

I'm working on adding the features of LaunchPad X to LaunchPad Mini. Maybe you can find interesting code from LaunchKeys Big brothers.

Henry-White commented 2 years ago

My interests:

dbanshee commented 2 years ago

It sounds interesting!. I'll watch your repository to keep my up.

dctp05 commented 1 year ago

Just wanted to let you know that this made my day. I went from despair at not being able to transfer my remote scripts from 10 to 11, to breathing a sigh of relief and learning something new. Thanks! My Launchpad X script works perfectly :)

dbanshee commented 1 year ago

Just wanted to let you know that this made my day. I went from despair at not being able to transfer my remote scripts from 10 to 11, to breathing a sigh of relief and learning something new. Thanks! My Launchpad X script works perfectly :)

I'm glad to hear that and to be able to help another Ableton and Novation fellow.

Since you have a Launchpad, I would like to ask you if it would be possible to carry out a small test on it. I think I have discovered a bug in the firmware of my Launchpad Mini MK3 and although they are not the same model, the functionality that I intend to test is the same.

I expose more details here.

https://github.com/Focusrite-Novation/launchpad-firmware/issues/2

Novation refers me to send my drive, but honestly it seems to be a software bug and I feel like giving up my drive for weeks.

If you had the time, I could send you more detailed instructions about the problem and the little test.

dctp05 commented 1 year ago

Just wanted to let you know that this made my day. I went from despair at not being able to transfer my remote scripts from 10 to 11, to breathing a sigh of relief and learning something new. Thanks! My Launchpad X script works perfectly :)

I'm glad to hear that and to be able to help another Ableton and Novation fellow.

Since you have a Launchpad, I would like to ask you if it would be possible to carry out a small test on it. I think I have discovered a bug in the firmware of my Launchpad Mini MK3 and although they are not the same model, the functionality that I intend to test is the same.

I expose more details here.

Focusrite-Novation/launchpad-firmware#2

Novation refers me to send my drive, but honestly it seems to be a software bug and I feel like giving up my drive for weeks.

If you had the time, I could send you more detailed instructions about the problem and the little test.

Sure that sounds good, sending you an email now.