Hardware Reference
In-Depth Information
MIDI actually required a number of changes to the Linux configuration for the Rasp-
berry Pi.
The Pi's serial driver does not actually support 31250 baud, the baud rate required by
the MIDI specification. Therefore, you must overclock the serial chip, by modify-
ing
/boot/config.txt
:
init_uart_clock=2441406
init_uart_baud=38400
Next, you must disable the serial console, which uses the RX/TX pins needed for MIDI,
through modification of
/boot/cmdline.txt
:
dwc_otg.lpm_enable=0 console=tty1 console=tty1 root=/dev/mmcblk0p2 /
rootfstype=ext4 elevator=deadline rootwait bcm2708.uart_clock=3000000
Lastly, you must disable the TTY that would normally get assigned to the RX/TX pins,
as well, by modifying
/etc/inittab
:
#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
The last thread is a simple web server, based on CoralBits'
libonion
, which uses the C
++ interface layer to map three request patterns (two with no-op responses for client
performance). The Alcyone uses a simple web app written with
JQuery
(and served
via
lightttpd
) to call this service with a single parameter:
message
. This app has a series
of buttons corresponding to control events: two kinds of channel changes, four kinds
of transposition events, and three different kind of system resets.
The message is actually an encoded byte, based on
Table 6-5
.
Table 6-5.
Messages and encoded bytes
MESSAGE
PAYLOAD
NOTES
MSG_MIDI_RESET
0001
Turns off all MIDI notes on every channel
xxxx
MSG_MIDI_CHANNEL_CHANGE
0010
vvvv
MSG_MIDI_OCTAVE_CHANGE
0100
vvvv
MSG_MIDI_TRANSPOSITION_CHANGE
1000
vvvv
MSG_RESET
1111
Resets the Alcyone's internal state to defaults
xxxx
MSG_REQUEST_STATUS
0011
Responds with three bytes: octave, transposition, channel