[Tutorial] Installing Munt (MT-32 emulation) on RPi 3
-
By the way:
Running mt32d or xmt32 as root user will allow program to use real-time scheduling which may reduce/remove drop outs as the program can use the CPU more aggressively.
(from README.txt in the "mt32emu_alsadrv" folder)
-
Has anyone tried to compile munt for the Pi4?
What would the flags be for that case?
-
@Impy I have updated OP with flags for Raspberry Pi 4.
Possibly even better performance could be achieved by using the flags below (I have done zero testing on these - they might also degrade performance or even cause compilation errors).
- Raspberry Pi 4:
export CCFLAGS="-Ofast -march=armv8-a+crc -mcpu=cortex-a72 -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -munaligned-access"
export CXXFLAGS="-Ofast -march=armv8-a+crc -mcpu=cortex-a72 -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -munaligned-access"
- Raspberry Pi 3:
export CCFLAGS="-Ofast -march=armv8-a+crc -mcpu=cortex-a53 -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -munaligned-access"
export CXXFLAGS="-Ofast -march=armv8-a+crc -mcpu=cortex-a53 -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -munaligned-access"
- Raspberry Pi 4:
-
@David87 Thank you! It worked like a charm (the safer flags). The qtmobility-dev package was not available in the repos. I replaced that one with:
qttools5-dev
-
First, thanks for this thread folks - this is amazing!
So I've followed this process and its working great on my 4GB Pi 4 (with the safe compiler flags). Although the MT-32 stuff sounds great in the games I've tried that support it, any ideas as to why with the mt32d running the SB16 stuff then doesn't seem to work in DOSBox?
IF I comment out the line in rc.local and reboot so its not autostarting, then the SB16 stuff works fine, but it seems either-or for some reason.
-
@matthewtoney Nevermind on that one - user error :)
-
@david87 necroing this to add info and also ask.
I am using "DOSBIAN", and while it has a script to install a pre-compiled version of munt, it seems the url it wants to get the package ("munt-pidos") from does not work...
So I followed this tutorial and I was able to make it work. This is on a PI400 by the way.
Only "problems" I found were:
- in rc.local, if I add the governor lines (which I assume do not work in my case due to permissions, since values do not change in the files after boot), for some reason mt32d does not start...
If I comment out those lines it does start.
Any clue why?
- The volume of MT32 sound is too low... Any way to control it?
I have to mention that this distribution comes with SVN and ECE versions of DOSBOX. For SVN, this is of course required, and I find the problems mentioned in 1 & 2
For ECE however, it seems MUNT support is builtin? Without starting mt32d, or specifying midiconfg info, but adding the path to the roms in its .conf file (which has an extensive mt32 section), MT32 emulation just works (and I "solved" the volume issue by using the mixer which seems to have added an MT32 section/separate volume)
Does this all seem correct?
- in rc.local, if I add the governor lines (which I assume do not work in my case due to permissions, since values do not change in the files after boot), for some reason mt32d does not start...
-
- in rc.local, if I add the governor lines (which I assume do not work in my case due to permissions, since values do not change in the files after boot), for some reason mt32d does not start...
If I comment out those lines it does start.
Could it be that the file has wrong line endings (Windows CR+LF instead of Linux LF)?
I would also suggest to test these commands in root shell (runsudo -i
orsudo bash
to get into root shell).- The volume of MT32 sound is too low... Any way to control it?
You can try to
-g
parameter with value greater than 1 to increase the volume (e.g./usr/local/bin/mt32d -i 12 -g 1.5&
instead of/usr/local/bin/mt32d -i 12&
). Or you can check the analog mixer configuration (check documentation of the distro you are using for details).P.S. I haven't used Dosbian. I don't know exactly which forks of DOSBox have built-in munt (MT32 emulation) or how to configure them, but I know that DOSBox Pure has built-in MT32 emulation.
- in rc.local, if I add the governor lines (which I assume do not work in my case due to permissions, since values do not change in the files after boot), for some reason mt32d does not start...
-
I've followed your tutorial (many thanks btw!) and managed to get MT-32 emulation through Munt 2.5.0 working on RetroPie v4.7.1 using a RPi4. However, I've got a little issue with switching between TiMidity and Munt.
This is what the pre-Munt device configuration looked like:
pi@retropie:~ $ aconnect -o client 14: 'Midi Through' [type=kernel] 0 'Midi Through Port-0' client 128: 'TiMidity' [type=user,pid=577] 0 'TiMidity port 0 ' 1 'TiMidity port 1 ' 2 'TiMidity port 2 ' 3 'TiMidity port 3 '
And this is afterwards:
pi@retropie:~ $ aconnect -o client 14: 'Midi Through' [type=kernel] 0 'Midi Through Port-0' client 128: 'MT-32' [type=user,pid=645] 0 'Standard ' 1 'GM Emulation '
As you can see, TiMidity is no longer listed.
How can I revert back to TiMidity, or even better use both at the same time on different ports? When I disable autostart in rc.local and reboot the system, TiMidity doesn't automatically shows up. How can I resolve this?
EDIT: I've managed to get it working by performing "sudo apt-get -y install timidity timidity-daemon". For some reason installing Munt resulted in the TiMidity daemon disappearing, but that has now been resolved.
EDIT2: Never mind, it was just a brain fart. It wasn't even configured as a daemon/service prior to installing Munt. I hadn't touched RetroPie for over almost a year and forgot that TiMidity is started/stopped though scripts used by the systems/emu's (i.e. PC).Currently it looks like this:
pi@retropie:~ $ aconnect -o client 14: 'Midi Through' [type=kernel] 0 'Midi Through Port-0' client 128: 'TiMidity' [type=user,pid=538] 0 'TiMidity port 0 ' 1 'TiMidity port 1 ' 2 'TiMidity port 2 ' 3 'TiMidity port 3 ' client 129: 'MT-32' [type=user,pid=654] 0 'Standard ' 1 'GM Emulation '
For comparison sake, I've done some testing between TiMidity and FluidSynth. I must say they're pretty on par, but as a service I prefer TiMidity, as it's less resource hungry.
pi@retropie:~ $ aconnect -o client 14: 'Midi Through' [type=kernel] 0 'Midi Through Port-0' client 128: 'TiMidity' [type=user,pid=539] 0 'TiMidity port 0 ' 1 'TiMidity port 1 ' 2 'TiMidity port 2 ' 3 'TiMidity port 3 ' client 129: 'MT-32' [type=user,pid=652] 0 'Standard ' 1 'GM Emulation ' client 130: 'FLUID Synth (4992)' [type=user,pid=4992] 0 'Synth input port (4992:0)'
-
Working on trying to get Munt working on a Pi5.
I was able to compile switching the flags around a little. I used "-mtune=cortex-a76" and "-march=armv8.2-a+crc", and I had to remove the "-mfpu=neon-fp-armv8 -mfloat-abi=hard" instructions.
I installed it and got everything setup, but on boot, the Pi complains that "rc.local[1023]: Could not open pcm device: default" and "rc.local[1023]: mt32d: pcm.c:1226: snd_pcm_prepare: Assertion 'pcm' failed."
Any ideas?
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.