Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rainu/launchpad
Go library to make it easy to use the Novation Launchpad (S and MK2)
https://github.com/rainu/launchpad
api launchpad launchpad-api launchpad-mk2 launchpads library midi novation-launchpad
Last synced: about 2 months ago
JSON representation
Go library to make it easy to use the Novation Launchpad (S and MK2)
- Host: GitHub
- URL: https://github.com/rainu/launchpad
- Owner: rainu
- License: mit
- Created: 2020-08-05T14:45:28.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-02T11:35:27.000Z (about 4 years ago)
- Last Synced: 2023-07-27T22:31:35.950Z (over 1 year ago)
- Topics: api, launchpad, launchpad-api, launchpad-mk2, launchpads, library, midi, novation-launchpad
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# launchpad
A package allows you to talk to your Novation Launchpad S or Launchpad MK2 in Go. Light buttons or read your touches.This library is currently only working with Launchpad S (Green-Red Launchpads) and Launchpad MK2 (RGB)
## Usage
Initialize a new Launchpad. If there are no currently connected Launchpad
device, initialization will fail with an error. You can fake a device by
creating an input and output MIDI device and name them as Launchpad.## Drivers
For "cable" communication you need a Driver to connect with the MIDI system of your OS.
Currently there are two multi-platform drivers available:* package ```gitlab.com/gomidi/rtmididrv``` based on rtmidi
* package ```gitlab.com/gomidi/portmididrv``` based on portmidiPortmidi is required to use this package.
```
$ apt-get install libportmidi-dev
# or
$ brew install portmidi
# or
$ yay -S portmidi
``````go
package mainimport (
"github.com/rainu/launchpad"
driver "gitlab.com/gomidi/portmididrv"
"log"
)
func main() {
pad, err := launchpad.NewLaunchpad(driver.New())
if err != nil {
log.Fatalf("Error initializing launchpad: %v", err)
}
defer pad.Close()
// turn off all of the lights
pad.Clear()
}
```### Coordinate system
The coordinate system is illustrated below.
```
+--------- arrow keys -----------+ +--- mode keys ---+
{0, 8} {1, 8} {2, 8} {3, 8} {4, 8} {5, 8} {6, 8} {7, 8} | ableton
----------------------------------------------------------------
----------------------------------------------------------------
{0, 0} {1, 0} {2, 0} {3, 0} {4, 0} {5, 0} {6, 0} {7, 0} | {8, 0} vol
----------------------------------------------------------------
{0, 1} {1, 1} {2, 1} {3, 1} {4, 1} {5, 1} {6, 1} {7, 1} | {8, 1} pan
----------------------------------------------------------------
{0, 2} {1, 2} {2, 2} {3, 2} {4, 2} {5, 2} {6, 2} {7, 2} | {8, 2} sndA
----------------------------------------------------------------
{0, 3} {1, 3} {2, 3} {3, 3} {4, 3} {5, 3} {6, 3} {7, 3} | {8, 3} sndB
----------------------------------------------------------------
{0, 4} {1, 4} {2, 4} {3, 4} {4, 4} {5, 4} {6, 4} {7, 4} | {8, 4} stop
----------------------------------------------------------------
{0, 5} {1, 5} {2, 5} {3, 5} {4, 5} {5, 5} {6, 5} {7, 5} | {8, 5} trk on
----------------------------------------------------------------
{0, 6} {1, 6} {2, 6} {3, 6} {4, 6} {5, 6} {6, 6} {7, 6} | {8, 6} solo
----------------------------------------------------------------
{0, 7} {1, 7} {2, 7} {3, 7} {4, 7} {5, 7} {6, 7} {7, 7} | {8, 7} arm
----------------------------------------------------------------
```## Demo: Light your touchs
A simple program to light every touch:
```go
package mainimport (
"github.com/rainu/launchpad"
driver "gitlab.com/gomidi/portmididrv"
"log"
)
func main() {
pad, err := launchpad.NewLaunchpad(driver.New())
if err != nil {
log.Fatal(err)
}
defer pad.Close()
pad.Clear()
hits, err := pad.ListenToHits()
if err != nil {
log.Fatal(err)
}
for {
select {
case hit := <-hits:
pad.Light(hit.X, hit.Y, launchpad.ColorS{3, 3})
}
}
}
```## Demo: Write a scrolling text
A simple program to write text on the launchpad
```go
package mainimport (
"github.com/rainu/launchpad"
driver "gitlab.com/gomidi/portmididrv"
"log"
)
func main() {
pad, err := launchpad.NewLaunchpad(driver.New())
if err != nil {
log.Fatal(err)
}
defer pad.Close()
pad.Clear()
// Send Text-Loop
pad.Text(launchpad.ColorS{3, 0}).Add(7, "Hello World!").Perform()
marker, err := pad.ListenToScrollTextEndMarker()
if err != nil {
log.Fatal(err)
}
for {
<-marker
log.Printf("Scrolling text is ended now.")
}
}
```