RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    [Tutorial] Installing Munt (MT-32 emulation) on RPi 3

    Scheduled Pinned Locked Moved General Discussion and Gaming
    muntmidiraspberry pi 3mt-32dosbox
    34 Posts 17 Posters 19.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • David87D
      David87 @seren
      last edited by

      @seren said in [Tutorial] Installing Munt (MT-32 emulation) on RPi 3:

      • Can I use the 3B compiler flags for the 3B+
        Most likely they will do.
      • Can I route the audio output via a Hifiberry or USB audio device? If so, how?
        You can either add -d name parameter when starting mt32d (step 11. in OP) to specify ALSA PCM output device. Or you can comment out dtparam=audio=on in /boot/config.txt to disable Raspberry Pi built-in sound card.
      1 Reply Last reply Reply Quote 1
      • S
        seren
        last edited by seren

        I would like to try the Qt version on my Raspberry Pi 3B+. Can you explain how to build that (including installing Qt itself, etc.) ? I ran into issues , something with: fatal error: QtWidgets/QAction: No such file or directory
        #include <QtWidgets/QAction>

        @David87 said in [Tutorial] Installing Munt (MT-32 emulation) on RPi 3:

        • Can I route the audio output via a Hifiberry or USB audio device? If so, how?
          You can either add -d name parameter when starting mt32d (step 11. in OP) to specify ALSA PCM output device. Or you can comment out dtparam=audio=on in /boot/config.txt to disable Raspberry Pi built-in sound card.

        I have it running (mt32d) with a HifiBerry DAC+ADC. I made sure the latest kernel was installed with Hifiberry support with sudo rpi-update and indeed commented out dtparam=audio=on and put in dtoverlay=hifiberry-dacplusadc in /boot/config.txt. Use the correct name for your hifiberry device: https://www.hifiberry.com/build/documentation/configuring-linux-3-18-x/

        1 Reply Last reply Reply Quote 0
        • David87D
          David87
          last edited by David87

          @seren Unfortunately I cannot help with Qt things.
          And the default audio output device for you is successfully set to HiFiBerry, correct?

          1 Reply Last reply Reply Quote 0
          • sirhenrythe5thS
            sirhenrythe5th
            last edited by

            i am very interested to pimp up my DosBox by using this great tutorial.

            Just two questions in advance:

            • is this tutorial still up to date concering retropie 4.4.(.15) ?
            • is munt_2_2_0 still the latest available version of this Emulator?

            Thx a lot for Support!

            -- Retro-Achievements Username: SirALX --
            RetroRatio: 1.88
            Started Games beaten: 2,47%
            Site Rank: 4382/93743 ranked users (TOP 4.76%)
            Last seen in [The Legend of Zelda: Lost in Time (HACK) [N64], exploring Hyrule at Night]

            David87D 1 Reply Last reply Reply Quote 0
            • B
              Barcrest
              last edited by

              Is this better than using the munt implementation already built into scummVM or does the retropie version not have munt built in?

              sirhenrythe5thS 1 Reply Last reply Reply Quote 0
              • sirhenrythe5thS
                sirhenrythe5th @Barcrest
                last edited by sirhenrythe5th

                @Barcrest AFAIR its meant for usage in DosBOX - not ScummVM.

                -- Retro-Achievements Username: SirALX --
                RetroRatio: 1.88
                Started Games beaten: 2,47%
                Site Rank: 4382/93743 ranked users (TOP 4.76%)
                Last seen in [The Legend of Zelda: Lost in Time (HACK) [N64], exploring Hyrule at Night]

                1 Reply Last reply Reply Quote 1
                • David87D
                  David87 @sirhenrythe5th
                  last edited by

                  @sirhenrythe5th

                  • You can test this tutorial on RetroPie 4.4. And please post here any issues observed if you do so! Most likely everything will work.
                  • Latest Munt version is 2.3.0 - the 2nd step will be wget https://github.com/munt/munt/archive/munt_2_3_0.tar.gz and first command of 3rd step will be tar -xzf munt_2_3_0.tar.gz
                  1 Reply Last reply Reply Quote 0
                  • sirhenrythe5thS
                    sirhenrythe5th
                    last edited by

                    Thank you Dave!

                    I will make a backup of my Image in the weekend and then start to install Munt following your tutorial.
                    Feedback will follow ;)

                    kind regards

                    -- Retro-Achievements Username: SirALX --
                    RetroRatio: 1.88
                    Started Games beaten: 2,47%
                    Site Rank: 4382/93743 ranked users (TOP 4.76%)
                    Last seen in [The Legend of Zelda: Lost in Time (HACK) [N64], exploring Hyrule at Night]

                    1 Reply Last reply Reply Quote 0
                    • A
                      atchoodev
                      last edited by

                      Hello,

                      Thanks for writing this. I had a minor problem with CMake not finding Glib2:

                      CMake Error at /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
                        Could NOT find GLIB2 (missing: GLIB2_LIBRARY GLIB2_INCLUDE_DIR
                        GLIB2_CONFIG_INCLUDE_DIR)
                      

                      In case anyone else is having that particular problem, this is how I fixed it:

                      sudo apt-get install libglib2.0-dev
                      

                      Best regards,

                      Andreas


                      Music Production, Retro computer enthusiast, App Development, Programming & Smart design
                      1 Reply Last reply Reply Quote 0
                      • A
                        atchoodev
                        last edited by

                        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)

                        1 Reply Last reply Reply Quote 0
                        • I
                          Impy
                          last edited by

                          Has anyone tried to compile munt for the Pi4?

                          What would the flags be for that case?

                          David87D 1 Reply Last reply Reply Quote 0
                          • David87D
                            David87 @Impy
                            last edited by David87

                            @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"
                            W 1 Reply Last reply Reply Quote 2
                            • I
                              Impy
                              last edited by

                              @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

                              1 Reply Last reply Reply Quote 1
                              • M
                                matthewtoney
                                last edited by

                                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.

                                M 1 Reply Last reply Reply Quote 0
                                • M
                                  matthewtoney @matthewtoney
                                  last edited by

                                  @matthewtoney Nevermind on that one - user error :)

                                  1 Reply Last reply Reply Quote 1
                                  • W
                                    walterg74 @David87
                                    last edited by

                                    @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:

                                    1. 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?

                                    1. 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?

                                    David87D 1 Reply Last reply Reply Quote 0
                                    • David87D
                                      David87 @walterg74
                                      last edited by David87

                                      1. 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 (run sudo -ior sudo bash to get into root shell).

                                      1. 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.

                                      1 Reply Last reply Reply Quote 0
                                      • B
                                        boolean
                                        last edited by boolean

                                        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)'
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • V
                                          vol.2
                                          last edited by

                                          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?

                                          1 Reply Last reply Reply Quote 0
                                          • retropieuser555R
                                            retropieuser555
                                            last edited by

                                            Just looking into getting MIDI working on PC9801, I'm using these flags but I get the error below. Any ideas what I'm doing wrong?

                                            export CXXFLAGS="-Ofast -march=armv8.2-a+crc -mtune=cortex-a76 -ftree-vectorize -funsafe-math-optimizations"
                                            
                                            export CXXFLAGS="-Ofast -march=armv8.2-a+crc -mtune=cortex-a76 -ftree-vectorize -funsafe-math-optimizations"
                                            
                                            

                                            Attempting to creat the cmake files this error occurs:-

                                            -- Check for working CXX compiler: /usr/bin/c++
                                            -- Check for working CXX compiler: /usr/bin/c++ - broken
                                            CMake Error at /usr/share/cmake-3.25/Modules/CMakeTestCXXCompiler.cmake:63 (message):
                                              The C++ compiler
                                            
                                                "/usr/bin/c++"
                                            
                                              is not able to compile a simple test program.
                                            
                                              It fails with the following output:
                                            
                                                Change Dir: /home/pi/munt-munt_2_7_0/build/CMakeFiles/CMakeScratch/TryCompile-VOC7v8
                                                
                                                Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_006d9/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_006d9.dir/build.make CMakeFiles/cmTC_006d9.dir/build
                                                gmake[1]: Entering directory '/home/pi/munt-munt_2_7_0/build/CMakeFiles/CMakeScratch/TryCompile-VOC7v8'
                                                Building CXX object CMakeFiles/cmTC_006d9.dir/testCXXCompiler.cxx.o
                                                /usr/bin/c++   -Ofast -march=armv8.2-a+crc -mtune=cortex-a76 -mfpu=neon-fp-armv8 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations  -o CMakeFiles/cmTC_006d9.dir/testCXXCompiler.cxx.o -c /home/pi/munt-munt_2_7_0/build/CMakeFiles/CMakeScratch/TryCompile-VOC7v8/testCXXCompiler.cxx
                                                c++: error: unrecognized command-line option ‘-mfpu=neon-fp-armv8’
                                                c++: error: unrecognized command-line option ‘-mfloat-abi=hard’
                                                gmake[1]: *** [CMakeFiles/cmTC_006d9.dir/build.make:78: CMakeFiles/cmTC_006d9.dir/testCXXCompiler.cxx.o] Error 1
                                                gmake[1]: Leaving directory '/home/pi/munt-munt_2_7_0/build/CMakeFiles/CMakeScratch/TryCompile-VOC7v8'
                                                gmake: *** [Makefile:127: cmTC_006d9/fast] Error 2
                                                
                                                
                                            
                                              
                                            
                                              CMake will not be able to correctly generate this project.
                                            Call Stack (most recent call first):
                                              CMakeLists.txt:2 (project)
                                            
                                            
                                            -- Configuring incomplete, errors occurred!
                                            

                                            Pi 5 4GB

                                            Retroflag GPI with raspberry pi zero 2 w/ wifi

                                            Retroachievements:- lovelessrapture

                                            mituM 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            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.