-
Notifications
You must be signed in to change notification settings - Fork 10
Install
The MIDI bridge will build and run on any recent Linux distribution on a variety of architectures. A desktop machine will serve well for testing and coding, while a small single-board system is most practical for live performance. Code is tested on Raspberry Pi (B) and Beaglebone Green. The USB subsystem on RPi appears to have some latency issues, so the Beaglebone would be the recommended choice.
You must be able to:
-
Use an 'ssh' client to obtain a command line session on a remote machine
-
Make use of Google to locate solutions for generic operating system problems that I may not cover in this document
If any of this makes you uncomfortable, please wait until a turn-key system becomes available. The project is very much in a raw development mode and may not be suitable for complete Linux newbies.
Download:
https://debian.beagleboard.org/images/bone-debian-8.4-lxqt-4gb-armhf-2016-05-13-4gb.img.xz
Then follow directions here:
https://beagleboard.org/getting-started#update
The official instructions want you to boot the BBG by connecting as a USB slave device to a PC. I don't know anything about this approach and won't address it. The only sane way I can make these instructions generic is to treat the device as Just Another Linux Machine.
-
Plug an ethernet cable into the board
-
Insert the SD card
-
Hold down the 'reset' button while plugging a source of USB power into the small port (an old cell phone charger works fine). Release the reset button when you see the power LED (far side of the ethernet port from reset) light up.
-
Log in to your router and find the IP address for the Beaglebone (all home routers I'm aware of have the ability to show you IP addresses and names for DHCP clients like the BB).
-
From your PC or Mac, log in to the BB:
hirsch@z87:~$ ssh root@192.168.245.105
Debian GNU/Linux 8
BeagleBoard.org Debian Image 2016-05-13
Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian
default username:password is [debian:temppwd]
Last login: Thu Jun 23 15:47:53 2016 from 192.168.245.27
root@beaglebone:~#
Go to this page and download Raspbian Jessie Lite:
https://www.raspberrypi.org/downloads/raspbian/
Then follow the instructions here to write to SD:
https://www.raspberrypi.org/documentation/installation/installing-images/README.md
-
Plug an ethernet cable into the board
-
Insert the SD card
-
Apply power to the board
-
Log in to your router and find the IP address (all home routers I'm aware of have the ability to show you IP addresses and names for DHCP clients like the BB).
-
From your PC or Mac, log in to the BB:
$ ssh pi@192.168.245.105
passwd: raspberry
$ sudo su -
$
- Force USB to "full" speed (aka USB 1.1). Edit the file
/boot/cmdline.txt
and add the text underlined below.
(some entries omitted)... rootwait dwc_otg.speed=1
---------------
- Reboot the computer and login in again as root:
$ reboot
...
- Setup a non-privileged account for yourself (repeat after me: "Running routinely as root will bite you in the butt sooner than later.."). While logged in as root per above:
$ useradd -m -s /bin/bash -G steven
$ passwd steven
new password: xxxxxx
enter again: xxxxxx
- Install some required packages:
$ apt-get update
$ apt-get install libasound2
$ apt-get install librtmidi-dev
$ apt-get install libusb-1.0-0-dev
$ apt-get install git
$ apt-get install g++
$ apt-get install at
$ apt-get install libjack0 (Debian Precise)
# or
$ apt-get install libjackQ (Debian Jessie)
$ apt-get install python2.7 python2.7-dev
$ apt-get install python-pip
# NOTE: Install of python-pip segfaults on rPi but the program seems
# functional.
# Now install Python USB support using pip:
$ pip install pyusb
- Log out as root and back in under your new account name:
$ ssh steven@192.168.245.105
- While logged as your new account, download and build the MIDI bridge (there should be no errors or warnings)
$ git clone https://github.com/snhirsch/mustang-midi-bridge.git
$ cd mustang-midi-bridge
$ make
If the build succeeds, you need to customize two files for your environment.
- Temporarily monitor the system log:
$ sudo tail -f /var/log/syslog
- Plug your MIDI controller into one of the USB ports and watch the logs. You should see something like this (note underlined values):
Jun 25 16:14:12 beaglebone kernel: [ 596.979234] usb 1-1.2: new full-speed USB device number 7 using musb-hdrc
Jun 25 16:14:12 beaglebone kernel: [ 597.073151] usb 1-1.2: New USB device found, idVendor=0763, idProduct=0160
---- ----
Jun 25 16:14:12 beaglebone kernel: [ 597.080272] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=
Jun 25 16:14:12 beaglebone kernel: [ 597.087828] usb 1-1.2: Product: USB MS1x1 MIDI Interface
Jun 25 16:14:12 beaglebone kernel: [ 597.093299] usb 1-1.2: Manufacturer: M-Audio
- Edit the file
60-midi.rules
and set these properties based on the id numbers in the log entry. Do not change anything else in this file!
ACTION=="add|change", SUBSYSTEM=="usb", ATTRS{idVendor}=="0763", ATTRS{idProduct}=="0160"
---- ----
ACTION=="remove", ENV{ID_VENDOR_ID}=="0763", ENV{ID_MODEL_ID}=="0160"
---- ----
- Exit log monitoring with Ctrl-C. Leave the controller connected.
- Find the MIDI device number (note underlined value):
$ amidi -l
Dir Device Name
IO hw:1,0,0 USB MS1x1 MIDI Interface MIDI 1
--
- Edit the file
mustang_bridge_start
as follows (do not change any other settings in the file):
####### Start User Edits #########
# Controller USB parms
control_vid = 0x0763 # <-- USB identifiers from above
control_pid = 0x0160
# Controller MIDI device
midi_device = 1 # <-- Controller device from above
# MIDI listen channel
midi_channel = 1 # <-- Your choice of MIDI channel to listen on.
######## End User Edits ##########
- Install the application:
$ sudo install.sh
You now are ready to try running.
-
Connect your MIDI controller and the Mustang amplifier to the single-board computer (you will have to use a USB hub if running on a Beaglebone Green).
-
If everything has gone well, you should be able to see the mustang-midi bridge process running:
$ ps axu | grep mustang
mustang+ 14235 9.1 1.9 33860 3620 ? SNl 13:46 0:00 mustang_midi 1 1
...
- You should now be able to control the amplifier by sending the appropriate messages from your controller.
If either device is disconnected, the bridge program will be automatically shut down. It restarts when both devices are detected again. This should allow graceful recovery when a device disappears due to loss of power or a yanked cable.
- Starting with both devices disconnected, plug the amp and controller in one at a time and see if they are being detected. You should see something like this (on a Raspberry Pi you won't see the hub device since it has two built-in ports):
Jun 25 16:14:12 beaglebone kernel: [ 596.511271] usb 1-1: new full-speed USB device number 6 using musb-hdrc
Jun 25 16:14:12 beaglebone kernel: [ 596.644669] usb 1-1: New USB device found, idVendor=058f, idProduct=9254
Jun 25 16:14:12 beaglebone kernel: [ 596.651611] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jun 25 16:14:12 beaglebone kernel: [ 596.658963] usb 1-1: Product: Generic USB Hub
Jun 25 16:14:12 beaglebone kernel: [ 596.663473] usb 1-1: Manufacturer: ALCOR
Jun 25 16:14:12 beaglebone kernel: [ 596.681647] hub 1-1:1.0: USB hub found
Jun 25 16:14:12 beaglebone kernel: [ 596.697589] hub 1-1:1.0: 4 ports detected
...
Jun 25 16:14:12 beaglebone kernel: [ 596.979234] usb 1-1.2: new full-speed USB device number 7 using musb-hdrc
Jun 25 16:14:12 beaglebone kernel: [ 597.073151] usb 1-1.2: New USB device found, idVendor=0763, idProduct=0160
Jun 25 16:14:12 beaglebone kernel: [ 597.080272] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=
Jun 25 16:14:12 beaglebone kernel: [ 597.087828] usb 1-1.2: Product: USB MS1x1 MIDI Interface
Jun 25 16:14:12 beaglebone kernel: [ 597.093299] usb 1-1.2: Manufacturer: M-Audio
...
Jun 25 16:14:12 beaglebone kernel: [ 597.203860] usb 1-1.3: new full-speed USB device number 8 using musb-hdrc
Jun 25 16:14:12 beaglebone kernel: [ 597.309194] usb 1-1.3: New USB device found, idVendor=1ed8, idProduct=0005
Jun 25 16:14:12 beaglebone kernel: [ 597.316379] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=
Jun 25 16:14:12 beaglebone kernel: [ 597.323952] usb 1-1.3: Product: Mustang Amplifier
Jun 25 16:14:12 beaglebone kernel: [ 597.328810] usb 1-1.3: Manufacturer: FMIC
Jun 25 16:14:12 beaglebone kernel: [ 597.332956] usb 1-1.3: SerialNumber: C478FF393337483157208416
If you don't see both the MIDI controller interface and the Mustang amp, then something went wrong with device enumeration.
** STILL UNDER CONSTRUCTION **