MIDI music problem

Found a bug in R'n'D? Report it here!

Moderators: Zomis, Flumminator

Post Reply
User avatar
Eizzoux
Posts: 181
Joined: Wed Oct 30, 2013 5:32 am
Location: Russia
Contact:

MIDI music problem

Post by Eizzoux » Fri Sep 30, 2016 8:00 am

I knew that these latest versions won't be fully compatible with Win7.
When I play some levelsets with MIDI music like BD2K3 and then choose some different levelset with different music (mp3, mod, xm, it and etc.) all sounds and music shuts down and I can't do anything with this silence. All these returns only when I load MIDI music in game again but shuts down again when MIDI music isn't playing during this time. I also can turn on sound only after restarting the system.
Sometimes it becomes very problematic (especially when I want to test some sound effects and just can't hear them)
Nothing in here...*

User avatar
Holger
Site Admin
Posts: 2904
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: MIDI music problem

Post by Holger » Fri Sep 30, 2016 8:39 am

I knew that these latest versions won't be fully compatible with Win7.
Generally, the latest R'n'D version (4.0.0.0 RC 3) should also be fully compatible with Windows 7. As far as I can see, everything is working fine (apart from the MIDI problem you described, which I indeed haven't tested yet).

If you should find anything that does not behave as expected with Windows 7 (besides that MIDI problem), please let me know! I have a (virtualized) Windows 7 test system available, so I should be able to test and (hopefully) fix such problems.

But now to the MIDI problem!
When I play some levelsets with MIDI music like BD2K3 and then choose some different levelset with different music (mp3, mod, xm, it and etc.) all sounds and music shuts down and I can't do anything with this silence. All these returns only when I load MIDI music in game again but shuts down again when MIDI music isn't playing during this time. I also can turn on sound only after restarting the system.
That really sounds weird! I haven't tested it yet, but will definitely do so, and I will report my own results here.

Generally speaking, MIDI support in SDL/SDL2 seems to get worse over time (or simply does not get updated). I have encountered strange problems on my Linux box (Ubuntu 12.04), where in-game MIDI music (as tested with BD2K3) works fine for some time, then suddenly starts making weird noise, so I have to stop music and start it again, which causes it to work again for some time (and then starts making that "noisy" sounds after some time again). This definitely did not happen before. I still have to test if this is a problem with the switch from SDL to SDL2, or if this is a problem with my current Linux installation. Besides this, there are even more problems with MIDI, like missing MIDI support for the Android version.

At the moment, I don't know if this situation will get better -- maybe nobody is interested anymore in playing MIDI music nowadays... :-/

A solution (that I don't like that much) would be to convert all existing MIDI music to MP3 (mainly BD2K3 again)...

User avatar
Eizzoux
Posts: 181
Joined: Wed Oct 30, 2013 5:32 am
Location: Russia
Contact:

Re: MIDI music problem

Post by Eizzoux » Mon Jan 16, 2017 3:12 pm

The problem with MIDI music is still exists and I found an interesting was how to avoid it:

If you're using classic music in Custom Artwork:
1. Play the level, enter any menu page or do something to make MIDI music play
2. Close the game immediately (music must stop playing right after closing the game)
3. Go to "C:\Users\*username*\Documents\Rocks'n'diamonds\"
4. Open 'levelsetup.conf' and change the levelset name (after 'last_level_series:') to 'rnd_tutorial_niko_boehm' and save
5. Launch the game (may be success)

If you're using custom MIDI music in Custom Artwork:
Paragraphs 1-3 are same
4. Open 'setup.conf' and find 'sounds_set:' and change the name of sounds set to 'snd_classic', then save
5. Launch the game (may be success too)
Nothing in here...*

User avatar
Eizzoux
Posts: 181
Joined: Wed Oct 30, 2013 5:32 am
Location: Russia
Contact:

MIDI music problem

Post by Eizzoux » Wed Jan 24, 2018 4:56 am

Only now I found out it happens only when MIDI track fades out to nothing. I mean when MIDI track changes to any other playable track, everything is fine, but if MIDI fades to nothing so all the game sounds just fades out with it, and there only way to return sound back - make MIDI music play again.
Here I made the special levelset for you to see hear what happens for me (I hope): https://yadi.sk/d/Erf_8ana3Rj8Lf
In the menu you can hear MIDI, in the levels 0-5 there are other tracks (mod,xm,it,s3m,wav,mp3). After entering any of these levels MIDI track will change to a music of level. But play level 6 and game will become silent.
Maybe it won't work for you, I'm not sure, but hope it will.
OS: Windows 7 Maximum
Nothing in here...*

User avatar
Holger
Site Admin
Posts: 2904
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: MIDI music problem

Post by Holger » Wed Jan 24, 2018 3:15 pm

The problem with MIDI music is still exists and I found an interesting was how to avoid it:
If I understand it right (after reading your last post from today), this procedure forces MIDI music from fading out (and therefore triggering the problem of silencing all other sounds), is this correct?
Here I made the special levelset for you to see hear what happens for me (I hope):
I will try this in my Windows 7 VM and see what happens!

If I can reproduce it, maybe I can find a way to solve or prevent this problem...

User avatar
Eizzoux
Posts: 181
Joined: Wed Oct 30, 2013 5:32 am
Location: Russia
Contact:

Re: MIDI music problem

Post by Eizzoux » Wed Jan 24, 2018 4:15 pm

Holger wrote:
Wed Jan 24, 2018 3:15 pm
If I understand it right (after reading your last post from today), this procedure forces MIDI music from fading out (and therefore triggering the problem of silencing all other sounds), is this correct?
Yeah, all game sound shuts down only if any MIDI tracks changes to the silence (empty tracks like in BD2K3 are not counting)
Nothing in here...*

User avatar
Holger
Site Admin
Posts: 2904
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: MIDI music problem

Post by Holger » Thu Jan 25, 2018 9:34 am

Haven't checked out your test level set on my Windows 7 VM yet, but did some googling on that problem -- seems that we are not alone with that issue:

https://stackoverflow.com/questions/586 ... ws-vista-7
https://www.doomworld.com/forum/topic/4 ... di-volume/
http://forums.winamp.com/showthread.php?t=320434

These days this problem apparently mainly affects DOOM ports running on Windows Vista and Windows 7 (some of them also using SDL_Mixer, just like R'n'D does), as DOOM's in-game music are also MIDI tracks (while most other such games use different music formats like MP3 etc., which do not cause this type of problem, as it is MIDI-specific).

BTW: I will also do some tests with your test level set on Windows 10, but I expect it to behave just like Windows 7 in this regard.

Maybe I can come up with some kludgy workaround, like fading out MIDI, then restarting that track with maximum volume again and immediately stopping it, just to bump up volume back to normal for all subsequent sounds. :shock:

User avatar
Holger
Site Admin
Posts: 2904
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: MIDI music problem

Post by Holger » Thu Jan 25, 2018 4:33 pm

Some links related to this problem from the SDL bug tracker:

https://bugzilla.libsdl.org/show_bug.cgi?id=3495
https://bugzilla.libsdl.org/show_bug.cgi?id=1767

The above would mean that changing the music volume in the R'n'D setup menu would also have an impact on sound volume when playing MIDI music. Can you reproduce this on your Windows box?

User avatar
Holger
Site Admin
Posts: 2904
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: MIDI music problem

Post by Holger » Fri Jan 26, 2018 11:00 am

OK, I was able to reproduce the problem using your test set "testing_midi" on both Windows 7 and Window 10! :shock:

It is even more obvious (visually) when having the Windows mixer opened next to the R'n'D window (can be opened using the context menu on the loud speaker symbol in the tray).

It even shows that playing non-MIDI music in the game does not totally help to prevent the problem! When looking closely at the R'n'D game volume in the mixer, starting a level with non-MIDI music causes the MIDI track from the main menu fade out (during the time it takes for screen fading from main menu to playing), which lowers the volume (and volume bar in the mixer). Up to this point, everything is fine. But then the non-MIDI in-game music starts, NOT bringing music and sound volume back to maximum! It stays at a low level (around 20-25% of maximum volume), so music and sounds can be heard, but are not as loud as they should. Music and sounds volume can be brought back to maximum with the mixer's volume handle. (But of course you do not want to do this each time you start a level!)

Also try the following: Disable screen fading in the graphics setup menu, and repeat the above test: Now music and sound volume in the game is higher (around 40-50% in my tests), because the in-game music and sounds now start earlier (because there is no screen fading between main menu and playing anymore), as the fading-out of the menu MIDI track is now stopped a bit earlier. Strange behaviour! And apparently (when reading the pages I linked to above) more of a WIndows Vista/7/10 problem than a SDL problem (and indeed not a program bug in R'n'D).

Nevertheless, I will do some tests if there is any possibility for a workaround to mitigate this strange problem! :-/

User avatar
Holger
Site Admin
Posts: 2904
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: MIDI music problem

Post by Holger » Fri Jan 26, 2018 5:18 pm

I've added the following workaround (only active in the Windows version):

- If MIDI music is _played_, it is always played with 100% volume (even if configured differently in the setup menu).
- If MIDI music is _faded_, it is immediately stopped instead, to prevent overall volume to be faded down, too.

This should prevent MIDI music from negatively affecting volume of all other sounds (or completely muting them) when MIDI is either played with lower music volume or fading out to complete silence, which also mutes everything else and, especially important, makes it impossible from within the game to return to normal volume for sounds and/or music without having to play MIDI with maximum volume (and then trying to stop it without fading again)! (The other way to bring back normal sound/music volume is to open the Windows mixer controls and changing the volume controls for the R'n'D process to maximum volume -- but this would be required after each and every MIDI track played in R'n'D that was faded out and therefore muted sounds and music again!)

Here's an executable with that workaround for testing:

https://www.artsoft.org/RELEASES/rocksn ... I-TEST.exe

I have tried this EXE with Windows 7, and it solves the problem for me! (Although MIDI tracks now stop abruptly instead of being softly faded out, and MIDI music cannot be played with any volume other than 100%.)

Could you try how it works for you? Are there still some places or actions where MIDI can mute all other sounds?!

Please let me know if it works, and I will incorporate that workaround into R'n'D and release a new patch version! :-)

User avatar
Holger
Site Admin
Posts: 2904
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: MIDI music problem

Post by Holger » Sat Feb 24, 2018 5:04 pm

Did you have a chance to test the workaround for that MIDI problem we talked about above?

You can now test this with the official 4.0.1.2 release (with your demo level set, for example) -- does this solve the problem for you? At least for me, it seems to fix that issue.

Post Reply