I'm reading through these now - very interesting.
Several things pop out.
1. There's a missing module, clearly from Ableton, called "Live" that all the files import. It's actually only used in three places:
Code: Select all
QuNeo.py:83: app = Live.Application.get_application()
QuNeo.py:293: return EncoderElement(MIDI_CC_TYPE, channel, value, Live.MidiMap.MapMode.relative_two_compliment)
SpecialTransportComponent.py:115: if not(control == None or isinstance(control, EncoderElement) and control.message_map_mode() is Live.MidiMap.MapMode.relative_two_compliment):
This doesn't seem like much of an issue, it's pretty clear what's going on here.
2. There's a decompilation error in four of the files: "STRANGE ABSOLUTE JUMP!"
This is the most worrisome part for me. It seems pretty clear that this means that the code that we see is not in fact, completely correct. But what's changed? And where?
Searching for "STRANGE ABSOLUTE JUMP" only found other decompiled files with the same message - there was no real indication as to whether this worked or not.
There's no reason you shouldn't be able to correctly decompile Python code, but that doesn't mean that the tool does it 100%.
3. A code review!
The code is pretty decent, from what I can see.
There are some "unpythonic" patterns here, very minor - for example,
Code: Select all
if not value in range(128):
is exactly equivalent to
However, this might well be due to the decompiler.
What's more disconcerting is that some of the code doesn't make sense...
Code: Select all
if value != 0:
new_tempo = 1.0
real_tempo = new_tempo + self.song().tempo
if real_tempo < 20.0:
real_tempo = 20.0
self.is_enabled() almost certainly does not have any side-effects, so why is it being called like a function?
Now, this won't cause anything to break itself BUT it's a little disconcerting.Where to go from here.
I'm unfortunately out of time right now, and I might not have time to continue this for a week or so... but here's where I would go next.
1. Try to recompile the software and see if it runs the same as the original.
My issue with doing that is that I haven't really used the QuNeo at all with the original software - I just got back from Europe a few days ago and found the unit waiting for me. So my next step would have to be to spend a few hours playing with the unit and using it.
Once it's understood how the software works when it works correctly, the next step is to recompile the code and put it back over the original software and see if it works identically.
The one issue in compilation there is that one missing external reference, Live. I'll bet that won't be too difficult to find now we know where everything is.
2. If it doesn't recompile, try to get that to happen.
If the recompilation fails, we're in a less-than-good state.
There aren't really very many decompilers out there - however, printing out Python bytecode is perfectly doable and it's pretty high-level and readable, so it would be quite possible to compare the byte code to the decompiled code and figure out what was wrong, though it would be a lot of work if you had no idea where the problem was (one advantage is that it's almost certainly in the four files that had decompilation errors).
3. Once it's recompiling, we can study the decompiled code to create our own versions.
but see the...
APPENDIX: Why aren't we seeing the original? and other legal issues.
Looking at the history of the Live/Python interface model, it's pretty clear that it comes with some sort of NDA that prevents client companies from revealing information about it (boo!)
Luckily for us, decompilation of software for study purposes has been shown to be legal in several court cases - and also it's probably not really useful for Ableton to go after hobbyists.
If we release derivative versions of this code, we are potentially infringing on KMI's copyright on the code. KMI is clearly not going to give us explicit permission to do this, it'd be a terrible legal idea for them, but unlike trademarks, you're not required to defend your copyright, so there's no downside for them if they do nothing.
I believe it's extremely likely that if we created derivative versions of the drivers for non-commercial reasons that KMI would simply not comment directly one way or the other.
If that's not the case, coming up with our own original driver by studying the decompiled code has been shown in court to not infringe copyrights, as long as we can prove that we didn't just create a derivative version.
Thanks for reading.