fernando-inf / mod-ttymidi

Serial MIDI interface for MOD devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ttyMIDI is a GPL-licensed program that allows external serial devices to 
interface with JACK MIDI clients.


COMPILATION

The ttyMIDI source code is comprised of a single C file.  To compile it, just
run the following command:

	make

This program depends on JACK, so you should have the development headers
for that installed. In Debian or Ubuntu, you can install it by running:

	apt-get install libjack-jackd2-dev

After you compile ttyMIDI, you may wish to copy it to /usr/bin for easy
access. This can be done simply by following command:

	sudo make install

USAGE 

First, you need an external device that can send MIDI commands through the
serial port.  To find out more about programming an external device, read the
TTYMIDI SPECIFICATION section.  If you are using an Arduino board
(http://www.arduino.cc), read the instructions under the arduino folder.  Once
your device is programmed and connected to your PC's serial port, follow the
instructions below.  

To connect to ttyS0 at 2400bps:

	ttymidi -s /dev/ttyS0 -b 2400

To connect to ttyUSB port at default speed (115200bps) and display information
about incoming MIDI events: 

	ttymidi -s /dev/ttyUSB0 -v

ttyMIDI also creates a JACK MIDI input port that feeds incoming MIDI events 
back to the serial port.

If you would like to use a GUI to connect your MIDI clients, there are many
available.  One of my favorites is qjackctl.


TTYMIDI SPECIFICATION 

The message format expected by ttyMIDI is based on what I could gather about the
MIDI specification online.  I tried to make it as similar as possible to the
specification, but some differences exist.  The good news is that as long as you
follow the specification described below, everything should work.

Every MIDI command is sent through the serial port as 3 bytes.  The first byte
contains the command type and channel.  After that, 2 parameter bytes are
transmitted.  To simplify the decoding process, ttyMIDI does not support
"running status", and it also forces every command into 3 bytes.  So even
commands which only have 1 parameter must transmit byte #3 (transmitting a 0 in
this case).  This is described in more details in the table below:

byte1       byte2                     byte3                     Command name

0x80-0x8F   Key # (0-127)             Off Velocity (0-127)      Note OFF
0x90-0x90   Key # (0-127)             On Velocity (0-127)       Note ON
0xA0-0xA0   Key # (0-127)             Pressure (0-127)          Poly Key Pressure
0xB0-0xB0   Control # (0-127)         Control Value (0-127)     Control Change
0xC0-0xC0   Program # (0-127)         Not Used (send 0)         Program Change
0xD0-0xD0   Pressure Value (0-127)    Not Used (send 0)         Mono Key Pressure (Channel Pressure)
0xE0-0xE0   Range LSB (0-127)         Range MSB (0-127)         Pitch Bend

Not implemented:
0xF0-0xF0   Manufacturer's ID         Model ID                  System 

Byte #1 is given as COMMAND + CHANNEL.  So, for example, 0xE3 is the Pitch Bend
command (0xE0) for channel 4 (0x03).  

About

Serial MIDI interface for MOD devices


Languages

Language:C 47.0%Language:HTML 24.5%Language:Processing 10.0%Language:Python 8.1%Language:C++ 5.2%Language:CSS 3.8%Language:Makefile 1.4%