FMMT666 / launchpad.py

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

lp.Open() simply will not work #30

Closed ghost closed 6 years ago

ghost commented 6 years ago

(Ubuntu 18.04, launchpad.py version 0.8.0, pygame version 1.9.3, alsa version k4.15.0-22-generic) I have tried numerous methods with no success. I have tried lp.Open(), lp.Open(20), lp.Open(20,"Launchpad Mk2 11"), and lp.Open(20,"Launchpad Mk2 11 MIDI 1"). None of these worked and they all returned False.

I am sufficiently confused. Is there something I'm missing? Output of aconnect -i:

client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'Launchpad MK2 11' [type=kernel,card=1]
    0 'Launchpad MK2 11 MIDI 1'

Output of aseqdump -p 20 after pressing random buttons:

Waiting for data. Press Ctrl+C to end.
Source  Event                  Ch  Data
 20:0   Note on                 0, note 47, velocity 127
 20:0   Note off                0, note 47
 20:0   Note on                 0, note 44, velocity 127
 20:0   Note on                 0, note 34, velocity 127
 20:0   Note off                0, note 44
 20:0   Note off                0, note 34
ghost commented 6 years ago

Also, lp.ListAll() does not print anything.

FMMT666 commented 6 years ago

Is there something I'm missing?

Unfortunately, no :( If lp.ListAll() does not show any devices, it won't work.

The only thing you could try is using Python 2, assuming you're using 3 or vice versa...

This is a known issue. PyGame was compiled against an older Alsa version. I recently had some ideas for a workaround. Will try to set up a VM for some tests...

FMMT666 commented 6 years ago

I tested this with Python 3 pygame-1.9.4-dev from the Git(hub) repository.
Working nice, here.

I added some notes about how to compile PyGame in the README.md.
Can be done in a couple of minutes on an 18.04-LTS system (unless you need a fully-fledged PyGame).

Maybe that's helpful...


Actually I did not try the stock Ubuntu 18.04 PyGame distribution, only my 1.9.4-dev version. Maybe I'll test that later on...

FMMT666 commented 6 years ago

Compiling you own PyGame version will fix this (in almost all cases). Instructions are included in the readme...