RPI - MIDI I/0 5pin UPDATE - Rasbian Jessie Lite (boot in less than 20 seconds)

Started by eruji, June 09, 2016, 11:32:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

eruji

This guide will help you setup a RPI device in minutes
(and boot up and be ready to use in under 20 seconds)

I wanted to document this since I found the guides a little confusing and there is a newer release of raspberry pi Jessie now available. In particular Jessie Lite, which is a minimal / headless install. The work that went into this is mostly from the two stickied posts in this forum section and the members who contributed the info.

The Goal:
I want to use my pedalboard (FCB1010) to send MIDI data to change presets and parameters my effects unit (GT-001)

Software Specifics:
link to download Jessie Lite:
https://www.raspberrypi.org/downloads/raspbian/
link to installation guide:
https://www.raspberrypi.org/documentation/installation/installing-images/README.md

My Hardware Specifics:
RPi board: RPI B+
MIDI Pedalboard: Behringer FCB1010 (5 pin standard)
USB/MIDI adapter: iConnectivity MIO
Effects Unit: BOSS GT-001 (usb only  :P)




PROOF OF CONCEPT in 3 steps:
After you have Jessie Lite booted with all of your hardware connected:

1.) Log in using pi:raspberry

2.) Type aconnect -l (this will list all the devices attached to your Pi, and if any connections exist)
     my window looks like this:
     

3.) Type aconnect [midi out device]:port [midi in device]:port
     in my example im using the mio device (which is connected to the FCB1010) to send MIDI data to the GT-001.
     So I would type aconnect 'mio':0 'GT-001':0

That's It!
Your hardware should now be successfully transferring MIDI data from one device to the other. In my case I only need the pedal board to send out MIDI data to the GT-001, so one aconnect command is all I need. If you need two way communication between the same devices then you would type another command :
aconnect 'GT-001':0 'mio':0 (which is the opposite order of the first command above)




Now that we know it works, lets create a script to automatically make the aconnect(ions) for us at boot:

1.) Type: sudo nano /etc/init.d/midi_setup
     which opens up an editor, now type: (replacing the acconnect command(s) with the one you tested above)
#! /bin/sh
# /etc/init.d/midi_setup

### BEGIN INIT INFO
# Provides: midi_setup
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO

# make disk read only if previously writable
# mount / -o remount,ro

# enter your midi cross connections below, left side is midi source, right side is midi destination
aconnect 'mio':0 'GT-001':0

exit 0


**also included in this script is the command that makes the filesystem read only. It's commented out above and I would suggest that you leave it commented out until you have tested your script by rebooting and verifying that everything is working. Then you can remove the "#" in front of the line of code: mount / -o remount,ro . Once you remove the comment mark and reboot, you will not be able to make any modifications to the system and scripts unless you issue the command: sudo mount / -o remount,rw which makes the file system writeable again.

now press the F3 key and then Enter to save
then press the F2 key to exit the script editor

2.) Type: sudo chmod 755 /etc/init.d/midi_setup this makes the script executable

3.) Type: sudo update-rc.d midi_setup defaults this adds the script to the boot process

Now lets try it out, to reboot type:
sudo shutdown -r now

mine is at the login screen in about 36 seconds at this point. but the GT-001 is responding to pedal presses in 18 seconds!




Lets see if we can speed things up:

Type: sudo raspi-config this opens up the rpi config screen where you can make various tweaks. Here are the results from the few things i tried:

Overclock - Turbo (16 seconds to pedal response 31 seconds to login)

Wait for Network at Boot - Fast (16 seconds to pedal 19 seconds to login)

Is it worth it to overclock to save a few seconds on pedal response. I'll let you decide.

Disclaimer: I'm a RPI/Linux newb so let me know if there are any mistakes or better methods for this. And again thanks to the work of the forum members who figured this all out.
EDIT: also this is just sitting on my desk at this point. i can see the patches changing and its working but sometimes i notice very small delays from when i press the button on the pedal to when the patch or parameter changes. I will test this out with a band tomorrow and see how it performs in real life. In particular it seems like the if you wait a minute or so and then step it lags just a little (half a second or so) presses right after that seem to be more responsive.

Elantric


Elantric


eruji

Quote from: Elantric on June 09, 2016, 11:50:46 AM
Question

would this procedure be similar using the latest faster Raspberry Pi 3?
https://www.raspberrypi.org/blog/raspberry-pi-3-on-sale/

I would assume so because there are not any alternate versions of Raspbian on the raspberrypi.org website. Do you own a 3? i would like to know if it works and if the boot times are faster.

