Vanfanel
Posts: 432
Joined: Sat Aug 18, 2012 5:58 pm

Trying to use a Raspberry Pi as fluidsynth midi synth server

Sun Jun 23, 2013 5:23 pm

Hi again,

Let's say I have fluidsynth running on a Raspberry Pi as a server with

Code: Select all

fluidsynth --server --audio-driver=alsa /usr/share/sounds/sf2/FluidR3_GM.sf2
Fluidsynth server is listening on local IP 192.168.5.7 (Rpi's IP), on port 9800.
My client computer is 192.168.5.8 on the same network, and it's the computer from wich I always ssh into the Pi.

How can I use aplaymidi to get a MID file to play remotely on the Pi with the fluidsynth server? Or any other MIDI player program, for that matter.
aplaymidi -p doesn't work, as it just accepts local ports, not remore IP:PORT combinations.

thanks!

Vanfanel
Posts: 432
Joined: Sat Aug 18, 2012 5:58 pm

Re: Trying to use a Raspberry Pi as fluidsynth midi synth se

Thu Nov 14, 2013 8:43 pm

Any ideas on this, please??
I've investigated a lot but nobody seems to know how to send MIDI data to other IP on the same network :(

User avatar
Douglas6
Posts: 4632
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Trying to use a Raspberry Pi as fluidsynth midi synth se

Thu Nov 14, 2013 9:12 pm

You might take a look at these. I have no experience with them or MIDI-over-IP in general, sorry.

http://llg.cubic.org/tools/multimidicast/
http://qmidinet.sourceforge.net/qmidinet-index.html

Vanfanel
Posts: 432
Joined: Sat Aug 18, 2012 5:58 pm

Re: Trying to use a Raspberry Pi as fluidsynth midi synth se

Thu Nov 14, 2013 10:24 pm

It seems multimidicast is needed to send MIDI data over LAN, yes. Thanks, Douglas6! That's another piece of the puzzle...
However, I don't know how to use that program and it doesn't seem to be any README's explaining it with examples.
Some kind of virtual MIDI cable is also needed.

Any MIDI-over-LAN users around here?

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: Trying to use a Raspberry Pi as fluidsynth midi synth se

Fri Nov 15, 2013 8:57 am

Vanfanel wrote:Any MIDI-over-LAN users around here?
Yup :) http://www.youtube.com/watch?v=Pycl9Oi1tv8
I've used the multimidicast software for this. You can find a very basic example script of its usage in an RPi context here: https://github.com/AutoStatic/scripts/b ... h-touchdaw
It doesn't use FluidSynth though but amsynth. Replacing amsynth with FluidSynth should be quite simple though. And you don't have to necessarily use JACK.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

Vanfanel
Posts: 432
Joined: Sat Aug 18, 2012 5:58 pm

Re: Trying to use a Raspberry Pi as fluidsynth midi synth se

Fri Nov 15, 2013 8:02 pm

Whoa! I made it!

This is EXACTLY how it works:

In the SERVER:

We launch the ALSA network sequencer gateway:

Code: Select all

[email protected]:~$ aseqnet  &
we launch the software synthesizer:

Code: Select all

[email protected]:~$ fluidsynth --audio-driver=alsa -s merlin_gold.sf2
OR

Code: Select all

[email protected]:~$ timidity -iA -Os1 -B 2,3 &
Now we look for both the alsa midi gateway port and the syntesizer port, and we connect them:

Code: Select all

[email protected]:~$ aseqdump -l
 Port    Client name                      Port name
  0:0    System                           Timer
  0:1    System                           Announce
 14:0    Midi Through                     Midi Through Port-0
128:0    Net Client                       Network

[email protected]:~$ aplaymidi -l
 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0
128:0    Net Client                       Network
129:0    FLUID Synth (4309)               Synth input port (4309:0)

[email protected]:~$ aconnect 128:0 129:0
Now, let's go for the CLIENT: in my case, another Raspberry Pi is the client.

We first connect the alsa midi gateway to the server's IP address on the local network:

Code: Select all

aseqnet 192.168.5.8 &
Now we look for the midi gateway port:

Code: Select all

aseqdump -l
And we're ready to play some MIDI using the server's cpu for synthesizing!

Code: Select all

aplay -p 128:0 music.mid
In SCUMMVM, for example, we can use the SCUMMVM_PORT enviroment variable to point it to the network midi gateway:

Code: Select all

export SCUMMVM_PORT="128:0"
or we can use the alsa_port config variable, or we can simply select the "network client" option if we compiled scummvm with ALSA sequencer support!

My scenario is: a Raspberry Pi for playing Scummvm games, and a second Raspberry Pi as a MIDI synthesizer, thus freeing the main Rpi's CPU for SCUMMVM and using the second for high-quality MIDI in games.

Next stop: RpiX86 with MIDI support ;)

Thanks all who answered!!

PD: would multimidicast bring some advantages I've overlooked versus my current aseqnet and aconnect based solution?

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: Trying to use a Raspberry Pi as fluidsynth midi synth se

Fri Nov 15, 2013 9:12 pm

Vanfanel wrote:PD: would multimidicast bring some advantages I've overlooked versus my current aseqnet and aconnect based solution?
No I don't think so. It's just that multimidicast uses a protocol that other software (like TouchDAW) understands too. But in your case that doesn't apply so aseqnet is a perfect solution.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

Return to “Graphics, sound and multimedia”