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

Playing X68000 games with MIDI music

Scheduled Pinned Locked Moved Ideas and Development
midilr-px68kx68000
25 Posts 4 Posters 3.8k 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.
  • E
    ecto
    last edited by ecto 4 Sept 2024, 13:22 17 Sept 2022, 17:13

    Ever since I listened to

    of Akumajou Dracula, I had the wish to do that on my Retropie.
    Recent events have led to being able to do just that!

    With this little post, I hope I can share my setup with anyone interested in the same thing. Be warned! this is highly experimental. Only do any of this, if you made proper backups of your system!

    Disclaimer: Without the work of everyone involved in the development of MIDI out for the lr-PX68K core, I could never share these results with you.

    Requirements:

    • A working munt installation. Note: in this tutorial, munt 2.2.0 gets installed. Just replace 2.2.0 with 2.7.0 in the tutorial, as 2.2.0did not work for me.
    • Of course you need the MT32 ROMs ripped from your MIDI module ;)
    • Some other midi sequencer like tiMidity or fluidsynth. I'm using tiMidity as it is supposed to be less resource hungry.
    • An appropriate soundfont. As the X68000 often uses the SC55 MIDI module, a matching soundfont would be nice!

    Installation:

    • Install the latest PX68K core. I did it from source, but maybe the binary is also up to date.
    • In /opt/retropie/configs/all/retroarch/config/PX68K you put a PX96K.cfgoverride file with the following content:
    midi_driver = "alsa"
    midi_output = "TiMidity port 0"
    
    • In the same directory, you put in an override for each game, that uses only MT32 music. I.e. Die Bahnwelt.cfg with the following content:
    midi_output = "Standard"
    
    • In /opt/retropie/configs/all/retroarch-core-options.cfg you enter/edit the following entries for the PX68K core (I'm not very sure, if these settings are needed... I've not had time to test this thoroughly.):
    px68k_adjust_frame_rates = "disabled"
    px68k_audio_desync_hack = "enabled"
    px68k_cpuspeed = "16Mhz"
    px68k_no_wait_mode = "enabled"
    px68k_push_video_before_audio = "enabled"
    px68k_midi = "enabled"
    px68k_midi_type = "LA"
    
    • Finally you need to start tiMidity and munt, whenever PX86K is started. For that I edited /opt/retropie/configs/all/runcommand-onstart.shto include
    if [ $1 = "x68000" ]
    then
       timidity -iA>&2 &
       sleep 2
       /usr/local/bin/mt32d -i 12 -g 0.5 >&2 &
    fi
    

    and /opt/retropie/configs/all/runcommand-onend.sh to include

    sudo pkill timidity
    sudo pkill mt32d
    

    I hope you have as much fun as I had, when I finally heard MIDI from X68000 game.

    EDIT
    I just found out, that almost everything started here also applies to midi music on the PC98 (lr-NP2kai core)!
    Happy gaming!

    K 1 Reply Last reply 31 Mar 2024, 23:14 Reply Quote 3
    • E ecto referenced this topic on 8 Nov 2022, 09:59
    • K
      kelvfimer @ecto
      last edited by kelvfimer 4 Jan 2024, 00:43 31 Mar 2024, 23:14

      @ecto thx for the guide :)

      I managed to set it up.

      Only point that I wanted to check with you is regarding the custom SC55.sf2 . How did you set it up in Timidity?

      I created a custom SC55.cfg based on GeneralUser.cfg. I copied all the content and replaced GeneralUser.sf2 to sc55.sf2.

      The point is that is sounding good but it is not sounding as great as in the video you posted.

      Please can you help me with a guide on how to create the sc55.cfg in the Timidity folder.

      thx
      KR

      E 1 Reply Last reply 1 Apr 2024, 22:47 Reply Quote 0
      • E
        ecto @kelvfimer
        last edited by 1 Apr 2024, 22:47

        @kelvfimer Hi, right nowI'm on vacation and away from my pi. I'll have a look when I come back home next week. I recently switched to a pi5, and I've not sorted out every problem, especially sound related, so I can't promise a solution to your problem. ;)

        K 1 Reply Last reply 2 Apr 2024, 23:32 Reply Quote 0
        • K
          kelvfimer @ecto
          last edited by 2 Apr 2024, 23:32

          @ecto No worries take your time. Basically is the timidity.cfg file that is sourcing another cfg file for the sf2 in this case SC55.cfg. I found one on internet but I wanted to know how to build it. thx

          E 1 Reply Last reply 3 Apr 2024, 07:03 Reply Quote 0
          • E
            ecto @kelvfimer
            last edited by ecto 4 Mar 2024, 08:05 3 Apr 2024, 07:03

            @kelvfimer Now that you mention it: iirc I just put the sc55 soundfont directly into the timidity.cfg file right at the end, replacing any soundfont entered there.
            Of course it's important to have a soundfont resembling the original sc55, if you want it to sound like in the video.
            Mine was from a doom9 (sp?) forum post, which tried to be a close to the sc55 as possible. Look for zz_denis.

            F 1 Reply Last reply 7 Apr 2024, 12:15 Reply Quote 0
            • F
              Folly @ecto
              last edited by Folly 4 Jul 2024, 13:26 7 Apr 2024, 12:15

              @ecto

              I had a look at this too running it on my pi4.

              Problem with your first post is that there seems to be no real good tutorial link.
              Nevertheless I got it working searching.
              A good link to install munt was found over here.
              I used these flags instead :

              export CCFLAGS="-O2 -march=native"
              export CXXFLAGS="-O2 -march=native"
              

              That way you will be able to compile on much more devices.
              Perhaps an idea to do the tutorial directly in your first post.
              I know there is one on the forum but that one is too old and only for PI3.

              Anyway, I missed explicitly that you either have to choose between MT-32 and Timidity, though along the way it became obvious.
              If you go for timidity you don't even have to install munt, just install timidity with (if it is not installed):

              sudo apt install timidity
              

              So I find it strange that you load both in the runcommand-onstart.sh.
              I would only add one depending on what the choice is.

              Btw. isn't it better to put the pkill commands in the runcommand-onend.sh, looks like it's a typo, right ?

              Finding the configs was also a search, found that they are in /etc/timidity/ and have to be edited as root user.
              In the configs you will also find the folder where to put the SC55 sf file (also as root user).

              So I tested SC55 with timidity using SC55_zzdenis_v0.5.sf2 using fluidr3_gm.cfg as a base for sc55.cfg and replacing the soundfont with the SC55 one.
              (so running option 3 in the game and using midi_output = "TiMidity port 0" in de retroarch.cfg overriding only for x68000 in /opt/retropie/configs/x68000)

              And I tested MT32 with munt.
              (so running option 2 in the game and using midi_output = "Standard" in de retroarch.cfg overriding overriding only for x68000 in /opt/retropie/configs/x68000)

              My experience is that MT-32 sounds much better and left and right volume is more even that with SC55(timidity)
              Timidity stutters sometimes and left volume is too low.

              Hope you don't mind some positive feedback, at least that's how is meant.

              K E 2 Replies Last reply 8 Apr 2024, 17:32 Reply Quote 0
              • K
                kelvfimer @Folly
                last edited by 8 Apr 2024, 17:32

                Hello @Folly

                I do not agree the guide is ok and thx to @ecto I was able to enable midi at pk68x.

                For better sound you have to use the cfg from this page https://www.vogons.org/viewtopic.php?t=21644 it sound good but not super good. I renamed it as sc55.cfg and I refer to it from the timidity.cfg file

                The thing that I wanted to check with @ecto is , how is the cfg file made?

                thx
                Kind Regards

                1 Reply Last reply Reply Quote 0
                • E
                  ecto @Folly
                  last edited by 9 Apr 2024, 12:22

                  @Folly Thanks for your feedback. Also the updated munt installation procedure!

                  I'm back at my Pi and tested a little more.
                  Munt (mt32d) has a problem with my setup: as soon as I start the demon I constantly get a lot of Output Buffer Underrun errors. There might be something wrong with my ALSA setup. Idk how to get rid of it... :( Also there seems to be a very big delay between when the music is supposed to start and when ist starts (about 3s-5s).

                  @kelvfimer I've looked in my timidity.cfg and the only entry I have there is this

                  soundfont "/usr/share/sounds/sf2/SC55.sf2"
                  

                  where SC55.sf2 is the zzdenis soundfont renamed.

                  I think the output sounds good, there is no delay in the sounds, but I get the occasional Buffer Underrun error.
                  If anyone of you know, what the problem might be, please tell me ;)

                  Ah, and I found that I needed to install pulseaudio to have the PX68k core work with sound at all when the midi demons are running.

                  F K 3 Replies Last reply 9 Apr 2024, 13:28 Reply Quote 1
                  • F
                    Folly @ecto
                    last edited by Folly 4 Sept 2024, 14:30 9 Apr 2024, 13:28

                    @ecto

                    From what I know pulseaudio is the default nowadays.
                    Though that part is always a bit of mystery to me.

                    I will play with it again if I can.

                    Btw. I have a Roland E-38 keyboard and was curious if I could get something out of it.
                    With this command :

                    aconnect -l
                    

                    I was able to find the ports and directly connect it from within the configs of lr-pk68k, so without using timidity or munt. (did it on my pi5)

                    Sound was a bit better as from timidity with sc55.
                    Though it looks like lr-pk68k is not perfect in outputting the midi stream.

                    mituM 1 Reply Last reply 9 Apr 2024, 15:03 Reply Quote 1
                    • mituM
                      mitu Global Moderator @Folly
                      last edited by mitu 4 Sept 2024, 16:04 9 Apr 2024, 15:03

                      @Folly said in Playing X68000 games with MIDI music:

                      From what I know pulseaudio is the default nowadays.

                      No, PipeWire is the new kid on the block (!), though it offers a PulseAudio compatible API so that programs think they talk to a PulseAudio server.

                      F 1 Reply Last reply 9 Apr 2024, 16:48 Reply Quote 1
                      • F
                        Folly @mitu
                        last edited by 9 Apr 2024, 16:48

                        @mitu said in Playing X68000 games with MIDI music:

                        @Folly said in Playing X68000 games with MIDI music:

                        From what I know pulseaudio is the default nowadays.

                        No, PipeWire is the new kid on the block (!), though it offers a PulseAudio compatible API so that programs think they talk to a PulseAudio server.

                        Ah, good to know, thanks !

                        1 Reply Last reply Reply Quote 0
                        • F
                          Folly @ecto
                          last edited by Folly 4 Oct 2024, 16:09 9 Apr 2024, 19:54

                          @ecto

                          I discovered something but not tested it yet.
                          When selecting option 2 MT-32 it uses "LA Format" and when selecting option 3 it uses "GS Format".

                          I recon that when using option 3 (SC55) you have to use this in the core options :

                          px68k_midi_type = "GS"
                          

                          Something to test don't you think ?

                          Some info over here about GS :
                          https://www.cybermidi.com/helpdesk/knowledgebase.php?article=47

                          Edit :
                          (tests done with selecting option 3 in the game and using timidity with SC55)
                          Tested the core option with the midi tree version, as that version has the px68k_midi_type core option, but seems to have no impact.
                          Also tested the original lr-pk68k version which doesn't have the px68k_midi_type core option and there seems to be no difference in the sound quality versus the "midi tree version"

                          1 Reply Last reply Reply Quote 0
                          • K
                            kelvfimer @ecto
                            last edited by 9 Apr 2024, 20:22

                            @ecto Hello pls check the attached cfg file in the url https://www.vogons.org/viewtopic.php?t=21644

                            An extract is the following. So I assume you don't set up the bank line, Am I right?

                            dir your sf2 folder

                            soundfont "DJ Tony's Roland SC-55 1.1.sf2" amp=100 pan= modpitch=0
                            soundfont "DJ Tony's Roland SC-55 1.1.sf2" amp=100 pan= fc=8000 q=25
                            bank 0
                            0 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 0
                            1 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 1
                            2 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 2
                            3 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 3
                            4 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 4
                            5 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 5
                            6 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 6
                            7 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 7
                            8 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 8
                            9 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 9
                            10 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 10
                            11 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 11
                            12 %font "DJ Tony's Roland SC-55 1.1.sf2" 0 12

                            1 Reply Last reply Reply Quote 0
                            • F
                              Folly
                              last edited by Folly 4 Nov 2024, 16:05 10 Apr 2024, 19:09

                              @ecto @kelvfimer

                              As far as I can see now it's quite obvious that the code of both the "original master" and the "midi tree" have issues with midi, revealing in tempo changes.

                              I connected my real Roland E-38 synthesizer keyboard to my PI5 and tested MAME and the original lr-px68k.

                              On my PI4 it became clear that both "original master" and the "midi tree" have the same issue so I figured I could just use the original master.
                              My keyboard detected "GS mode" with both emulators so that is OK.
                              This makes it also clear that the "original master" can provide the GS mode.

                              With MAME I have almost perfect sound from the keyboard, it sounds really great :-) !
                              With lr-px68k I had tempo changes again :-( .

                              This makes it clear that the issues are mostly coming from the lr-px68k core.

                              Using timidity was also better with MAME but I still have more volume on the right side.
                              Seems to be a timidity problem.

                              For mame I used this runcommand adding midi and outputting it to my keyboard :

                              /opt/retropie/emulators/mame/mame -rompath /home/pi/RetroPie/BIOS/mame\;/home/pi/RetroPie/roms/x68000 -v -c -ui_active -statename x68000/"akumajou dracula (1993)(konami)(disk 1 of 2)" x68000  -flop1 "/home/pi/RetroPie/roms/x68000/akumajou dracula (1993)(konami)(disk 1 of 2).dim" -flop2 "/home/pi/RetroPie/roms/x68000/akumajou dracula (1993)(konami)(disk 2 of 2).dim" -exp1 x68k_midi -midiout 'USB Device 0x1acc:0x0a MIDI 1'
                              

                              or using basename :

                              /opt/retropie/emulators/mame/mame -rompath /home/pi/RetroPie/BIOS/mame\;/home/pi/RetroPie/roms/x68000 -v -c -ui_active -statename x68000/"akumajo" x68000   "akumajo" -exp1 x68k_midi -midiout 'TiMidity port 0'
                              

                              In the last runcommand you can also see that the option -midiout can also hold the timidity port and can be used in both runcommands.

                              1 Reply Last reply Reply Quote 1
                              • F
                                Folly
                                last edited by Folly 4 Nov 2024, 16:03 11 Apr 2024, 08:49

                                @kelvfimer

                                I tested the first timidity.cfg for DJ Tony's SC-55 sound-font from here.
                                Renamed the config to DJ_Tony_Roland_SC-55_1.1.cfg and placed that config inside the timidity.cfg.
                                Also used that soundfont.
                                Added the proper dir inside DJ_Tony_Roland_SC-55_1.1.cfg :

                                dir /usr/share/sounds/sf2
                                

                                And removed the line holding --rtsyn-latency=0.04 as timidity didn't understand it.

                                Now I have a proper sc-55 config and left and right volume is in balance and has proper stereo.

                                Edit 1:
                                Converting the config for use with the zz_denis soundfont works perfectly.

                                Edit 2:
                                I can now also confirm that this setup works on my x86_64 VM with running on lr-px68k.
                                No timing issues whatsoever so lr-px68k seems to do the job OK on a regular PC's.

                                K 1 Reply Last reply 12 Apr 2024, 14:27 Reply Quote 1
                                • K
                                  kelvfimer @Folly
                                  last edited by 12 Apr 2024, 14:27

                                  @Folly Cool. So it's also working for you :) .

                                  My point is how to set up that timidity.cfg and sd.cfg what's the way to tune it etc.

                                  I wanted to have the same for SC88 but I don't find it.

                                  My demand to @ecto is help to know how to build the timidity.cfg file and the SCXX.cfg file

                                  thx

                                  F E 2 Replies Last reply 13 Apr 2024, 08:17 Reply Quote 0
                                  • F
                                    Folly @kelvfimer
                                    last edited by 13 Apr 2024, 08:17

                                    @kelvfimer

                                    Here is the manual where you might find some useful information.

                                    1 Reply Last reply Reply Quote 0
                                    • E
                                      ecto @kelvfimer
                                      last edited by ecto 15 Apr 2024, 09:28

                                      @kelvfimer said in Playing X68000 games with MIDI music:

                                      My point is how to set up that timidity.cfg and sd.cfg what's the way to tune it etc.

                                      As I've written before: The only (uncommented) line in my timidity.cfg is:

                                      soundfont "/usr/share/sounds/sf2/SC55.sf2"
                                      

                                      I have no SC55.cfg of any kind. Maybe my midi output is not configured correctly, but I can hear midi music in several x68000 and pc98 games. They seem so sound correctly, but indeed I also have a slightly irregular midi output (it sometimes slows down for some notes).

                                      The only real problem I have are buffer underrun errors in the logs. I'm not sure if that corresponds to the timing issues, but it might.
                                      I'm not sure how to get rid of them, but I would think that the midi daemons have to run in or close to real time.

                                      1 Reply Last reply Reply Quote 0
                                      • topic:timeago-later,7 days
                                      • E
                                        ecto
                                        last edited by 22 Apr 2024, 10:13

                                        @Folly @kelvfimer Just a small thing I noticed: the tempo changes with the lr-p68k core seem to have gotten a little better after I changed the cpu frequency in the core settings to 25MHz. Maybe you can try that, too.

                                        K 2 Replies Last reply 8 Jun 2024, 19:22 Reply Quote 1
                                        • topic:timeago-later,2 months
                                        • K
                                          kelvfimer @ecto
                                          last edited by 8 Jun 2024, 19:22

                                          @ecto cool I need to check :) thx for the advice . Only issue for example Castlevania at 25 MHz has glitches and you must run it at 10 MHZ

                                          1 Reply Last reply Reply Quote 0
                                          9 out of 25
                                          • First post
                                            9/25
                                            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.

                                            This community forum collects and processes your personal information.
                                            consent.not_received