sixeight

QuoteIs it worth it to overclock to save a few seconds on pedal response. I'll let you decide.

Is it possible to slow down the clock speed after the aconnect commands?

http://unix.stackexchange.com/questions/97715/ubuntu-how-do-i-change-clock-speed-from-terminal seems to suggest this is possible. But can it be set temporary, so speed is high on boot?

eruji

So I've spent the afternoon trying it out with the guitar plugged in and I'm having some intermittent issues with a small delay in the midi data being sent. Ill press a foot pedal and it feels instantaneous. Then switch some more and eventually one will delay a half second to a full second or so. I tried turning off any of the overclocking, read only file system. I tried installing a full Jessie distribution and just running the command line to connect the devices and still the same.

I don't recall any mention of this in the other threads. Does anyone have any ideas? Is there a difference in using aconnect vs the qjackctl patchbay?


loulea

Quote from: eruji on June 09, 2016, 05:12:22 PM
So I've spent the afternoon trying it out with the guitar plugged in and I'm having some intermittent issues with a small delay in the midi data being sent. Ill press a foot pedal and it feels instantaneous. Then switch some more and eventually one will delay a half second to a full second or so. I tried turning off any of the overclocking, read only file system. I tried installing a full Jessie distribution and just running the command line to connect the devices and still the same.

I don't recall any mention of this in the other threads. Does anyone have any ideas? Is there a difference in using aconnect vs the qjackctl patchbay?

The aconnect commands are part of ALSA which qJack patchbay uses. I'm not familiar with Jessie lite but as long as it is running ALSA, there should be no delays. I've had no issues with delays with my RPI B or RPI 2. My RPI 2 boots up in about 30 seconds vs the RPI B+ which is 55 seconds.

The problem with aconnect is that you have to keep track of the connections. At least with qJackCtl I can get a visual representation of the connections. Make sure the MIDI channels match. Roland is normally on 1. Make sure you don't have a port looped back to itself. This has happened to me and I had to disable echoing of midi commands in my DAW. This will definitely cause a delay since the device is busy servicing the commands and ignoring the most recent. I would check your GT100 and the device the FCB1010 is connected to. it would be nice to use MIDI-OX or some monitoring program to analyze the bus to see what is actually happening.

You should not have any delays and clocking won't have noticeable impacts. I'd say your problem is most likely setup related. Let me know the outcome. I have the RPI3 on order and will try it in the future.

Hope this helps
Music is in everyone!!

eruji

Okay, so here is what ive tried:

Latest Raspbian Jessie both Lite and Regular have the delay issue ive mentioned. It really is subtle, but for me its a deal breaker because I need it to perform without any dealay since I'm on the pedals for solo, patch changes, wah pedal etc.

I tried both the command line vs qjackctl config methodology and the delay is the same in the Jessie builds.

I downloaded loulea's image with the date: Apr-24-2015 and when i config my patchbay/connections windows it works and no delay issues.

I then went to http://downloads.raspberrypi.org/raspbian/images/ to grab the 2/16/2016 release (just prior to loulea's 4/24/2015 image, i dont know which release his was based on)  and using my command line only script method it works without delay issues either.  So something in later raspbian releases is causing the issue i think. Perhaps its the Jessie update. And i believe that Wheezie was prior to the pi zero or pi 3 release so it may not work with those devices. Not sure at this point. Im glad its working without error (Ill update if i find any issues but so far i cant get it to delay)

I'm not sure how to troubleshoot whats going on to cause the delays and im not sure that i care if the older releases work. Ill probably try the first Jessie release vs the last Wheezy just to see if that may be the cause.

TLDR: the 2/16/2016 wheezy build works without issues with the instruction on first post. With the latest version of Jessie I have delay issues. 

EDIT: the command aconnect -l doesnt seem to list the connections anymore in the 2/16/2016 build not sure why. so you would have to use aconnect -i or acconnect -o to list inputs / outputs to know how to name them. ill update the first post once i verify a few more things.

sixeight

Not sure which version of ttymidi you are using, but know that most versions do not support sysex messages. I have adapted the original version in such a way that it does support sysex:

https://github.com/sixeight7/ttymidi

As for Raspberry versions: I am still using the older version. I don't have any problems with delays in midi data.

I also developed a way to allow for hotplugging usb devices. Whenever a usb device is connected the midi connect script is run again. Check out the details here:

https://github.com/sixeight7/VCbridge/blob/master/RPi%20full%20install%20VCbridge.txt