https://github.com/cassaundra/rocket
Java/Kotlin client for the Novation Launchpad MK2
https://github.com/cassaundra/rocket
java kotlin midi novation-launchpad-mk2
Last synced: 5 months ago
JSON representation
Java/Kotlin client for the Novation Launchpad MK2
- Host: GitHub
- URL: https://github.com/cassaundra/rocket
- Owner: cassaundra
- License: gpl-3.0
- Archived: true
- Created: 2018-07-09T03:28:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-14T00:20:30.000Z (over 4 years ago)
- Last Synced: 2025-08-16T14:37:33.385Z (10 months ago)
- Topics: java, kotlin, midi, novation-launchpad-mk2
- Language: Kotlin
- Homepage:
- Size: 315 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.com/cassaundra/rocket)
[](https://search.maven.org/artifact/io.cassaundra/rocket)
[](https://www.javadoc.io/doc/io.cassaundra/rocket)

## Table of Contents
- [Setup](#setup)
- [Getting Started](#getting-started)
- [Colors](#colors)
- [Displaying Text](#displaying-text)
- [Basics](#basics)
- [Speed](#speed)
- [Completion](#completion)
- [TODO](#todo)
## Setup
Add this to your pom.xml:
```xml
io.cassaundra
rocket
2.0.0
```
Alternatively, with Gradle:
```gradle
dependencies {
compile 'io.cassaundra:rocket:2.0.0'
}
```
## Getting Started
```kotlin
val rocket = Rocket()
with(rocket) {
// Allow MIDI scanning to begin
beginMidiScan()
// Listen for input events
addListener(object : LaunchpadListener {
override fun onPadDown(pad: Pad) {
setPad(pad, Color.WHITE)
}
override fun onPadUp(pad: Pad) {
setPad(pad, Color.OFF)
}
override fun onButtonDown(button: Button) {
if(button.isTop)
setButton(button, Color.RED)
else
setButton(button, Color.BLUE)
}
override fun onButtonUp(button: Button) {
setButton(button, Color.OFF)
}
})
}
```
Similarly, in Java...
```java
Rocket rocket = new Rocket();
// Allow MIDI scanning to begin
rocket.beginMidiScan();
// Listen for input events
rocket.addListener(new LaunchpadListener() {
public void onPadDown(Pad pad) {
rocket.setPad(pad, Color.WHITE);
}
public void onPadUp(@NotNull Pad pad) {
rocket.setPad(pad, Color.OFF);
}
public void onButtonDown(@NotNull Button button) {
if(button.isTop())
rocket.setButton(button, Color.RED);
else
rocket.setButton(button, Color.BLUE);
}
public void onButtonUp(@NotNull Button button) {
rocket.setButton(button, Color.OFF);
}
});
```
Now you're on your way to creating a full Launchpad app!
## Colors
You can use custom colors by specifying RGB int values between 0 and 63 inclusive.
```kotlin
val color = Color(42, 0, 30)
```
In Java,
```java
Color color = new Color(42, 0, 30);
```
If you want to convert an HSV value to a Launchpad color, use `Color.fromHSV`, with each value a float in the range 0 to 1.
```kotlin
Color.fromHSV(.5f, 1f, 1f)
```
## Displaying Text
### Basics
You can call the Launchpad's built-in MIDI command for displaying text with `Launchpad.displayText`.
```kotlin
rocket.displayText(
"Hello world!"
)
```
In Java,
```java
rocket.displayText(
"Hello world!"
);
```
### Speed
You can control the text scrolling speed per-character with seven different available speeds in `TextSpeed`.
```kotlin
rocket.displayText(
"Hello! ${TextSpeed.SPEED_1}Let's take this slower."
)
```
In Java,
```java
rocket.displayText(
"Hello! " + TextSpeed.SPEED_1 + "Let's take this slower."
);
```
### Completion
If you need to know when text has finished scrolling, you can use the onComplete argument.
```kotlin
rocket.displayText(
"Hello world!",
onComplete = Runnable { println("Done!") }
)
```
In Java,
```java
rocket.displayText(
"Hello world!"
);
```
## Utils
`Pad.Util` provides several useful utility functions, like rectangles, line segments, and more.
## TODO
* Add contributing documentation
* Add support for multiple Launchpads (I have only one)
* Use Gradle instead of Maven
* Add more unit tests!