{ "info": { "author": "Eduardo Avelar", "author_email": "eavelardev@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# novation-launchpad\nA Python library for launchpad mini, mk2 and pro devices with examples.\n\nThis library is based on the wonderful [launchpad.py][20] library by FMMT666. The only difference between this library and the other version is that this one uses [python-rtmidi][21] instead of PyGame.\n\nIt is also based on [launchpad_rtmidi.py][22] library by dhilowitz. The differences between this library and the other version is that this one uses callback function instead of poll for read data and support Python 3.\n\nTested on Launchpad Mk2 device.\n\n## Install\n\n```\npip install -U novation-launchpad\n```\n\nor clone de repo and install with\n\n```\npip install -e .\n```\n\n## Use\n\nShow the [exmaples](https://github.com/eavelardev/novation-launchpad/tree/master/examples) folder.\n\n* Use the Launchpad like a Piano\n* Show 8x8 rgb images\n* Get the firmware version\n* Create a fake Launchpad MIDI ports\n\nI don't pretend update the repo, It is a simple project that I made playing with my Launchpad and I just decided to share it ;), but pull requests are welcome.\n\nI add the content of the original README file for more information.\n\nlaunchpad.py\n============\n\nA [Novation Launchpad][1] control suite for [Python][2].\n\nIf you ever dreamed of using your Launchpad for completely other stuff than music: Welcome !-)\n\nCompatible with most [tm] single board computers.\n\nWatch a 6s video [here][7]. \nOr take a look at [that one][8]. \nWhat about the brand new Launchpad Pro support? [Right][9]!\n\nHey - and the Mac? Yep, that finally works too. [Look][12] \\o/ \n\nUpcoming attraction: [Launch Control XL][15].\n\nOh, don't let us forget the [Dicer][16].\n\nOlder Launchpads might be documented [here][10].\n\nDid we mention [Python 3][18] yet?\n\n\n---\n## STATUS 2018/10/xx:\n\nWhat's hot, what's not? \n\n### Devices\n\n Launchpad Mk1 - class \"Launchpad()\" LEDs and buttons\n Launchpad/S - class \"Launchpad()\" LEDs and buttons\n Launchpad Mini - class \"Launchpad()\" LEDs and buttons\n\n Launchpad Mk2 - class \"LaunchpadMk2()\" LEDs and buttons\n\n Launchpad Pro - class \"LaunchpadPro()\" LEDs and buttons (digitally only (yet))\n\n Launch Control XL - class \"LaunchControlXL()\" LEDs, buttons and potentiometers\n\n LaunchKey (Mini) - class \"LaunchKeyMini()\" Buttons, keys and potentiometers (sliders for big KBs), no LEDs\n\n Dicer - class \"Dicer()\" LEDs and buttons\n\n\n### Python\n\nNow with Python 3 support \\o/\n\n\n### OS\n\nNow full functionality also on Windows 10 and macOS based systems. \nSuccessfully tested with Ubuntu 18.04-LTS+. Requires compiling your own PyGame though (which is actually very easy; see below...).\n\n\n---\n## NEWS\n\n\n### CHANGES 2018/10/XX:\n\n - added PRO/Mk2 LedCtrlPulseByCode(), pulse LEDs by color code (RGB not supported)\n - added PRO/Mk2 LedCtrlFlashByCode(), LED dual color flash by color codes (RGB not supported)\n - added PRO/Mk2 LedCtrlBpm(), set pulsing/flashing rate\n - updated PyGame compilation instructions\n - added PRO/MK2 LedCtrlPulseXYByCode(), pulse LEDs by color code and X/Y position\n - added PRO/MK2 LedCtrlFlashXYByCode(), flash LEDs by color code and X/Y position\n - added PRO/MK2 flashing/pulsing example file\n - changed version and tag to v0.8.1\n - uploaded v0.8.1 to PyPI \\o\\\\o//o/\n\n### CHANGES 2018/06/XX:\n\n - added notes on how to compile your own PyGame (trouble solving)\n\n### CHANGES 2018/02/XX:\n\n - added experimental (aka \"seems quite good\") support for Python 3\n - added Pro example/test file \"launchpad_pro.py\"\n - improving the doc, letter by letter\n - added Mk2 example/test file \"launchpad_mk2.py\"\n - removed the \"Python 2 only\" restriction from the setup file\n - changed the imports in __init__.py to work with Python 3\n - launchpad_py now ready for installations on Python 2 and 3\n - updated \"launchpad_pro.py\" example/test; LedCtrlChar() positioning\n - changed version and tag to v0.8.0\n - uploaded v0.8.0 to PyPI \\o\\\\o//o/\n - added \"launchpad_pro-fire.py\" example; just a simple fire animation\n\n### CHANGES 2017/09/XX:\n\n - added notes for Ubuntu 17.04 systems and /etc/alsa/alsa.conf issues\n - added experimental 'Bad Pointer' fix upon exiting (needs more testing (w/ multiple LPads))\n\n### CHANGES 2017/08/XX:\n\n - changed DCR; renamed InputStateRaw() to ButtonStateRaw()\n - added DCR LedCtrlRaw()\n - added DCR Reset()\n - added DCR LedAllOff()\n - added DCR \"shift-lock\" support (holding down mode buttons for additional 3*5 button events (per Dicer)\n - added DCR ModeSet()\n - added DCR \"one page mode\" support for buttons and LEDs\n - added DCR support in hello.py demo\n\n### CHANGES 2017/07/29:\n\n - added a class for the Dicer\n - added DCR InputStateRaw() with coolest button mapping ever <3\n - added DCR LedSetLightShow()\n\n### CHANGES 2017/06/XX:\n\n - added support for the Launch Control XL pad\n - added XL LedCtrlXY()\n - added XL ButtonStateRaw(), later renamed to InputStateRaw()\n - added XL TemplateSet()\n - added XL potentiometer support (via InputStateRaw())\n - added XL InputChanged()\n - added XL InputFlush()\n - added XL docs\n - updated \"hello.py\" example to work with Control XL\n - added EventRaw() for all devices\n - added preliminary support for the LaunchKey (Mini)\n - changed XL InputStateRaw(); added 3rd \"velocity\" field [, , ]\n - changed LaunchKey device search name from \"Launchkey Mini\" to just \"Launchkey\"\n - added LKM InputFlush() and InputChanged() for LaunchKey(Mini)\n - added LKM docs\n - added LKM to the hello.py test file\n\n### CHANGES 2017/04/30:\n\n - launchpad.py is now available via PyPI, the Python Package Index.\n\n### CHANGES 2017/04/09:\n\n - Windows 10 and macOS SysEx issues are fixed \\o\\ \\o/ /o/\n\n### CHANGES 2017/01/XX:\n\n - launchpad.py is now available as an [optionally] installable package;\n - fixed unintentional installs under Python 3 dist-packages\n - added ButtonFlush() method to empty the button buffer\n - added Pro LedAllOn() and Mk2 Reset()\n - added macOS notes\n - some minor tweaks for the Mk2\n\n### CHANGES 2016/12/XX:\n\n - added \"fireworks demo\" note (device not recognized)\n - reworked string scrolling for Mk1 and Mk2 Launchpads:\n - characters now adjacent\n - no artifacts left on screen (right to left scrolling)\n - scrolling from left to right still has some issues (\"quick hack drawback\" :)\n - implemented same scrolling behaviour for the Pro Launchpad\n - Mk2 LedCtrlXY() now does nothing if x/y are out of range (were clamped to 0 or 8 before)\n - Mk2 LedCtrlXYByCode() now also exits if x/y values are out of range\n - added LedCtrlXYByRGB() for Mk2/Pro; pass color arguments as list [r,g,b]\n - tried to clarify \"Mk1\" color and x/y origin mode for Pro pads in the doc\n - added ButtonStateXY() for Mk2 and Pro\n - device name search patterns now are case insensitive\n\n### CHANGES 2016/11/XX:\n\n - added notes about how to use it on macOS\n\n### CHANGES 2016/01/XX:\n\n - Support for Launchpad Pro now built in (only a few functions, so far).\n Please notice the new class for the Pro:\n lp_pro = LaunchpadPro()\n Except for a few, low level functions (e.g. \"LedCtrlRaw()\"), this and\n probably all future classes will remain compatible to the good, old\n \"Classic\" Launchpad (Mk1).\n - added method Check(); Checks whether a device is attached.\n - added demo code for Pro (including automatic device recognition)\n - added Pro RGB LED control\n - added Pro X/Y LED control for RGB and color code mode\n - added Pro character display incl. left/right shift\n - added Pro string scrolling\n - Support for Launchpad Mk2 now built in\n Please notice the new class for the Mk2:\n lp_pro = LaunchpadMk2()\n - classes for \"Pro\" and \"Mk2\" now with default names for Open() and Check();\n - \"Pro\" now automatically put in \"Ableton Live mode\" after opening it.\n No need to push \"Setup - Live\" button anymore.\n - added Mk2 LedCtrlRawByCode() and LedCtrlXYByCode()\n - added Pro ButtonStateRaw(); first *damn fast* button reads \\o/\n\n### CHANGES 2016/01/10:\n\n - The current version does not work with Mac OS X.\n Regarding that, as well as the fact that PyGame somehow reached its\n end of life, I am currently looking for other Midi libraries or implementations.\n - I bought a Launchpad Pro. Time to implement this, although I am not sure\n what will come first, building a new Midi system or implementing the Pro.\n\n### CHANGES 2015/02/21:\n\n - Support for multiple Launchpads now finally built in. Use 'em all:\n lp1 = launchpad.Launchpad()\n lp2 = launchpad.Launchpad()\n lp1.Open(0)\n lp2.Open(1)\n\n### CHANGES 2015/02/18:\n\n - Added option to select a Launchpad if more than one is attached.\n Also supports search for a device string, e.g. \"Mini\".\n - Added optional parameters and to Open()\n\n\n---\n## Upcoming attractions, notes and thoughts\n\n - \"All\": either remove or add the (non-) optional \\ argument to all methods\n - \"All\": RGB to color code approximation (for flash/pulse and color code methods)\n - \"DCR\": query mode\n - \"CXL\": x/y support (if it makes sense...)\n - \"All\": LedCtrlChar() make y-offset work\n - \"Pro\": change ButtonStateXY() to return True/False + velocity, as in the LaunchKeyMini\n - \"Pro\": remove the \"Mk1\" compatibility from the \"Pro\" functions (blue LEDs and intensity values)\n - \"All\": [r,g,b] lists for colors, instead of single args (might affect compatibility)\n - \"Pro\": implement native text scrolling\n - \"Pro\": support full analog reads (button already pressed, but intensity changes)\n - \"Doc\": split installation and usage (and condense that a little)\n - \"All\": fix manual text scrolling\n - \"All\": replace MIDI cmd numbers with sth human readable (144->Note On; 176->Control Change, etc...)\n - \"All\": custom bitmaps and graphics\n - \"All\": event system\n - \"All\": better custom font support\n - \"All\": [r,g,b] lists for colors, instead of single args (might affect compatibility)\n - ...\n\n\n---\n## Installation/Usage\n\n### Install as Python package\n\n#### Via pip from PyPI\n\nPlease notice that the PyPI version is not always up to date! \nSimply execute\n\n pip install launchpad_py\n\nor\n\n sudo pip install launchpad_py\n\n(in case you need superuser rights) to install it. \nNotice that the required dependencies (see below) are not automatically resolved and you need to install PyGame separately.\n\nAlso make sure that you're using the right \"pip\", matching your Python 2 or 3 preference. \nCheck with\n\n pip --version\n\nWhich should bring up somewthing like:\n\n pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)\n\nFor explicitly installing this in an Python 3 environment, use\n\n pip3 install launchpad_py\n\n\n#### From local file system\n\nIf you downloaded the Launchpad.py source package, simply execute the command\n\n python setup.py install\n\nfrom the base directory or \n\n sudo python setup.py install\n\nif superuser access is required.\n\nLoad and use the module with\n\n import launchpad_py\n ...\n ...\n # Mk1 Launchpad:\n lp = launchpad_py.Launchpad()\n # Mk2 Launchpad:\n lp = launchpad_py.LaunchpadMk2()\n # Pro Launchpad:\n lp = launchpad_py.LaunchpadPro()\n # Control XL:\n lp = launchpad_py.LaunchControlXL()\n # LaunchKey Mini:\n lp = launchpad_py.LaunchKeyMini()\n # Dicer:\n lp = launchpad_py.Dicer()\n\nor if you dislike typing that much, use\n\n import launchpad_py as lppy\n ...\n ...\n lp = lppy.Launchpad()\n lp = lppy.LaunchpadMk2()\n lp = lppy.LaunchpadPro()\n lp = lppy.LaunchControlXL()\n lp = lppy.LaunchKeyMini()\n lp = lppy.Dicer()\n\nFor compatibility with existing code, use\n\n import launchpad_py as launchpad\n\n\n#### Install directly from Github\n\nInstead of downloading the source distribution, you can directly install it from Github\nby executing\n\n pip install git+https://github.com/FMMT666/launchpad.py\n\n\n#### Via your system's package manager, e.g. on Raspbian\n\n ATTENTION Raspberry Pi Raspbian user. This is for you!\n\nSome Linux distributions come with their own PyGame package. \nCheck your manual :)\n\nWith \"apt\", for example, you could either try\n\n apt search pygame\n\nor\n\n apt-cache search pygame\n apt-cache search pygame | grep pygame\n\nMake sure to install the right PyGame version, matching your Python 2 or 3 prefewrence. \nSample output from a Raspbian Jesse:\n\n python-pygame - SDL bindings for games development in Python (Python 2)\n python3-pygame - SDL bindings for games development in Python (Python 3)\n\nAn Ubuntu 17.0.1, which comes with Python 3 as default, outputs\n\n python-pygame - SDL bindings for games development in Python\n python-pygame-sdl2 - reimplementation of the Pygame API using SDL2\n\nbut this is only a Python 2 installation of PyGame.\n\n\n### Direct usage\n\nIf you don't want to or cannot install the package on your system, simply\ncopy the two files\n\n launchpad.py\n charset.py\n\nto your working directory. \nUse those files as described above, but without the \"_py\":\n\n import launchpad\n ...\n ...\n # Mk1 Launchpad:\n lp = launchpad.Launchpad()\n ...\n\nor\n\n import launchpad as LP\n ...\n ...\n lp = LP.Launchpad()\n ...\n\n### Universal loading template code\n\n#### Checks for an installed version first, loads local one as the last resort\n\n import sys\n\n try:\n import launchpad_py as launchpad\n except ImportError:\n try:\n import launchpad\n except ImportError:\n sys.exit(\"error loading lauchpad.py\")\n\n#### Checks for a local version first (file in same folder), uses the installed one secondary\n\n import sys\n\n try:\n import launchpad as launchpad\n except ImportError:\n try:\n import launchpad_py\n except ImportError:\n sys.exit(\"error loading lauchpad.py\")\n\n\n---\n## License\n\n[CC BY 4.0, Attribution 4.0 International][11]\n\nYou are free to:\n\nShare \u2014 copy and redistribute the material in any medium or format \nAdapt \u2014 remix, transform, and build upon the material for any purpose, even commercially.\n\nThe licensor cannot revoke these freedoms as long as you follow the license terms.\n\n\n---\n## Requirements\n\n - [Python][2] 2, 3\n - [Pygame][3] v1.9.1, (v1.9.2), v1.9.3, v1.9.4-XX\n\nSome Pygame versions do not work on some OSes (e.g. v1.9.2 might cause trouble\nwith Windows 7/10). I cannot tell you any more than just \"try!\". \nThe latest fixes (4/2017) were tested with v1.9.3 (via pip from Python 2.7.13)\nand Windows 10 (x64). That seems to work fine again...\n\nAs of 2/2018, launchpad.py comes with Python 3 support. \nTested, so far: \n\n - Windows 10, Python 3.6.4, PyGame 1.9.3 (via pip), MK2 Pad\n - macOS Sierra, Python 3.6 (Macports), PyGame 1.9.3 (via pip), Pro Pad\n - Raspbian Jessy, RPi3, Python 3.4.2, PyGame 1.9.2a0 (via apt), Mini Pad\n\nPython 3 might not (yet and out-of-the-box) work for: \n\n - stock Ubuntu 16.04.3-LTS (requires building PyGame from sources)\n - stock Ubuntu 17.04 (same)\n - stock Ubuntu 17.10 (same)\n - stock Ubuntu 18.04 (workaround available)\n\nSee below for instructions on how to compile PyGame on your own...\n\n\nPreviously, launchpad.py was tested under\n\n - Linux, 32 bit, 64 bit\n - Windows XP, 32 bit\n - Windows 7, 32 bit, 64 bit\n - Windows 10, 64 bit\n - macOS Sierra\n - [Raspberry-Pi 1/2/3][4]\n - Beagle Bone (Black)\n - Banana Pi (Pro/M2/R1)\n - pcDuino V3\n - ...\n\nSupported and tested red/green LED Launchpad devices, here referred to as \"Classic\" or \"Mk1\":\n\n - Launchpad (the original, old \"Mk1\")\n - Launchpad S\n - Launchpad Mini (Mk1)\n\nSupported and tested full RGB Launchpad devices:\n\n - Launchpad Pro\n - Launchpad Mk2\n\nSupported completely different stuff:\n\n - Launch Control XL\n - LaunchKey (Mini)\n - Dicer\n\nNotice that Novation now (1/2016) sells an RGB Launchpad under the same\nname it once shipped the first red/green LED with!\n\n---\n## Compiling your own PyGame\n\n If you have problems with errors like \"alsa.conf\" or the ListAll() method\n not recognizing any attached Launchpads on newer systems, especially Ubuntu 17/18,\n you might consider compiling your own PyGame version.\n\n This explanation is for Ubuntu 18.04-LTS and Python 3, but it should work [tm] for most other systems too.\n\n Additional package requirements, install them with\n\n sudo apt-get install \n\n I recommend installing these one after another (for easy \"debugging\")\n\n git\n automake\n cmake\n libsdl1.2-dev\n libportmidi-dev\n python3-setuptools\n python3-dev\n ...\n\n### Compile via \"setup.py\"\n\n Find the complete compilation instructions [here][19].\n\n Download the PyGame source code. \n Notice that this will create a sub-folder named \"pygame\":\n\n git clone https://github.com/pygame/pygame\n\n Enter that directory and type\n\n python3 setup.py build\n\n which results in something like:\n\n ...\n No package 'freetype2' found\n WARNING: \"pkg-config freetype2\" failed!\n SDL : found 1.2.15\n FONT : not found\n IMAGE : not found\n MIXER : not found\n PNG : found\n JPEG : not found\n SCRAP : found\n PORTMIDI: found\n PORTTIME: found\n FREETYPE: not found\n\n Warning, some of the pygame dependencies were not found. Pygame can still\n compile and install, but games that depend on those missing dependencies\n will not run. Would you like to continue the configuration? [Y/n]\n\n If you need a fully working PyGame, with all features, I leave it up to you,\n to resolve the remaining \"not found\" issues, but they're not required by Launchpad.py\n\n Make sure PORTMIDI and PORTTIME are marked with \"found\", then continue the build process.\n After a hopfully error-free build, execute (Ubuntu example for superuser access)\n\n sudo python3 setup.py install\n\n After a short time, you now should have PyGame in the default path\n\n /usr/local/lib/python3.6/dist-packages/\n\n ...\n\n\n### Compile via \"configure\" (old)\n\n Newer Python variants come with a fully functional setup.py (see above). \n I just leave the old compiling instructions here...\n\n Download the PyGame source code. \n Notice that this will create a sub-folder named \"pygame\":\n\n git clone https://github.com/pygame/pygame\n\n Enter that directory and type\n\n ./configure\n\n which results in something like:\n\n ...\n No package 'freetype2' found\n WARNING: \"pkg-config freetype2\" failed!\n SDL : found 1.2.15\n FONT : not found\n IMAGE : not found\n MIXER : not found\n PNG : found\n JPEG : not found\n SCRAP : found\n PORTMIDI: found\n PORTTIME: found\n FREETYPE: not found\n\n If you need a fully working PyGame, with all features, I leave it up to you,\n to resolve the remaining \"not found\" issues, but they're not required by Launchpad.py\n\n Next, type\n\n make\n\n to create the build files, followed by a\n\n sudo python3 setup.py install\n\n After a short time, you now should have PyGame in the default path\n\n /usr/local/lib/python3.6/dist-packages/\n\n ...\n\n\n---\n## Random Notes\n\n### Button, value and potentiometer polling\n\n Until now (6/2017), Launchpad.py does not have an event system built in. You need to poll the buttons' or\n potentiometer's values manually. \n Notice that actually nothing will get lost, but every event you create will be buffered (until you run out\n or memory :). If you don't poll the buttons or potentiometers regulary, your might end up with thousands\n of old states and values, blocking the current input. \n Especially rotating a potentiometer or pushing a slider, creates an event for each single value that\n was sampled. This can easily be hundreds of messages in a few seconds.\n\n So either poll regulary or use the ButtonFlush()/InputFlush() method to clear everything.\n\n Also notice that the buffer might be filled right after you started your application...\n\n\n### For Launchpad Mk1 users (the original \"Classic\" Launchpad):\n\n USE CLASS \"Launchpad\":\n\n lp = launchpad.Launchpad()\n\n### For Launchpad Pro users\n\n USE CLASS \"LaunchpadPro\":\n\n lp = launchpad.LaunchpadPro()\n\n As of 2016/01/24, the \"Pro\" is now automatically set to \"Ableton Live mode\",\n which is required for launchpad.py to work.\n\n### For Launchpad Mk2 users\n\n USE CLASS \"LaunchpadMk2\":\n\n lp = launchpad.LaunchpadMk2()\n\n### For Launch Control XL users\n\n USE CLASS \"LaunchControlXL\":\n\n lp = launchpad.LaunchControlXL()\n\n### For LaunchKey (Mini) users\n\nEven it is named \"Mini\", it also supports most of the bigger keyboards' functionalities. \nNotice that some of the button and key numbers collide and cannot be differed.\n\n USE CLASS \"LaunchKeyMini\":\n\n lp = launchpad.LaunchKeyMini()\n\n### For Dicer users\n\n USE CLASS \"Dicer\":\n\n lp = launchpad.Dicer()\n\nThe Dicer uses \"page\" mode by default. The three small buttons \"cue\", \"loop\" and \"auto loop\"\nselect six different pages (per Dicer module) and each of those can be handled independently.\n\nThe first set of the six mode is enabled by simply pushing (and releasing) on of the three mode\nbuttons, the second set, \"shift-mode\" is activated by holding down one of the mode buttons while\npushing a number button.\n\nSo, if the \"cue\" page is active and you try to activate an LED in the \"loop\" page, that\nwill not be visible until you activate that page.\n\n\n### alsa.conf issues\n\nSeveral users reported errors because of a missing alsa.conf file, e.g.:\n\n ALSA lib conf.c:3009:(snd_config_update_r) Cannot access file /etc/alsa/alsa.conf\n ALSA lib seq.c:935:(snd_seq_open_noupdate) Unknown SEQ default\n\nIf /etc/alsa/alsa.conf does not exist, you can create a symbolic link to where it resides on\nyour system. Find it with:\n\n find /etc /usr -name \"alsa.conf\"\n\nIf that command can _not_ find \"alsa.conf\" (a common place is /usr/share/alsa/alsa.conf), you\nprobably don't have Alsa installed at all.\n\nIn all other cases, you can create a symbolic link from /etc/alsa/alsa.conf to the real, existing file\n(assuming /usr/share/alsa/alsa.conf here). \nWarning: Double check whether /etc/alsa/alsa.conf _really_ does not exist first!\n\n sudo mkdir /etc/alsa\n sudo ln -s /usr/share/alsa/alsa.conf /etc/alsa/alsa.conf\n\nAfter that, you still might experience that Launchpad.py cannot find any MIDI devices. \nThe output from \"lp.ListAll()\" does not return anything and executing the \"hello.py\" example just shows\nsomething like:\n\n Exception AttributeError: \"'NoneType' object has no attribute 'quit'\" in > ignored\n\nIn this case, the default sequencer entries might be missing in your alsa.conf. \nYou might wish to add this to your alsa.conf:\n\n #\n # Sequencer interface\n #\n\n seq.default {\n type hw\n hint.description \"Added by experts. Source: Internet \\o/\"\n }\n\n seq.hw {\n type hw\n }\n\nThanks to [MartinPaulEve][17] for pointing that out. \nPlease notice that this \"fix\" won't work on all systems. While it does, for example,\nwork with Ubuntu 17.04, the same error usually just indicates that your system was not\nbuilt with a PyGame compatible ALSA (PortMidi) version. \nThere is no easy fix for this (unless you wish to spend a lot of time completely recompiling your system...)\n\n\n### For Mac users\n\n#### Mac Python and Pygame\n\nGood news, everybody. It now works with macOS Sierra \\o/ \nBest part: It even works with the stock \"Apple Python\".\n\nPygame can be installed via \"pip\". Just enter \"pip\" on the console\nto see whether it is installed:\n\n pip\n\nIf it isn't, you can install it with:\n\n sudo easy_install pip\n\nIf pip is working, search for Pygame via pip (console command):\n\n sudo pip search pygame\n\nSomewhere in the list, you should see something like\n\n Pygame (1.9.2b8) - Python Game Development\n\nInstall that with:\n\n sudo pip install pygame\n\n#### Hardware\n\nNotice that the original Launchpad Mk1 requires an USB driver. Thanks, [Stewart!][13]. \nGet it from [here][14] (Novation USB Driver-2.7.dmg).\n\nAs it seems, all newer Launchpads work right out of the box, no driver required.\n\n### For Raspberry Pi users\n\nPlease notice that some the newer RGB LED Launchpads consume more current than a\nRaspberry Pi can deliver. If you turn on a lot of LEDs, the Launchpad will just reset and show the fireworks demo. \nAt least for the Launchpad Pro, you could use an external power supply adapter. For the Mk2, you\nwould need a an \"USB-Y\" cable, with the \"power plug\" connected to an external power supply (or other PC).\n\nAs written somewhere above, at least for Raspbian (Jesse), you should install Raspbian's PyGame version\nvia the package manager or apt. The PyPI version (installation via \"pip\") will not work due to some missing SDL components. \n\nBtw, you can check your Raspbian version with the console command\n\n cat /etc/os-release\n\nWhich outputs something comparable to\n\n PRETTY_NAME=\"Raspbian GNU/Linux 8 (jessie)\"\n NAME=\"Raspbian GNU/Linux\"\n VERSION_ID=\"8\"\n VERSION=\"8 (jessie)\"\n ...\n\n\n### For Windows users\n\n MIDI implementation in PyGame 1.9.2+ is broken and running this might\n bring up an 'insufficient memory' error ( pygame.midi.Input() ).\n\n SOLUTION: use v1.9.1 or try v1.9.3\n\n### For Linux and especially Raspberry-Pi users:\n\n Due to some bugs in PyGame's MIDI implementation, the buttons of the Launchpad Mk1\n won't work after you restarted a program (LEDs are not affected).\n\n WORKAROUND #2: Simply hit one of the AUTOMAP keys (the topmost 8 buttons).\n For whatever reason, this makes the MIDI button events\n appearing again...\n\n WORKAROUND #1: Pull the Launchpad's plug out and restart... (annoying).\n\n### Other Notes\n\n#### Launchpad (Pro) not recognized, playing fireworks demo\n\nJust discovered another oddity...\n\nI attached a Launchpad Pro to my Linux box, as many times before, to finally add the\nbutton methods, but it refused to show up as an USB device. Instead of the \"note mode\",\nindicated by a turquoise/pink colour pattern, it played that \"fireworks animation\" and\ndid nothing...\n\nThe first time I discovered that, I blamed it on an attached FTDI UART chip, but as it\nturned out, that was not the reason it didn't work.\n\nIt simply was a power issue.\n\nSo, if your Launchpad Pro shows that firework demo, check your USB cable! \nSeriously. That thing draws a lot of current and most USB cables simply\ndo not conform to the USB standard (or your USB port isn't, e.g. Raspberry Pi).\n\nOn Linux, you can check that via the console command \"dmesg\". \nIf the output contains hundreds of \"urb status -32\" errors, followed by\n\n ...\n [ 1414.983069] usb 1-1.5: urb status -32\n [ 1414.983232] usb 1-1.5: urb status -32\n [ 1414.983345] usb 1-1.5: urb status -32\n [ 1414.983456] usb 1-1.5: urb status -32\n [ 1414.983495] usb 1-1.5: USB disconnect, device number 8\n [ 1414.983568] usb 1-1.5: urb status -32\n [ 1414.983692] usb 1-1.5: urb status -32\n [ 1415.288539] usb 1-1.5: new full-speed USB device number 9 using dwc_otg\n [ 1415.445968] usb 1-1.5: New USB device found, idVendor=1235, idProduct=0051\n [ 1415.445984] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3\n [ 1415.445992] usb 1-1.5: Product: Launchpad Pro\n [ 1415.446000] usb 1-1.5: Manufacturer: Focusrite A.E. Ltd\n [ 1415.446009] usb 1-1.5: SerialNumber: Launchpad Pro\n ...\n\nMy USB cable \"looked quite good\" from the outside. \nWith its ~5.5mm diameter, I assumed it had AWG 22 (~60mOhm/m) or better, but it in fact\nhas ~drumroll~ AWG 28 (~240mOhm/m) and two thick plastic strings to fill the gaps.\n\nWell, we all know that companies try to save money wherever they can, but that's just\nfraud...\n\nBtw, the fireworks demo will play whenever the Launchpad cannot be enumerated (configured). \n[...]\n\n---\n## Common class methods overview (valid for all devices)\n\n### Device control functions\n\n Open( [name], [number], [template (*1*)] )\n Close()\n Reset()\n ButtonFlush()\n\n (*1*) Control XL only\n\n\n### Utility functions\n\n ListAll()\n EventRaw()\n\n\n---\n## Launchpad Mk1 \"Classic\" class methods overview (valid for green/red LED devices)\n\n### LED functions\n\n LedGetColor( red, green )\n LedCtrlRaw( number, red, green )\n LedCtrlXY( x, y, red, green )\n LedCtrlRawRapid( allLeds )\n LedCtrlAutomap( number, red, green )\n LedAllOn()\n LedCtrlChar( char, red, green, offsx = 0, offsy = 0 )\n LedCtrlString( str, red, green, dir = 0 )\n\n### Button functions\n\n ButtonChanged()\n ButtonStateRaw()\n ButtonStateXY()\n ButtonFlush()\n\n\n---\n## Launchpad \"Mk2\" and \"Pro\" class methods overview (valid for RGB LED devices)\n\n### LED functions\n\n LedSetMode( mode )\n LedGetColorByName( name )\n LedCtrlRaw( number, red, green, [blue] )\n LedCtrlRawByCode( number, [colorcode] )\n LedCtrlPulseByCode( number, colorcode )\n LedCtrlPulseXYByCode( x, y, colorcode )\n LedCtrlFlashByCode( number, colorcode )\n LedCtrlFlashXYByCode( x, y, colorcode )\n LedCtrlBpm( bpm )\n LedCtrlXY( x, y, red, green, [blue] )\n LedCtrlXYByCode( x, y, colorcode )\n LedCtrlXYByRGB( x, y, colorlist )\n LedCtrlChar( char, red, green, [blue], [offsx], [offsy] )\n LedCtrlString( string, red, green, [blue], [direction], [waitms] )\n LedAllOn( [colorcode] )\n\n\n### Button functions\n\n ButtonStateRaw()\n ButtonStateXY()\n ButtonFlush()\n\n\n### Color codes\n\nAll RGB Launchpads have a 128 color palette built-in. \nControlling LEDs with colors from the palette is about three times faster than\nusing the, indeed much more comfortable, RGB notation.\n\nFunctions requiring a color code have a \"...ByCode\" naming style.\n\n![RGB color palette](/images/lppro_colorcodes.png)\n\n\n\n---\n## Launch Control XL class methods overview\n\n*WORK IN PROGESS*\n\n### Device\n TemplateSet( template )\n\n\n### LED functions\n\n LedGetColor( red, green )\n LedCtrlRaw( number, red, gree )\n LedCtrlXY( x, y, red, green )\n LedAllOn( [colorcode] )\n\n\n### Input functions\n\n InputChanged()\n InputFlush()\n InputStateRaw()\n\n\n\n---\n## LaunchKey Mini class methods overview\n\n*WORK IN PROGESS*\n\n### LED functions\n\n TODO\n\n\n### Input functions\n\n InputChanged()\n InputFlush()\n InputStateRaw()\n\n\n---\n## Dicer class methods overview\n\n*WORK IN PROGESS*\n\n### LED functions\n\n LedSetLightshow()\n LedCtrlRaw()\n LedAllOff()\n\n\n### Button functions\n\n ButtonStateRaw()\n\n\n\n---\n## Detailed description of common Launchpad methods\n\n### Open( [number], [name], [template (1)] )\n\n Opens the a Launchpad and initializes it. \n Please notice that some devices have up to six MIDI entries!.\n\n (1) Notice that