fmmt666 / launchpad.py Goto Github PK
View Code? Open in Web Editor NEWNovation Launchpad (and Midi Fighter) control suite for Python
License: Other
Novation Launchpad (and Midi Fighter) control suite for Python
License: Other
Hi !
I'm trying to use your library on ArchLinux.
I tried to run this small script :
import sys
try:
import launchpad_py as launchpad
except ImportError:
try:
import launchpad
except ImportError:
sys.exit("error loading launchpad.py")
import random
from pygame import time
lp = launchpad.Launchpad()
print(lp.ListAll())
And it return :
None
Exception AttributeError: "'NoneType' object has no attribute 'quit'" in <bound method __Midi.__del__ of <launchpad_py.launchpad.__Midi instance at 0x7fceab077908>> ignored
I've added the default sequencer in my alsaconf.
I see my Launchpad with aconnect and I also see data when I press a key running aseqdump -p ##
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 Mini' [type=kernel,card=1]
0 'Launchpad Mini MIDI 1'
aseqdump -p 20
Waiting for data. Press Ctrl+C to end.
Source Event Ch Data
20:0 Note on 0, note 51, velocity 127
20:0 Note off 0, note 51
20:0 Note on 0, note 65, velocity 127
20:0 Note off 0, note 65
20:0 Note on 0, note 50, velocity 127
20:0 Note off 0, note 50
Do you have any idea ?
Thank you !
Great job with the library! I know you did this on your free time, are you open to some refactoring? It would make a lot easier to incorporate new features if it was modularized a bit. Currently it's one mega README file and one mega Python script.
Can someone tell me what I'm doing wrong?
ALSA lib conf.c:3009:(snd_config_update_r) Cannot access file /etc/alsa/alsa.conf
ALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default
Did not find any Launchpads, meh...
Exception AttributeError: "'NoneType' object has no attribute 'quit'" in <bound method __Midi.del of <launchpad_py.launchpad.__Midi instance at 0x7fa29dcd9128>> ignored
Hi,
When I do :
import launchpad_py as launchpad
lp = launchpad.LaunchControlXL()
I get :
Traceback (most recent call last):
File "<bpython-input-3>", line 2, in <module>
lp = launchpad.LaunchControlXL()
AttributeError: 'module' object has no attribute 'LaunchControlXL'
I just updated to master and tried to run the examples/hello, and it looks like it's not working any more on my LP2.
It used to flash crazy colors, now there's nothing and it ends with this:
Traceback (most recent call last):
File "examples/hello.py", line 97, in <module>
main()
File "examples/hello.py", line 92, in main
lp.Reset() # turn all LEDs off
AttributeError: 'LaunchpadMk2' object has no attribute 'Reset'
Exception Exception: Exception("PortMidi: `Bad pointer'",) in <pypm.Input object at 0x1056cd4b8> ignored
Exception Exception: Exception("PortMidi: `Bad pointer'",) in <pypm.Output object at 0x1056cd468> ignored
Exception AttributeError: "'NoneType' object has no attribute 'quit'" in <bound method __Midi.__del__ of <launchpad_py.launchpad.__Midi instance at 0x1050bd5f0>> ignored
Any thoughts?
I just got a reduced price Launchpad Mini Mk2 pad that is not recognized. But it works perfectly by just banging bytes to/from /dev/dmmidi device. So I have full control of the buttons, the leds (just 2 bits per led. Red and green led only)
If you want me to try some special commands for getting the pad to identify properly I can do it.
My OS is Ubuntu 18.04
information.py
seems to run just fine, but hello.py
doesn't:
C:\Work\launchpad.py\examples>python hello.py
pygame 2.0.1 (SDL 2.0.14, Python 3.9.1)
Hello from the pygame community. https://www.pygame.org/contribute.html
<module 'launchpad_py' from 'C:\\Python\\lib\\site-packages\\launchpad_py\\__init__.py'>
Traceback (most recent call last):
File "C:\Work\launchpad.py\examples\hello.py", line 167, in <module>
main()
File "C:\Work\launchpad.py\examples\hello.py", line 38, in main
elif launchpad.LaunchpadProMk3().Check( 0 ):
AttributeError: module 'launchpad_py' has no attribute 'LaunchpadProMk3'
Thanks again for this library!
I am trying to work out how to use LedCtrlRawRapid
. First time it's fine, but I need to resync send the next frame.
The user guide says this about Rapid LED update:
To leave the mode, send a standard messsage beginning with 80h, 90h, or B0h. Sending another kind of message and then re-sending 92h will reset the cursor to the top left of the grid.
Your library's Reset
(0xB0 0x00 0x00
) works, but it blanks the whole frame, which looks bad. I can't find a better "empty" command that starts with 0x80
0x90
or 0xb0
.
lp.LedCtrlXY(0, 0, 0,0)
works, but it makes one pixel flash. Any better ideas?
I just bought a used Launchpad that I was hoping to use with this package and so far launchpad.py won't detect it.
When I run hello.py I get "Did not find any Launchpads, meh..."
I'm using Windows 7 with Python 2.7. The Launchpad driver is installed and the Launchpad works with the Automap program (it lights up and shows button presses on screen).
I'm not sure what model my Launchpad is, the model number on the back is NOVLPD01. Any idea which model I should choose in this package? And if this model is supported?
Thanks for any help!
OK, this is probably a silly question, but is there a way to avoid the need for root on Linux systems? My device isn't detected unless I run with sudo...
I added the following udev rule, but no luck:
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="1235", ATTRS{idProduct}=="0036", MODE="660", GROUP="plugdev"
This is a Launchpad Mini Mk2
Several users of my program which uses launchpad.py have reported their Launchpad Classic being detected as a Pro, thereby causing major issues. This only appears to happen to some Launchpads.
Here is a picture of one of the offending devices
Here is the sticker on the back
And here is a test program which encapsulates the Launchpad detection code in my program:
try:
import launchpad_py as launchpad
except ImportError:
try:
import launchpad
except ImportError:
sys.exit("[LPHK] Error loading launchpad.py")
lp = launchpad.Launchpad()
if lp.Check( 0, "mk2" ):
lp = launchpad.LaunchpadMk2()
if lp.Open( 0, "mk2" ):
print('Connected to MkII! Yay!')
else:
raise Exception('MkII detected, but connection failed!')
elif lp.Check( 0, "pro" ):
lp = launchpad.LaunchpadPro()
if lp.Open( 0, "pro" ):
print('Connected to Pro! Yay!')
else:
raise Exception('Pro detected, but connection failed!')
elif lp.Check( 0, "control xl" ) or lp.Check( 0, "launchkey" ) or lp.Check( 0, "dicer" ):
raise Exception('Unsupported device detected!')
elif lp.Check():
if lp.Open():
print('Connected to Classic/Mini/S! Yay!')
else:
raise Exception('Classic/Mini/S detected, but connection failed!')
else:
raise Exception('Launchpad appears to be unplugged!')
input("Press Enter to exit...")
This returns "Connected to Pro! Yay!" in the situations described above.
While I personally do not own a device that is incorrectly detected, I have a user on Discord who does and is eager to provide any additional info that may help you resolve this issue. Thank you for your hard work on this fantastic project!
Launchpad pro-mk1 and launchpad-mk2 work fine, but the Launchpad X behaves very slow and laggy. Have you tested the issue yet?
pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.mpkg
python-2.7.10-macosx10.6.pkg
$ arch -32 python launchpad_demo.py
unable to initialize MIDI
Exception AttributeError: "'module' object has no attribute 'quit'" in <bound method __Midi.del of <launchpad.__Midi instance at 0x1703918>> ignored
Traceback (most recent call last):
File "launchpad_demo.py", line 49, in
main()
File "launchpad_demo.py", line 20, in main
LP.Open() # start it
File "/Users/sebastian/Downloads/launchpad.py-master/launchpad.py", line 368, in Open
self.idOut = self.midi.SearchDevice( name, True, False, number = number )
File "/Users/sebastian/Downloads/launchpad.py-master/launchpad.py", line 139, in getattr
return getattr( self.instanceMidi, name )
AttributeError: 'NoneType' object has no attribute 'SearchDevice'
Hi !
I have a problem with the library on Linux.
I ran the example script "hello.py", in the folder "examples", to see if the communication between the launchpad and the library worked, but it seems to not recognize my launchpad mini.
I get this error : Exception AttributeError: "'NoneType' object has no attribute 'quit'" in <bound method __Midi.del of <launchpad_py.launchpad.__Midi instance at 0x7fb062d2dc68>> ignored
I also installed Linux's drivers for the launchpad, but it doesn't work yet.
I am using "Elementary OS" version 0.4.1, kernel's version is 4.4.0.
Thanks for the support!
Hey,
I'm using a PC with Windows 7, Pyhton 2 and pygame 1.9.1. And ofc Launchpad S
I only tried to Open():
lp = launchpad.Launchpad()
lp.ListAll()
lp.Open()
Console:
('MMSystem', 'Microsoft MIDI Mapper', 0, 1, 0)
('MMSystem', 'Launchpad S', 1, 0, 0)
('MMSystem', 'Microsoft GS Wavetable Synth', 0, 1, 0)
('MMSystem', 'Launchpad S', 0, 1, 0)
Exception Exception: "PortMidi: `Bad pointer'" in <pypm.Input object at 0x020EC2D8> ignored
Exception Exception: "PortMidi: `Bad pointer'" in <pypm.Output object at 0x020EC2A8> ignored
Exception AttributeError: "'NoneType' object has no attribute 'quit'" in <bound method __Midi.__del__ of <launchpad.__Midi instance at 0x02111120>> ignored
I cannot seem to find any answer on my problem. The only times someone wrote about this problem here, the reason was MacOS or Windows 10. This time it seems to be Windows 7.
Can anyone help me?
Edit: I also got this excpetion, when I specified some parameters.
I have the launchpad pro with mat1jaczyyy's custom firmware, and when I do ButtonStateXY it only returns note on messages, not off ones.
Hey @FMMT666 - thanks for your awesome project! Just made my Christmas present even cooler by making it hackable! :-D
It'd be great if you could add a setup.py
file to this repo and publish it to PyPi so I can use it as a library without having to vendor your work into my project directory! Then I could just pip install launchpad
(or whatever you call it) and just import in my projects.
Thanks very much!
Rich
I am getting one Behringer Cmd Touch Tc64 and i wasn't sure if this tool would work with it. You should take a look, it's pretty much the same thing as LS: http://www.behringer.com/EN/Products/CMD-TOUCH-TC64.aspx
Hey I just started with LaunchpadPy and my MK2 but an exception appeared:
Traceback (most recent call last):
File "C:/Users/bobmy/OneDrive/Desktop/pp/โ Other/LaunchpadPygame/Main.py", line 4, in <module>
lp.LedAllOn(colorcode=0xffffff)
File "C:\Users\bobmy\AppData\Local\Programs\Python\Python37\lib\site-packages\launchpad_py\launchpad.py", line 1289, in LedAllOn
self.midi.RawWriteSysEx( [ 0, 32, 41, 2, 24, 14, colorcode ] )
File "C:\Users\bobmy\AppData\Local\Programs\Python\Python37\lib\site-packages\launchpad_py\launchpad.py", line 167, in RawWriteSysEx
self.devOut.write_sys_ex( timeStamp, array.array('B', [0xf0] + lstMessage + [0xf7] ).tostring() )
AttributeError: 'NoneType' object has no attribute 'write_sys_ex'
Process finished with exit code 1`
I just tested some methods like
import launchpad_py
lp = launchpad_py.LaunchpadMk2()
lp.ButtonFlush()
or
import launchpad_py
lp = launchpad_py.LaunchpadMk2()
lp.LedAllOn()
But the same error appears and appears with the "NoneType" object
Hope u can help me
Greets and sorry for my bad english skills
Thanks for this library, it's excellent and mostly works on a Raspberry Pi. To start with the LED control is responsive.
But, after a while (a few minutes) the LEDs slow down and eventually stop changing. Like I could issue a LedCtrlRawRapid
to fill the pad, but it takes a few seconds before displaying. It seems like when I sent a lot of messages without pausing between them it makes it worse. I see no error messages. The Python code doesn't hang.
I don't know if this is to do with a buffer getting full, PyGame MIDI on Raspberry Pi or what. I can't see any secret flush methods I could call.
The example seems to run fine.
Any ideas?
Hi,
New Launchpad Mini MK3 and Launchpad X use values between 0 and 127 for RGB led control. Internally it's still have 6-bit resolution but ignores bit zero from incoming RGB data. I want to contribute this project for MK3 and LPX support but I don't want to make a decision. For backward compatibility we can continue to use values between 0-63 and shift color data 1 bit left just before sending RGB data or we can expect a color values between 0-127.
Thanks for this awesome project.
I've downloaded the "Hello.py" example, everything works great but when I try to get input from Launchpad, all I get in output is "[]". Is there any example on how to use it properly?
Any chance of adding support for Novation Launch Control
My script crashes if i use pygame.mixer and launchpad at the same time. The crash occures when the fadeout of the Sound object finishes with:
Fatal Python error: PyEval_SaveThread: NULL tstate
Using Launchpad mk2 on ubuntu 18.04.
Python version is 3.6.8 and pygame version is 1.9.6
Hi!
Thanks for a great library.
So I've been hacking together a version of Samplerbox that implements a Launchpad95-like scale mode using launchpad.py for the launchpad portion of the code: https://github.com/dhilowitz/SamplerBox/tree/feature/launchpad-support. The only hitch I've run into is that when I plug the Launchpad in after the start of the script, it seems that lp.Check()
and lp.ListAll()
doesn't see it. It's almost as if the ports that launchpad.py
can see are completely static and no new MIDI ports can be found once the script is started. Am I doing something wrong?
Thanks!
.
Hey
First i want to say that i love this project, and have been looking for something like this for a while.
Next: When using ButtonStateXY and pressing a button, the code program returns []
Example:
if lp.ButtonStateXY() != []:
print(lp.ButtonStateXY()
This code returns: []
Hi,
I'd like to use this in a project using python 3. Is there any chance you can convert it?
Hey there. I'm trying to get this working on Windows 10 (x64). I've got Pygame 1.9.1, Python 2.7.
MIDI controller is set using
lp = launchpad.LaunchpadPro()
a = lp.Open(0, "Pro")
The demo random lights doesn't work, however pressing buttons does output the correct response for lp.ButtonStateRaw()
[33, 70]
[33, 0]
[33, 45]
[33, 0]
[34, 38]
[33, 29]
[34, 0]
[33, 0]
I've read that the Launchkey MK2 should be possible to support (Programmers Reference Guide).
However, I recently aquired a Launchkey Mini (new to the game) but my brief attempts in trying to send midi commands to the Launchpad Mini have been fruitless.
Since I assume you have a lot better familiarity with the hardware: Would it be possible to implement support for the Launchkey and if so how? (not asking for an actual implementation, I could do that myself if only I could get it to respond to midi commands)
Hi,
I have been trying to work with my launchpad pro using this library and the problem is that when I use the stock firmware, it works fine, but when I run the custom firmware it just stops working.
Here is the firmware by mat1jaczyyy that I use: https://github.com/mat1jaczyyy/lpp-performance-cfw
Can you please add the compatibility with that firmware? I request it because 60% of the lanchpadders use this firmware.
Thanks!
I have a MkII. I usually use Launchpad95 for Ableton , and it is able to send alternate MIDI messages to the launchpad, in order to make a certain led solid, blink, or strobe to the BPM set over MIDI.
That control script is Python, written for the Ableton scripting engine. It seems that sending the color code to channel 0 is for Solid, channel 1 is for Blink, and channel 2 is for Pulse.
Is there a builtin way to change the channel I send a color code to? If not, I may have some questions so I can try and add the feature myself. :)
launchpad.py is awesome! Unfortunately, publishing scripts that build on top of it is difficult since users would basically have to clone this repo, and copy the dependent scripts into the launchpad.py
directory (unless I fork & bundle it).
Making the module importable isn't as simple as adding __init__.py
though, as the name launchpad.py
is not importable due to the dot in it.
I won't ask that you rename the project, but I did want to point this issue out :)
Hi,
Can I use this in an MIT-licenced project?
EDIT: It's CC BY 4.0, so I can use it if I give credit? Awesome, you can close this now.
I really love your module but it was very hard to install on Windows 10 (for me) I installed and uninstalled python like x100 times. But I found a really easy installation process. I have the IDE Pycharm and with it you can directly install your package. Go to "file/settings/Project:yourProjectname" then select Python2.x and click on the green + sign. Then search for launchpad_py and click install. It automatically installs itself. Then search for Pygame and also install it. DONE !!! about 10min max.
Hope I could help...
Thank you Devs
Launchpad Pro is coming out in spring will the code be updated to support the new RGB LEDs?
The documentation reads that launchpad.py won't work on OS X because of pygame, but I wanted to let you know that I've successfully tested a Launchpad MK1 on OS X 10.12 "Sierra" using pygame==1.9.2a0. I just needed to grab the drivers from Novation first to make it show up as a MIDI device.
I don't see specific references to the Launchpad Mk3 mini. Is it supported? If not, is that planned?
Hey, I've started adapting your code to work on a Raspberry Pi and added a few pieces that let me play wav samples by hitting the pads. I'm running into problems though... specifically the program will break if I play too many pads simultaneously (giving me an "x doesn't have y" attribute error).
Is this something you've played with at all/ can you give me any tips on how to achieve something more like what Marc Resibois has done? (https://www.youtube.com/watch?v=hRomgKe1OsM). You obviously know more about MIDI and Pygame than I do so any help is much appreciated!
First of all, great library!
I've got a Launchkey Mini and discovered in your code, you don't have a way of controlled the LEDs.
I found myself a way to do this, but it's not as easy as just sending a Note On message. You first have to send an InControl message (0x90, 0x0c, 0x7f) and then you can send Note On messages the normal way to turn on the LEDs. And if it still doesn't work, you might want to make sure that the second output port is selected for the midi device (don't know why).
Hope you can implement this.
(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
attempted to use it with the LPHK software, the mini MK3 was able to be color flushed and colors put on the pads, but no actions can be performed by the launchpad, any ideas as to what to do?
Hey there FMMT666, thank you again for adding the blink and pulse commands, I have really enjoyed using them. Is it possible to add commands to do the same, but with RGB?
Thank you,
Ella Jameson
I'm trying to run one of the scripts but it says
Python 2.7.9
PyGame 1.9.2pre
Launchpad Pro: ERROR
I updated my LP drivers but still nothing.
The demo's LP.LedCtrlString( 'HELLO ', 0, 3, -1 ) # scroll "HELLO" from right to left
causes non-text to flash and scroll across. Look like just the button mapping is different.
I am interested in this project, but don't have previous experience with this type of musical creation, and do not have a lot of room in the budget for new equipment.
There is a similar piece of hardware to the launchpad called the BEHRINGER CMD TOUCH TC64 Controller, which can be purchased on ebay for ~60% of the launchpad mini. It also seems to have some sort of "launchpad compatibility mode". I was wondering if anyone had an idea if this would likely work with that piece of hardware as well, or could be made to work with it? I understand Linux and USB protocols well, but am mostly unfamiliar with MIDI, so I might be able to help a little, but am not sure I could add support for myself.
Hello FMMT666,
First, thank you for the great "launchpad.py" project.
while working on one of my project I used your "launchpad.py" project and I was need to add a support for the built-in lightshow demo function in my LaunchKey 61 keyboard.
I was thought about adding a lightshow demo support for the LaunchKey using "LedSetLightshow()" function for example.
The main process to achieve this is by switch the LaunchKey 61 to "Basic Mode" by sending the following midi message:
# channel: 159 (send all midi messages to channel 16); note: 12; velocity: 0
basic_mode = (159, 12, 0)
Then, map the LaunchKey 61 pad midi notes:
# LaunchKey pad mapping (104, 105: round buttons)
color_pad = [36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 104, 105]
And implement a loop which sends a messages to the LaunchKey 61 keyboard:
# channel: 159; note: random.choice(color_pad); velocity: random.randint(1, 127)
msg = (159, random.choice(color_pad), random.randint(1, 127))
To clear the pad light there are two options:
switch to "Extended Mode":
extended_mode = (159, 12, 1)
send "0" to all LaunchKey pad notes:
msg = (159, <pad_note>, 0)
Since I'm not going to create another project for this "feature" :-) I think it can be helpful if you will add this functionality also to the projects.
Thanks again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.