MiSTer MidiLink

Kernel, Main, Utilities & Apps, Misc Devices
bbond007
Posts: 134
Joined: Tue May 26, 2020 5:06 am

MiSTer MidiLink

Unread post by bbond007 »

MidiLink Remote/UDP with Raspberry Pi:

(In response to --> viewtopic.php?p=1701#p1701)

Purpose:
To use Raspberry Pi as an external UDP MIDI device running Munt (or FluidSynth). --> https://youtu.be/4bIEVzRiq0I

Why? The HPS/ARM is on the low-end as far as performance for Munt and can exhibit tempo issues. In my testing performance in RaspBerry Pi 3 (Model B) is still not 100% perfect, but still more consistent (tempo wise) than local Munt. A 3amp PSU (with no in-line switch), active cooling (and perhaps overclock) definitely would help!

Required files NOT included:
  • CM32L_CONTROL.ROM
  • CM32L_PCM.ROM
Or (less desirable):
  • MT32_CONTROL.ROM
  • MT32_PCM.ROM
Optional (for FluidSynth): I preformed this setup on a Raspberry Pi 3 (Model B) with HiFiBerry DAC hat running RetroPie. The setup process might be slightly different for other Linux distros (such as Soulja Boy Linux). This guide also assumes that user "pi" exist.

HiFiBerry is not a requirement but the analog audio on the RPi is kind of noisy. It would also be possible to use a USB DAC for better quality - perhaps even one with line-in audio mixing.

Copy
midilink.tar.gz
(107.85 KiB) Downloaded 22 times
to RetroPie "roms" samba share.

Log in as "pi" (default passwd "raspberry")
Extract "midilink.tar.gz" to "/home/pi":

Code: Select all

#cd /home/pi
#tar -xvzf RetroPie/roms/midilink.tar.gz
Copy CM-32L ROMS to RetroPie "roms" samba share.
Install Munt ROMS on RPi:

Code: Select all

#cd /home/pi
#mv RetroPie/roms/CM32L_*.ROM /home/pi/mt32-rom-data/
Move included "mt32d" (Munt ALSA daemon) somewhere in the path - such as "/usr/bin":

Code: Select all

#sudo mv /home/pi/mt32d /usr/bin
Start MidiLink (Munt) on the RPi:

Code: Select all

#cd /home/pi
#sudo ./midilink UDPMUNT 
or (to suppress debug data) 
#sudo ./midilink UDPMUNT QUIET
*** While it's not completely necessary to run MidiLink as root (sudo), it will attempt to elevate its task priority (and that of Munt/FluidSunth) which may help performance. The included "mt32d" bin has been compiled with optimizations for the RPi 3 --> https://retropie.org.uk/forum/topic/125 ... n-on-rpi-3.
The source code RPi Midilink is unchanged from the MiSTer source --> https://github.com/MiSTer-devel/MidiLink_MiSTer ***

Optional FluidSynth install or skip to "MiSTer Configuration:"

Although FluidSynth on the HPS/ARM runs very well, running it on a Raspberry PI allows for much larger soundfonts (for example --> https://www.hedsound.com/2019/06/mt32-c ... ryone.html)
Ultima VI (Intro) with Hedsound MT-32/CM-64 SoundFont --> https://youtu.be/G8rvyhKOXmY

Installing FluidSynth:

Code: Select all

#sudo apt-get install fluidsynth
Copy "SC-55.sf2" to RetroPie "roms" share:
Install (FluidSynth) SoundFont:

Code: Select all

#cd /home/pi
#mv RetroPie/roms/SC-55.sf2 soundfonts/ 
If you use a different SoundFont (from SC-55.sf2) then you'll need to edit the included "/home/pi/MidiLink.INI"

Code: Select all

FSYNTH_SOUNDFONT = /home/pi/soundfonts/MT-32-32K-v1-r65-Full-Hedsound.sf2
Start MidiLink (FluidSunth) on the RPi:

Code: Select all

#cd /home/pi
#sudo ./midilink UDPFSYNTH 
or (to suppress debug data) 
#sudo ./midilink UDPFSYNTH QUIET
MiSTer Configuration:

Edit "/media/fat/linux/MidiLink.INI"

Code: Select all

UDP_SERVER = Hostname or IP address of Raspberry Pi.
MiSTer OSD Configuration:
  • Connection : MIDI
  • MidiLink : Remote
  • Type : UDP
I hope this helps... :ugeek:
User avatar
zomgugoff
Posts: 32
Joined: Sun May 24, 2020 8:54 pm

Re: MiSTer MidiLink

Unread post by zomgugoff »

Can something be done to prevent the INI from being overwritten after an update?
bbond007
Posts: 134
Joined: Tue May 26, 2020 5:06 am

Re: MiSTer MidiLink

Unread post by bbond007 »

zomgugoff wrote: Sun Jun 07, 2020 7:17 am Can something be done to prevent the INI from being overwritten after an update?
How are you updating?

SD card utility or updater script?

I don't think the updater script updates it, but maybe I just don't notice?

If you are using then SD card utility then that probably is the expected behavior.

If it is the updater script then it might be a question for @Locutus73 --> viewtopic.php?f=27&t=175

Hope that helps...
User avatar
JeanFred64
Posts: 5
Joined: Sun May 24, 2020 9:23 pm

Re: MiSTer MidiLink

Unread post by JeanFred64 »

bbond007 wrote: Sun Jun 07, 2020 1:11 am MidiLink Remote/UDP with Raspberry Pi:
...
I hope this helps... :ugeek:
Thanks bbond007 for this guide

confirmed ... that's help :D
User avatar
zomgugoff
Posts: 32
Joined: Sun May 24, 2020 8:54 pm

Re: MiSTer MidiLink

Unread post by zomgugoff »

bbond007 wrote: Sun Jun 07, 2020 7:37 am
How are you updating?

SD card utility or updater script?

I don't think the updater script updates it, but maybe I just don't notice?

If you are using then SD card utility then that probably is the expected behavior.

If it is the updater script then it might be a question for @Locutus73 --> viewtopic.php?f=27&t=175

Hope that helps...
The updater script replaces it without backup. I'll have to ask Locutus72 about doing something to avoid it.

Also, would a stock RPi4 be able to keep up with MUNT/FluidSynth?
bbond007
Posts: 134
Joined: Tue May 26, 2020 5:06 am

Re: MiSTer MidiLink

Unread post by bbond007 »

zomgugoff wrote: Mon Jun 08, 2020 2:49 pm Also, would a stock RPi4 be able to keep up with MUNT/FluidSynth?
FluidSynth is not demanding at all and works great on the HPS/ARM. Running it on the RPi4 would just allow for using larger SoundFonts.

I don't have a RPi4 to test. The only thing I know for sure that keeps up with Munt 100% is an x86 PC.
Locutus73
Posts: 46
Joined: Mon May 25, 2020 9:55 am

Re: MiSTer MidiLink

Unread post by Locutus73 »

zomgugoff wrote: Mon Jun 08, 2020 2:49 pm The updater script replaces it without backup. I'll have to ask Locutus72 about doing something to avoid it.
What does get updated? MidiLink.INI?
If so, I think it happens when Linux is updated, since it comes with the linux dir in the SDInstaller rar.
Maybe I could prevent it to be extracted along with ppp_options and maybe _samba.sh.
Any suggestion?

Regards.

Locutus73
User avatar
zomgugoff
Posts: 32
Joined: Sun May 24, 2020 8:54 pm

Re: MiSTer MidiLink

Unread post by zomgugoff »

Locutus73 wrote: Tue Jun 09, 2020 7:43 am
What does get updated? MidiLink.INI?
If so, I think it happens when Linux is updated, since it comes with the linux dir in the SDInstaller rar.
Maybe I could prevent it to be extracted along with ppp_options and maybe _samba.sh.
Any suggestion?

Regards.

Locutus73
I would go with changing the filename to include 'default' or something, so midilink.ini is never overwritten. Make it the user's responsibility to make a copy/rename the file to midilink.ini on first setup/update. That way, the 'default' file is always up to date after an update and the user can check for changes to make in their existing midilink.ini.
bigern77
Posts: 5
Joined: Sun Jul 12, 2020 8:50 pm

Re: MiSTer MidiLink

Unread post by bigern77 »

I'm experiencing tempo issues (music seems like it struggles to keep up) using Midilink UDP in ao486 with SoftMPU. Edit: I mostly fixed it, see below.

"Munt" running on: Win 10 laptop with an Intel Atom CPU @2.2 Ghz. (Specifically: Munt VSTI plugin running in Falcosoft Midi player.) MT-32 rom.
Games tested: Space Quest III and IV.

I set the priority of both Munt and UDPMidi processes in Win10 to 'high'.

Update:
The problem is about 95% gone simply by plugging in my laptop. I guess my CPU was being throttled by power management. I don't really understand how, as Windows task manager showed ~2.2 Ghz during playback when unplugged and the same Ghz during playback when plugged in. Maybe Intel speedstep is too eager. Either way, the music sounds very good now. Like I said, it's about 95% fixed; every so often, say every 1 minute, the music struggles to keep up or skips a note, but it's really quite slight and barely noticeable. I notice it because I have heard these songs thousands of times. :) Note: I have not yet reduced the priority and retested, so I don't know if that's helping or not.

On a side note, would the UDP flow control option in the MidiLink.cfg have any effect on this phenomenon?

-Derrick Reed from YouTube
bbond007
Posts: 134
Joined: Tue May 26, 2020 5:06 am

Re: MiSTer MidiLink

Unread post by bbond007 »

bigern77 wrote: Mon Jul 13, 2020 2:56 am On a side note, would the UDP flow control option in the MidiLink.cfg have any effect on this phenomenon?
No, MIDI does not use any sort of flow control so the setting will not help.

Maybe try and use UDPMIDI.EXE --> Loop-MIDI --> MUNT (without VSTI plugin & Falcosoft Midi player) and see if that works any better...

I remember that setup working well on my cheap Atom windows 10 tablet/netbook, but unfortunately that device is no longer working (won't charge) so I can't confirm.
bigern77
Posts: 5
Joined: Sun Jul 12, 2020 8:50 pm

Re: MiSTer MidiLink

Unread post by bigern77 »

I switched from the VSTI plugin to just plain MUNT. Pretty much the same thing. A slowdown once or twice a minute. Still overall a good experience.
bbond007
Posts: 134
Joined: Tue May 26, 2020 5:06 am

Re: MiSTer MidiLink

Unread post by bbond007 »

zomgugoff wrote: Mon Jun 08, 2020 2:49 pm Also, would a stock RPi4 be able to keep up with MUNT/FluidSynth?
RPi4 sounds pretty good!

I think RPi3 can maybe do OK as well.

My RPi3 I was testing with gets that little lightning bolt symbol indicating insufficient power even though I use adapters with 3amp.
Maybe it is defective :(

Keep in Mind, that ANY RPi solution is going to need some sort of external DAC unless you use HDMI for sound unless you want it to sound like FM radio..

Here is a comparison with my new RPi4 (MUNT) with My Roland old Roland MT-32 Rev0 --> https://youtu.be/6w8iJJ2MPL0

The LCD is a inexpensive 20x4 IC2. It looks excellent in person but apparently very difficult to video.

Let me know if there are comparisons of other games I can do now that I have everything set up to do so...
User avatar
MickGyver
Posts: 11
Joined: Sun May 24, 2020 6:59 pm

Re: MiSTer MidiLink

Unread post by MickGyver »

bbond007 wrote: Sun Aug 09, 2020 1:25 am RPi4 sounds pretty good!

I think RPi3 can maybe do OK as well.

My RPi3 I was testing with gets that little lightning bolt symbol indicating insufficient power even though I use adapters with 3amp.
Maybe it is defective :(

Keep in Mind, that ANY RPi solution is going to need some sort of external DAC unless you use HDMI for sound unless you want it to sound like FM radio..

Here is a comparison with my new RPi4 (MUNT) with My Roland old Roland MT-32 Rev0 --> https://youtu.be/6w8iJJ2MPL0

The LCD is a inexpensive 20x4 IC2. It looks excellent in person but apparently very difficult to video.

Let me know if there are comparisons of other games I can do now that I have everything set up to do so...
Nice! Any instructions how to build a RPI4 Munt like yours with the LCD etc.?
bbond007
Posts: 134
Joined: Tue May 26, 2020 5:06 am

Re: MiSTer MidiLink

Unread post by bbond007 »

MickGyver wrote: Sun Aug 09, 2020 7:58 am Nice! Any instructions how to build a RPI4 Munt like yours with the LCD etc.?
There is really nothing difficult about interfacing the LCD... just 4 wires 3.3v, SDA1, SCL1 & ground.

I'll put my LCD driver/menu on github soon...

My LCD driver is actually a MIDI device (although a silent one) just like fluidsynth or mt32d.

Unfortunately, it currently only works with KB, and I'm thinking about alternatives such as IR remote or just buttons on GPIO pins.

MT-32 Rev0 or RPi4? --> https://youtu.be/OJDI_XB2y1A
yavimaya
Posts: 3
Joined: Sun May 24, 2020 8:37 pm

Re: MiSTer MidiLink

Unread post by yavimaya »

I'm using your tutorial to use MUNT on MIDILINK by UPD and also UDA dac with this tutorial https://learn.adafruit.com/adafruit-i2s ... y-pi-usage, and worked GREAT!!!

But desired to use ES9018K2M dac also with i2c oled display SSD1306. Do you know any tips to achieve that?

Thank you :)
User avatar
zomgugoff
Posts: 32
Joined: Sun May 24, 2020 8:54 pm

Re: MiSTer MidiLink

Unread post by zomgugoff »

Are there any settings or files that could break PPP mode? It doesn't work on ao486 or Minimig now.
bbond007
Posts: 134
Joined: Tue May 26, 2020 5:06 am

Re: MiSTer MidiLink

Unread post by bbond007 »

zomgugoff wrote: Wed Aug 12, 2020 3:07 am Are there any settings or files that could break PPP mode? It doesn't work on ao486 or Minimig now.
There are no MidiLink.INI settings which could break PPP as they are unrelated.
User avatar
zomgugoff
Posts: 32
Joined: Sun May 24, 2020 8:54 pm

Re: MiSTer MidiLink

Unread post by zomgugoff »

bbond007 wrote: Wed Aug 12, 2020 11:15 pm
zomgugoff wrote: Wed Aug 12, 2020 3:07 am Are there any settings or files that could break PPP mode? It doesn't work on ao486 or Minimig now.
There are no MidiLink.INI settings which could break PPP as they are unrelated.
I'm going to go ahead and just list the problem I found.

I have both a wifi dongle and a cabled network connection. After unplugging one or the other, PPP started working. It appears the presence of 2 IPs is causing a problem with PPP.
rhester72
Posts: 276
Joined: Thu Jun 11, 2020 2:31 am

Re: MiSTer MidiLink

Unread post by rhester72 »

I think what you mean to say is 'breaks networks horribly in general'. That's not a MiSTer problem.
Post Reply