Author Topic: RPI - MIDI I/0 5pin UPDATE - Rasbian Jessie Lite (boot in less than 20 seconds)  (Read 820 times)

0 Members and 1 Guest are viewing this topic.

Offline 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)
Code: [Select]
#! /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.
« Last Edit: June 09, 2016, 01:00:20 PM by eruji »

Offline Elantric

Fantastic!!!

THANK YOU!

Offline Elantric

Question

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

Offline eruji

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.

Online sixeight

Quote
Is 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?

Offline 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?

Offline Elantric


Offline loulea

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!!

Offline 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.
« Last Edit: June 13, 2016, 04:22:14 PM by eruji »

Offline philjynx

I've been experimenting for the last few days with a P3b latest release of Raspbian Jessie.
I've tried two approaches:
1 - teensy sending serial midi to the gpio uart pins on the pi (using a modified version of ttlMidi to get this visible to aconnect)
2 - today, teensy being a midi usb device (directly visible to aconnect)

Either way, I'm seeing this intermittent delay you have described. Unusable!

I wonder if anyone has any further thoughts on this?

A thought. mine is the full install of Jessie running the GUI - it also has wifi enabled and conencted to the interweb, so perhaps no GUI and no network connectivity might be the answer. I'll try a build like that.....
« Last Edit: October 21, 2017, 07:58:06 AM by philjynx »
I am playing all the right notes. But not necessarily in the right order.

Online 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

Offline philjynx

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

The version of ttymidi I have played with is the one with no sysex my mod is just to get it to compile as it was missing a switch in the makefile. At present, I'm just looking at sending PCs and CCs to the Katana.

I prefer to use gpio serial from the teensy to the Pi - not least because the Pi I intend to use once I've cracked this is the zero which only has just the one usb host port, so it's not physically possible to connect two USB Midi devices to it. In addition, I need the teensy usb midi connection to my laptop/mobius thingy.

Now, given that preference to use gpio serial betwixt Pi and Teensy, gpio serial is a dog on older releases of raspbian - it is seriously easy from (i think) 4.5 onwards.

Thanks for the link to your sysex ttlmidi - when I'm further down the line with my fun and games, that could save me a bunch of work - I had been looking at the code in my adapted teensy midi library to see what needed to be stolen from that!

I was reading your hotplugging article a few minutes ago, brilliant stuff!
« Last Edit: October 21, 2017, 08:57:12 AM by philjynx »
I am playing all the right notes. But not necessarily in the right order.

Offline philjynx

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've just downloaded the Jessie you suggested. Will let you know if it cures intermittent delay on midi messages.
I am playing all the right notes. But not necessarily in the right order.