Menu

#674 Midi music play only one time

Always occurs!
open-accepted
None
6
2023-02-10
2021-03-15
No

Hello, I have a problem with the MIDI music in the game - it only plays once. There is no looping. I have already searched through many options but to no avail. Please help with this topic, if you need to send the appropriate configuration files. I have the latest version of Doom Legacy and Windows 10 20H2 and the sound card is integrated Realtek HD Audio. Greetings.

Discussion

  • Wesley Johnson

    Wesley Johnson - 2021-03-17
    • assigned_to: Wesley Johnson
     
  • Wesley Johnson

    Wesley Johnson - 2021-03-17

    I do not have Windows 10 to test. I can test this on WinXP.
    Code development is done on Linux.

    When the song is done, the MIDI player will drain the MIDI queue and wait for the response from the system. It is likely that Windows has changed again and is not providing the usual response.
    It would be notable if other Windows10 20H2 users experience the same problem.
    What is the release date of that version of Windows10.

    I assume that the program does not hang entirely.
    The default MIDI synthesizer on Windows is provided by Microsoft. Because of its flaws, some people are installing FluidSynth.

    I don't think there are any MIDI config settings for the SDL port, so your config settings file would not be of help. The audio device would only be important if it handled the MIDI stream itself, and modern sound cards use a software synthesizer instead.

    I will look at what can be done to make this more resistant to Microsoft updates.

     
  • Wesley Johnson

    Wesley Johnson - 2021-03-27

    The code is not what I remember, but then again I got 4 versions of MIDI playback to maintain.

    I have reproduced this on WinXP. I had not noticed it before as I don't play very long on that machine, and when I do, it is to debug something else specific.
    It does repeat the song after a couple minutes.

    This is an SDL mixer issue with the Windows MIDI player.
    DoomLegacy gives SDL the parameter to repeat the song, and SDL does the repeating.
    A search shows that other SDL users have had trouble with SDL MIDI playback.

    An inspection of the SDL code shows that SDL is waiting for the done playing signal from the Windows native MIDI player. When SDL gets that signal it will check the loop count and conditionally repeat playing the song. That test is a simple look at a status variable gotten from the WIndows MIDI player.
    It must be that Windows Midi player is slow to signal that it is done playing.
    As this is all internal to SDL, there is no way for me to interfere or even diagnose this much better.

    SDL will check for TiMidity first, and if that is not present then will use Windows native MIDI.
    I suggest installing TiMidity or some other Midi player, as Windows native MIDI has more than a few known problems.

    I do not know of any way to fix or even influence this problem.
    SDL detects and supports other MIDI players, like FluidSynth and TiMidity.
    It works perfectly with TiMidity on Linux.

     
  • Wesley Johnson

    Wesley Johnson - 2021-03-27
    • status: open --> open-wont-fix
    • Priority: 5 --> 3
     
  • lantern424

    lantern424 - 2023-01-03

    Hi, please, could you review this music issue? Of the Windows 32-bit versions available from Sourceforge this music bug do occure for me in versions:

    1.48.12
    1.48.10
    1.48.4 (2020-05-16)
    1.47.2 (2018-08-16, exe setup)

    But the bug does not happen in:

    1.46.3 (2017-03-09) and earlier

    And all those Doom Legacy versions use the same SDL version. SDL.dll: 1.2.14.0; SDL_mixer.dll: 1.2.11.0. I can repeat this on Windows 8.1 64-bit and 10 22H2 64-bit.

    Here's Audacity/WASAPI recording of the Doom2 MAP01 music on 1.48.12 (mp3 mono, 6 minutes, zipped 12.5 MB):

    https://www.dropbox.com/s/dgzslqmxve8hcw0/doom2_d_runnin_legacy14812.zip?dl=1

    The music track plays back full length (3:50) but around at half way (1:58) there starts to play a low piano instrument which should not be in there. After the track has ended (at 3:50) the piano keeps playing solo until the whole track restarts (at 5:48).

    If the Doom2 D_RUNNIN in converted into a midi file and other instruments are silenced in a MIDI editor, it appears that the piano tune is the original "34 - Picked Bass" instrument turned into "1 - Piano 1" and started playing from the middle of the track. The real "34 - Picked Bass" doesn't appear to play at all during the whole time(?) It should be heard from the beginning.

     
  • Wesley Johnson

    Wesley Johnson - 2023-01-03

    I listened through your recording, and it is as you describe. That is the first time I have heard that kind of strange playback. I listened through Map01 on my copy of DoomLegacy 1.48.12 on Linux and it played normally. I use Doom2 map01 for just about all my testing, so I have heard that track thousands of times. I have never heard it behave like your recording.

    DoomLegacy translates the music lump from MUS to MIDI, and hands it off to SDL Mixer. It does not do anything with the music after that, so it cannot add or play a track badly.

    I assume you are using the Win32 binary for SDL 1.2. That is compiled with SDL Mixer 1.2.8.
    A copy of that SDL library is shipped with the DoomLegacy binary, and should be in the same directory as the DoomLegacy binary.

    I can check the playback on the WinXP machine, but I use Doom2 Map01 for testing on that machine too. I have not heard anything like this.
    There are some outputs I could check, but they are going to be difficult and will take some time.
    I will check version 1.46.3 on the XP for any audible differences, like the piano not being missing.
    Do not know how something could go wrong with SDL on windows, but not show up with SDL on Linux.

    I can make wild guesses and suggestions.

    1. If you have a newer SDL 1.2 versions on your machine, then rename those SDL dll that are in the DoomLegacy directory (or move them somewhere else) so that your newer libraries are used.

    2. Try chocolate doom or another SDL Doom port, to hear if it does the same thing.

    3. The native windows MIDI player is known to mess up one of the MIDI instruments, which I remember was described as a piano instrument. It would be missing in the playback. It has been doing this for years. This could be what you are experiencing.

    I recommend FluidSynth as a replacement. Fluidsynth sounds different but from what I have read it plays all the instruments. Perhaps a different wavepak would make a difference.

     

    Last edit: Wesley Johnson 2023-01-03
  • lantern424

    lantern424 - 2023-01-04

    I noticed that it might be the mus files that have problems in playback. Midi files appear to play without problems in Doom Legacy 1.48.12.

    I took a short 26 second excerpt of a midi file, converted it with midi2mus.exe to a mus file and put it in a wad as D_RUNNIN. While the midi version plays back fine the mus version starts going wrong after 13 seconds and it turns silent after 26 seconds. The mus version bugs also in Doom Legacy 1.46.3 even though the Doom2 MAP01 music plays fine with it. But other sourceports have troubles with neither of them.

    The midi/mus test wads:
    https://www.dropbox.com/s/0ijazkmgngvi9fo/midi-mus.zip?dl=1

    The original midi file is from Boomedit.wad:
    https://www.doomworld.com/idgames/themes/TeamTNT/boom/boomedit

    I tried sdl.dll versions 1.2.14.0 and 1.2.11.0 with Doom Leagcy 1.48.12 but nothing changed. Of the other source ports I tried these and the music plays without problems.

    Chocolate-Doom 1.2.1 (2008-12-10, sdl.dll 1.2.12.0)
    Chocolate-Doom 1.3.0 (2010-02-10, sdl.dll 1.2.14.0)
    PrBoom-plus 2.4.8.1 (2006-12-26, sdl.dll 1.2.11.0)
    PrBoom-plus 2.4.8.2 (2007-10-16, sdl.dll 1.2.12.0)
    PrBoom-plus 2.4.8.3 (2008-08-23, sdl.dll 1.2.13.0)
    PrBoom 2.4.7 (2006-11-19, sdl.dll 1.2.9.0 )
    PrBoom 2.5.0 (2008-11-09, sdl.dll 1.2.13.0)

     
  • Wesley Johnson

    Wesley Johnson - 2023-01-05
    • status: open-wont-fix --> open-accepted
    • Priority: 3 --> 6
     
  • Wesley Johnson

    Wesley Johnson - 2023-01-05

    Thanks for the detailed report. I am going to assume that the DoomLegacy qmus2mid has acquired a bug. It probably was during a cleanup at svn 1059, or at svn 1313.
    Functionality was not changed, but never know what kind of errors from little changes can occur with C.

     
  • Wesley Johnson

    Wesley Johnson - 2023-01-06

    I have added some midi debug logging to a version of DoomLegacy.
    Please run the DoomLegacy at filebin.
    Enter map01, then quit. Send the file "midi_dump" by putting it as an attachment here.

     

    Last edit: Wesley Johnson 2023-01-06
  • lantern424

    lantern424 - 2023-01-06

    Here:

     
  • Wesley Johnson

    Wesley Johnson - 2023-01-11

    There will be a slight delay.

    Have been writing a MIDI dump code reader to read the output of the MIDI dump. It is proving to be difficult.

    Have analyzed the output of Linux and of the WinXP, and they seem to be identical, except that the WinXP code blocks some of the MIDI compression. This may be down to something in the way that the native MIDI player behaves.

    I have realized that many of those other Doom ports that are for windows, have done things like embedding a MIDI player (like TiMidity) in the Doom port. Do not know for sure which do that, or if there are any that do a straight-forward conversion from MUS to MIDI like the original did.

     
  • Wesley Johnson

    Wesley Johnson - 2023-01-13

    The MIDI dump reader seems to be working now.
    The midi_dump makes sense and there does not seem to be anything that could cause a problem.
    The MIDI analyzed shows that Linux MIDI output and Windows MIDI output are identical, except that compression (running status) is disabled for Windows platforms. You midi_dump and my WinXP midi_dump match exactly.

    Do you have any easy way on Windows to capture the MIDI output of one of those other Doom ports ? It may take a while to get the sound tools I have, installed and working again.

    Need to figure out where in the MIDI dump is that piano.

     
  • lantern424

    lantern424 - 2023-01-15

    I have realized that many of those other Doom ports that are for windows, have done things like embedding a MIDI player [...] Do not know for sure if there are any straight-forward conversion from MUS to MIDI like the original did.

    Not even the first Chocolate-Doom?
    https://www.chocolate-doom.org/downloads/0.0.1/

    Do you have any easy way on Windows to capture the MIDI output of one of those other Doom ports ?

    The same way as those midi_dumb files? No. - At the moment only by recording the music itself.

    The MIDI analyzed shows that Linux MIDI output and Windows MIDI output are identical, [...] Your midi_dump and my WinXP midi_dump match exactly.

    The midi_dumb I posted was from Windows too.

    A further note: On Doom Legacy 1.48.12/Windows from Doom2 MAP20 and MAP21 musics you can hear from the beginning that some instrument is missing. Please, could you compare Doom Legacy 1.48.12 music to PrBoom 2.5.0 or Chocolate Doom 0.0.1 on WinXP?

    On 1.48.12:

    Doom2 MAP20; D_MESSAG; length 4:38: The instrument "116 Taiko" doesn't play from the start. But around at 1:57 it starts to play it's notes from the beginning and it has been turned to "0 Piano 1/Acoustic Grand Piano" instead. At 4:38 all the other istruments have finished their parts but the piano will continue playing it's part solo for around 2 minutes. Then the whole track starts again.

    Doom2 MAP21; D_COUNT2, length 3:49: One of the nine "45 Tremolo/Pizzocato Strings" is missing from the start. Around at 1:57 the missing instrument starts to play it's notes from the beginning and again it has been changed into "0 Piano 1" instead. Other music will finish at 3:49 but the Piano will keep playing it's notes solo for around 2 minutes more.

    https://fmslogo.sourceforge.io/manual/midi-instrument.html

    --- So it seems that, never mind the music file length, one of the instruments is delayed around 1:56-1:59 from the start. It then starts to play but as instrument "0 Piano 1/Acoustic Grand Piano" instead and it keeps on playing it's full lenght, last minutes as solo. Then the music will restart. The delayed instrument in Doom2 MAP01, MAP20 and MAP21 music files (the mus file turned to a mid file) is always the first instrument on the midi file list.

     
  • Wesley Johnson

    Wesley Johnson - 2023-02-01

    I have created a doomlegacy with some debug controls.
    Please test with, varying the controls, to discover what affects the playback in Win 11.

    doomlegacy dl_qmus_02 debug binary
    updated 2/7/2023

    This is a debug version of doomlegacy 1.48.12.
    It has added 3 control vars, that are accessed by the drop down console.
    They are not in the menus. They can only be accessed in the drop down console.
    They are saved in the config with the other control variables.

    These enable things that I found in the DoomLegacy midi stream that
    did not appear in the PrBoom midi data stream.

    Please enable and disable these to test which it is that bothers the
    Win11 midi player.

    midi_compress 1
    This enables the compression of the midi stream.

    midi_create_program 1
    This enables the insertion of a blank create_program midi command in
    the first track.

    midi_track_pad 1

    This enables a 33 byte 0 padding of the first data track.
    It seems to be 10 repeats of 0,0,0, which probably did not do
    anything back in 1998.

    This is now shown as Track 1 (where temp is in TRACK 0), but will be Track 0 in midi_dumps that
    had the tempo in TRACK_FIRST.

     

    Last edit: Wesley Johnson 2023-02-07
  • lantern424

    lantern424 - 2023-02-07

    This is from Windows 10 22H2.

    It sounds like that Doom2 MAP01/MAP20 music plays without problems when:
    midi_compress 0; midi_create_program 0; midi_track_pad 0
    midi_compress 1; midi_create_program 0; midi_track_pad 0
    midi_compress 0; midi_create_program 1; midi_track_pad 0
    midi_compress 1; midi_create_program 1; midi_track_pad 0

    If the settings are as these two the music bugs the same way as it does in 1.48.12. One of the instruments is missing until it starts playing as a piano around 1:57 from the start:
    midi_compress 1; midi_create_program 0; midi_track_pad 1
    midi_compress 1; midi_create_program 1; midi_track_pad 1

    With these two settings the music bugs but in a different way. The piano starts playing from around 1:43 from the start:
    midi_compress 0; midi_create_program 0; midi_track_pad 1
    midi_compress 0; midi_create_program 1; midi_track_pad 1

     
  • lantern424

    lantern424 - 2023-02-09

    Oh, here are the midi_dump_MR files generated from each combination. The files are named as "000_midi_dump_MR", "100_midi_dump_MR", ... where the numbers are in order of: midi_compress, midi_create_program, midi_track_pad settings.

     
  • Wesley Johnson

    Wesley Johnson - 2023-02-10

    SVN 1648
    A patch has been made, which removes the track pad, and makes the "Program_Change" and control variable option (default Off). The Midi compression is also enabled by a control variable which is default On. This should improve the MIDI for Win10 and Win11.

    Thank you for your tests and reports.

    Please create a new Bug report for things like these, that are not identical to the original bug report. I cannot close this bug report because this does not fix the issue stated in the original bug report. It makes it more difficult to track when bug reports are combined.

     

    Last edit: Wesley Johnson 2023-02-10

Log in to post a comment.