FMMT666 / launchpad.py

Novation Launchpad (and Midi Fighter) control suite for Python
Other
350 stars 59 forks source link

Launchpad with custom firmware only returning NoteON #56

Closed YarosMallorca closed 2 years ago

YarosMallorca commented 4 years ago

I have the launchpad pro with mat1jaczyyy's custom firmware, and when I do ButtonStateXY it only returns note on messages, not off ones.

FMMT666 commented 4 years ago

Sounds as if this FW returns some custom or modified MIDI messages.

YarosMallorca commented 4 years ago

It is returning All of the midi messages in Ableton and other software!

FMMT666 commented 4 years ago

I can imagine hundreds of reasons why that could happen.

Could you please run that stupid "information.py" script from the examples folder and post the results?

Would also be cool if you could post the messages output of a MIDI monitor (like "MIDI-OX" for Windoze; "MIDI Monitor" for macOS; as you're using Ableton Live, I assume you don't use Linux ...), for the buttons.

Which Pro are you using? The new one? Anyway, both of them also output tons of "pressure messages" between a Note On and Off message.

Also, what does this mini launchpad.py code do?

  ...
  while 1:
    buts = lp.ButtonStateRaw()
    if buts != []:
      print( buts )
  ...
YarosMallorca commented 4 years ago

This is the output of the information.py file:

 - OS      : nt
 - Platform: Windows
 - Release : 10
 - Arch    : 64bit
 - struct  : 64
 - Python  : 3.7.6
 - PyGame  : 1.9.6

Available MIDI devices:
(b'MMSystem', b'Microsoft MIDI Mapper', 0, 1, 0)
(b'MMSystem', b'Launchpad Open', 1, 0, 0)
(b'MMSystem', b'MIDIIN2 (Launchpad Open)', 1, 0, 0)
(b'MMSystem', b'Bome MIDI Translator 1', 1, 0, 0)
(b'MMSystem', b'Microsoft GS Wavetable Synth', 0, 1, 0)
(b'MMSystem', b'Launchpad Open', 0, 1, 0)
(b'MMSystem', b'MIDIOUT2 (Launchpad Open)', 0, 1, 0)
(b'MMSystem', b'Bome MIDI Translator 1', 0, 1, 0)

I use the old launchpad pro (now renamed to launchpad mk1) and with velocity sensitivity off, so it doesn't send lots of messages, if you have the old pro and want to diagnose the issue, just go to https://fw.mat1jaczyyy.com/ and select the launchpad pro (CFW) option and flash to your launchpad. After that in setup of your launchpad you can switch between programmer and performance mode (new red mode, top left).

If you need more info, please reply and I'm happy to provide it :)

YarosMallorca commented 4 years ago

@FMMT666 Have you tried to reproduce/solve the issue? My new app is relying on your module, so I am interested to debug this bug asap!

FMMT666 commented 4 years ago

You could modify the appropriate ButtonStateRaw() method to return what the call to self.midi.ReadRaw() returns:

Mod

    def ButtonStateRaw( self ):
        if self.midi.ReadCheck():
            a = self.midi.ReadRaw()
            return [ a[0][0][1] if a[0][0][0] == 144 else a[0][0][1] + 96, True if a[0][0][2] > 0 else False ]
        else:
            return []

into

    def ButtonStateRaw( self ):
        if self.midi.ReadCheck():
            return self.midi.ReadRaw()

and let us know the results ...

FMMT666 commented 4 years ago

The Launchpad Pro, X, ... do not return "Note-Off" messages. They send "Note-On" with a velocity of 0.

You can test what this firmware does with:

lp = launchpad.LaunchpadPro()
lp.Open( 0 )

while(True):
    events = lp.EventRaw()
    if events != []:
        print( events )