Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Raspberry PI with raspbian as soundmodule for Akai EWI USB

773 views
Skip to first unread message

wza...@gmail.com

unread,
Sep 10, 2013, 3:06:05 PM9/10/13
to
I have successfully configured the Raspberry Pi with raspbian (dedicated debian/linux) to work as a sound generator for Akai EWI USB.

Raspbian was installed as described in http://www.raspberrypi.org/downloads

I have performed initial configuration so, that sound is output through the headphones jack.

Because I have a RPi 2.0 B, with 512 MB of RAM, I have disabled swap, by adding
"exit 0" at the begining of the /sbin/dphys-swapfile utility (to avoid fast wear of the SD card).

Then I have updated packages and installed the fluidsynth.
I have also downloaded the alto_saxophone soundfont (it was available somewhere in the sfpack format, so I converted it to the sf2) and put in into the
/home/pi/synth folder

In my RPi SD I have modified the /etc/rc.local so, that it starts synthesizer:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
(
cd /home/pi/synth
./start
)
exit 0

The /home/pi/synth/start file has the following content:

#!/bin/sh
/usr/bin/fluidsynth -r 48000 -z 256 -c 4 -m alsa_seq -g 2 -p hw:1,0,0 -a alsa -s -i -o shell.port=12345 &
/bin/sleep 2
/bin/nc localhost 12345 < fluid.conf
/usr/bin/aconnect 20 128

The /home/pi/synth/fluid.conf has the following content:

router_begin note
router_chan 1 16 1 0
router_par1 0 127 1 0
router_par2 0 127 0 127
router_end
router_begin cc
router_chan 1 16 1 0
router_par1 2 2 1 5
router_par2 0 127 1 0
router_end
router_begin cc
router_chan 1 16 1 0
router_par1 34 34 1 5
router_par2 0 127 1 0
router_end
load alto_saxophone.sf2
select 15 1 0 3

In the above I assume, that EWI USB is visible as MIDI client 20, and fluidsynth is visible as MIDI client 128
(below is th output of "aconnect -i" and "aconnect -o" in my system):

pi@raspberrypi ~ $ aconnect -i
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'EWI-USB' [type=kernel]
0 'EWI-USB MIDI 1 '
pi@raspberrypi ~ $ aconnect -i
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
pi@raspberrypi ~ $ aconnect -i
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'E-MU Xboard49' [type=kernel]
0 'E-MU Xboard49 MIDI 1'

I also assume that my EWI USB is configured to send MIDI notes in the 15th channel.
If your system/EWI is configured in a different way, you may need to modify
the "aconnect 20 128" and "select 15 1 0 3" lines.


The presented configuration of fluidsynth router assures translation of the breath control to the volume, which allows to continuously modify the note volume.

The RPi configured in that way does not need neither keyboard, nor display, nor network connection. You can simply plug EWI USB to the USB port and headphones (or amp cable) to the audio output, and after powerup it is ready to play ;-).

--
Regards,
Wojtek

PS. There is a website which proposes probably better configuration of RPi for operation with Akai EWI USB: http://wiki.joanillo.org/index.php/EWI-USB_amb_la_Raspberry_Pi
My setup is simply "minimalistic"...

wimpunk

unread,
Sep 17, 2013, 4:30:04 AM9/17/13
to
Maybe you could comp.sys.raspberry-pi to get an answer?

wimpunk.

wza...@gmail.com

unread,
Sep 27, 2013, 6:17:20 PM9/27/13
to
The proposed setup was not correct.
The /home/pi/synth/start file should contain:

#!/bin/sh
/usr/bin/fluidsynth -r 48000 -z 256 -c 4 -m alsa_seq -g 2 -p hw:1,0,0 -a alsa -s -i -o shell.port=12345 -o audio.realtime-prio=99 -o midi.realtime-prio=99 &
/bin/sleep 2
/bin/nc localhost 12345 < fluid.conf
/usr/bin/aconnect 20 128

And the /home/pi/synth/fluid.conf should contain:


load tenor_saxophone.sf2
select 15 1 0 0

router_clear

router_begin note
router_chan 0 15 1 0
router_par1 0 127 1 0
router_par2 1 127 0 120
router_end

router_begin note
router_chan 0 15 1 0
router_par1 0 127 1 0
router_par2 0 0 1 0
router_end

router_begin cc
router_chan 0 15 1 0
router_par1 2 2 1 5
router_par2 0 127 1 0
router_end

router_begin cc
router_chan 0 15 1 0
router_par1 34 34 1 5
router_par2 0 127 1 0
router_end

However after some further experiments I have found, that it is better not to use the routing functions of the fluid synth, but the "mididings" package.
In this setup, the /home/pi/synth/start is as follows:

#!/bin/sh
/usr/bin/fluidsynth -r 48000 -z 256 -c 4 -m alsa_seq -g 2 -p fluid -a alsa -s -i -o shell.port=12345 -o audio.realtime-prio=99 -o midi.realtime-prio=99 &
/bin/sleep 2
/bin/nc localhost 12345 < fluid_min.conf
/usr/bin/python /home/pi/synth/myrouter.py

The minimal fluidsynth configuration /home/pi/synth/fluid_min.conf contains only:

load tenor_saxophone.sf2
select 15 1 0 0

And the mididings based MIDI router /home/pi/synth/myrouter.py contains:

from mididings import *
config (
backend='alsa',
client_name='myrouter',
out_ports=[('synth','fluid.*'),],
in_ports=[('ewi','EWI-USB.*'),],
)

run(
Velocity(fixed=120) >> [
Transpose(0),
CtrlMap(2,7),
CtrlMap(34,39)
]
)

This setup allows much more flexibility in use of EWI controllers.


0 new messages