Skip to content

Commit bf9c187

Browse files
committed
Added the all important play.py file which was missing from the repository.
1 parent 369b42d commit bf9c187

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
!/examples/*
88
!/grid_instrument
99
!/grid_instrument/*
10-
10+
!play.py
1111
!README.md
1212
!MANIFEST.in
1313
!LICENSE.txt

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include examples/simple.py
22
include examples/threading.py
33
include examples/midi_output.py
4+
include play.py
45
include README.rst
56
include LICENSE

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ GridInstrument (aka Launchpad Scale-mode)
33

44
Did you ever wish you could use your Launchpad as a MIDI instrument? Do you covet the **Scale Mode** on the Launchpad Pro or Ableton Push, but not have the cash to buy them? Now you can play scales on any Novation Launchpad.
55

6+
67
Here's a quick [video demo](https://youtu.be/JJA2fm-2NVg).
78

9+
**There is also an iOS app version of this code [here](https://itunes.apple.com/us/app/gridinstrument/id1296511558?mt=8).**
10+
811
At it's core, **GridInstrument** is a library that allows you to display a scale grid on your Novation Launchpad. It functions very similarly to the scale mode on Henri David's _fantastic_ [Launchpad95](http://motscousus.com/stuff/2011-07_Novation_Launchpad_Ableton_Live_Scripts/) scripts for Ableton Live, and also similarly to the [scale mode](https://global.novationmusic.com/launchpad-pro-scale-mode) on a Launchpad Pro.
912

1013
Features:
@@ -24,7 +27,7 @@ Before you try to do anything, make sure you have **Python 2** and **pip** insta
2427

2528
Download the source code from github and install prerequisites:
2629

27-
git clone https://github.com/GridInstrument
30+
git clone https://github.com/dhilowitz/GridInstrument
2831
cd GridInstrument; pip install launchpad_rtmidi_py
2932

3033
Run the app:
@@ -41,7 +44,7 @@ You have two options for how to install it.
4144

4245
Download the source code from github:
4346

44-
git clone https://github.com/GridInstrument
47+
git clone https://github.com/dhilowitz/GridInstrument
4548
cd GridInstrument
4649

4750
Install it:

play.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/python
2+
#
3+
# Quick usage example of "grid_instrument" with MIDI output port.
4+
# Works with all Launchpads: Mk1, Mk2, S/Mini, Pro, XL and LaunchKey
5+
#
6+
#
7+
# David Hilowitz 1/15/19
8+
# decided.ly / davehilowitz.com
9+
#
10+
11+
import grid_instrument
12+
import rtmidi
13+
import time
14+
15+
def note_callback(messageType, midiNote, velocity):
16+
if messageType is "note_on":
17+
midiout.send_message([0x90, midiNote, velocity])
18+
elif messageType is "note_off":
19+
midiout.send_message([0x80, midiNote, velocity])
20+
21+
# Create a MIDI output port
22+
midiout = rtmidi.MidiOut()
23+
midiout.open_virtual_port("Grid Instrument (Virtual Port)")
24+
25+
# Set up GridInstrument
26+
instrument = grid_instrument.GridInstrument()
27+
instrument.intro_message = 'grid'
28+
instrument.note_callback = note_callback
29+
instrument.launchpad_pro_velocity_multiplier = 2.5
30+
instrument.min_velocity = 100
31+
instrument.max_velocity = 100
32+
instrument.default_velocity = 100
33+
34+
instrument.start()

0 commit comments

Comments
 (0)