GithubHelp home page GithubHelp logo

andeemarks / clj-launchpad-mk2 Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 135 KB

This library provides a Clojure interface to access the Novation Launchpad MK2 programmatically.

License: MIT License

Clojure 100.00%
clojure novation launchpad mk2 midi

clj-launchpad-mk2's Introduction

clj-launchpad-mk2

Build Status Clojars Project MIT Licence

This library provides a Clojure interface to access the Novation Launchpad MK2 programmatically. The code started life as a clone of Moumar's Clojar and was subsequently updated to handle the MK2 version of the Launchpad. The mapping of buttons and specification of colours completely changed when the MK2 was released, so lots of the original code in these areas has been re-written, as has the input message handling code.

More Info

  • Novation's Launchpad MK2 MIDI programmer's reference was the sole source for helping me understand how to interact with the Launchpad.

Installation

Leiningen/Boot

[clj-launchpad-mk2 "1.0.2"]

Gradle

compile "clj-launchpad-mk2:clj-launchpad-mk2:1.0.2"

Maven

<dependency>
  <groupId>clj-launchpad-mk2</groupId>
  <artifactId>clj-launchpad-mk2</artifactId>
  <version>1.0.2</version>
</dependency>

REPL Usage

(require '[clj-launchpad-mk2.core :refer :all])
(require '[clj-launchpad-mk2.midi.core :as midi])

(def lpad (open))			; first argument to all subsequent calls

(light-grid lpad 23) 			; light all buttons
(light-row lpad 3 66) 			; light a single row of buttons
(light-column lpad 3 99) 		; light a single column of buttons
(flash lpad 5 5 60) 			; flash a single cell between it's current colour and 60
(pulse lpad 4 4 10) 			; pulse (adjust brightness) of a single cell
(light-cc lpad CC_CURSOR_RIGHT 11) 	; light a specific control button
(light-cell lpad 0 0 35) 		; light a specific cell
(clear-grid lpad) 			; clear all cells
(scroll-text-once lpad "Launchpad" 54)	; scrolling text once only
(scroll-text lpad "MK2" 60)		; scroll text in a loop
(scroll-stop lpad)			; stop looped scrolling
(rgb lpad 0 0 0 0 0)			; progressively increase the RED component of a series of cells
(rgb lpad 0 1 16 0 0)
(rgb lpad 0 2 32 0 0)
(rgb lpad 0 3 48 0 0)
(rgb lpad 0 4 63 0 0)
(midi/set-button-press-handler 		; "random" light pressed button
	lpad
	(fn
		[msg]
		(light-cell
			lpad
			(:x msg)
			(:y msg)
			(- 127 (+ (:x msg) (:y msg))))))

(close lpad)				; disconnect

You can also try lein run to run the examples in demo.clj.

API

API documentation available here.

To Do

  • Fix midi error at end of demo.

Copyright

Copyright (c) 2017 Andy Marks. See LICENSE for details.

clj-launchpad-mk2's People

Contributors

andeemarks avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.