Merge pull request #86 from danielappelt/clarify-midi-documentation

Enhance and clarify the MIDI documentation
This commit is contained in:
jean-emmanuel 2017-08-20 22:38:21 +02:00 • committed by GitHub
commit 2bee9abbe1

View file

@ -1,39 +1,39 @@
# Sending / Receiving MIDI
Open Stage Control can send and receive midi messages using a tiny python addon.
Open Stage Control can send and receive MIDI messages.
## Requirements
MIDI support requires additionnal softwares to be installed on the server's system:
MIDI support requires additional software to be installed on the server's system:
- python (2 / 3)
- python package [rtmidi](https://pypi.python.org/pypi/rtmidi) (2.3.2)
- python package [rtmidi](https://pypi.python.org/pypi/rtmidi) (version 2.3.2, compiled with `--jack-midi` flag for JACK MIDI support)
!!! note "Why an additionnal dependency ?"
Providing cross-platform midi support is not trivial, as it requires os-specific compilations that cannot be automated within Open Stage Control's current packaging workflow. Using a python addon seems the best compromise so far : the core app remains easy to build, and the extra dependency is easy to install.
Providing cross-platform MIDI support is not trivial, as it requires OS-specific compilation that cannot be automated within Open Stage Control's current packaging workflow. Using a python addon seems to be the best compromise so far : the core app remains easy to build, and the extra dependency is easy to install.
## Setup
When running the app, the `-m / -midi` switch must be set; it accepts the following options (separated by spaces):
- `list`: prints the available midi ports to the consolle
- `list`: prints the available MIDI ports to the console; numbers in the first column may be used for `input`/`output` definition below
- `device_name:input,output`: connect to midi ports `input` and `output`; osc messages sent to target `midi:device_name` will be processed as midi events; Multiple devices can be declared
*Linux only:*
- `device_name:virtual`: creates a virtual midi device with one input port and one output port
- `jack`: use jack-midi instead of alsa (pyrtmidi midi must be compiled with the `--jack-midi` flag in order to make this work)
- `jack`: use JACK MIDI instead of ALSA (add as extra parameter)
## Widget settings
In order to send midi messages, a widget must have at least one `target` formatted as follow;
In order to send MIDI messages, a widget must have at least one `target` formatted as follows:
`midi:device_name` (where `device_name` is one of the declared midi devices)
## Supported events
## Supported MIDI messages
!!! warning ""
Use the [`preArgs`](/widgets/widgets/#preargs) option to make sure the correct number of arguments is sent.
Define static argument values using the [`preArgs`](/widgets/widgets/#preargs) option in order to complete the respective MIDI message.
@ -45,6 +45,16 @@ NoteOn event or noteOff if velocity equals `0`.
- `note`: integer between 0 and 127
- `velocity`: integer between 0 and 127
Example:
A push button might be configured as follows in order to send a MIDI note whose velocity is defined by the button's on/off value:
- `address`: /note
- `preArgs`: [1, 60] (for MIDI channel 1, and note 60 / C3)
- `on`: 100 (for noteOn velocity of 100 on button push)
- `off`: 0 (to send a noteOff on button release)
- `target`: ["midi:device_name"] (where device_name is one of the declared midi devices defined during [setup](#setup))
### `/control channel cc value`
Control change event.