Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sound issues both in SDL1 and SDL2 versions #15

Open
sheepo99 opened this issue Aug 7, 2019 · 18 comments
Open

Sound issues both in SDL1 and SDL2 versions #15

sheepo99 opened this issue Aug 7, 2019 · 18 comments

Comments

@sheepo99
Copy link

sheepo99 commented Aug 7, 2019

Hello, me again :)

I found a couple of different sound issues for both SDL1 and SDL2 version. I should note I have the latest version of Timidity installed.

SDL1 - the music is only displaying the background channels not the full instruments. Please see video attached below.

hydrasoundsdl1.mp4.zip

SDL2 - the music plays fine for the most part, but it generates a lot of error messages on the console which really slows the loading times. When switching tracks mid game, it also gets stuck on notes sometimes. Please see video attached below. Note gets stuck at the end of video.

hydrasoundsdl2.mp4.zip

@ptitSeb
Copy link
Owner

ptitSeb commented Aug 7, 2019

All the playing is done by SDL and Timidity. I have no control on what is happening.

So as a workaround, I converted all midi to ogg and added an option to switch between ogg and midi. The default is now OGG, as it should be less problematic.

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

Hmm, this is a good idea, but the OGG files you included sound like the inferior SDL1 version with only the back channels. Can you let me know which program are you using to convert MIDI to OGG, so I can try and make better ones?

One more thing: changing the music effectively requires you to reset the game. A warning should be printed on the screen for this purpose, saying something like "This change will require you to reset the game. All unsaved data will be lost. Continue? (Y/N)."

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

Found the problem. It's the Timidity and FluidSynth soundfonts.

SDL1 version defaults to Timidity whereas SDL2 defaults to FluidSynth. Both applications have very different soundfonts. The Timidity one appears to be very limited and lacking half of the instruments. The FluidSynth soundfont generates conflicts of equivalence which likely cause the weird stuck notes.

I'm going to try converting the .mid files to OGG using the better FluidSynth soundfont, and upload them ASAP.

@ptitSeb
Copy link
Owner

ptitSeb commented Aug 7, 2019

Ah yes, I converted with Timidity, it was most handy tool I had on hand. I'll also look for a better conversion tool.

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

Already converting with FluidSynth :) I'll upload the files in 5 mins or so.

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

There you go. It sounds good now. I compared all the files with the original midi, and the sole difference is in nazo.mid/nazo.ogg, where the ogg file for some reason plays faster when converted. I could not find a way to make it exactly the same, but feel free to try. Here's the guide I used:

https://wiki.archlinux.org/index.php/FluidSynth#How_to_convert_MIDI_to_MP3/OGG

And the converted files:

removed see below

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

Oops, forgot to include main06. Please redownload the archive here. :)

ogg soundtrack fluidsynth.zip

@ptitSeb
Copy link
Owner

ptitSeb commented Aug 7, 2019

Here is a version of main01 converted on my windows machine, with my CreativeLabs sound card sf2. Which one do you prefer?
main01.zip.txt (rename to zip)

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

The Windows font sounds better, I have to admit. :) For the sake of keeping it as close to the original as possible, let's use the converted versions from the Windows soundfont then.

One more thing that comes to mind is that at least the files converted from the Linux soundfonts seem to have inherited some of the volume issues. It may be a good idea to equalize the .ogg files.

@ptitSeb
Copy link
Owner

ptitSeb commented Aug 7, 2019

About equalize the file, well, yeah, I agree, but I'm not sure how to do that.

For the Confirmation, well, that's a lot of change in the code. The GUI is not super customizable in it's current state, and putting a confirmation screen will make me do quite some work. Not sure I'll do that.
If, in other changes, I also get to need a new confirmation screen, that I'll work on something.

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

Also, for the GNU/Linux soundfont, is it possible to make the game load OPL-3_FM_128M.sf2 instead by default? It has a very unique, more DOS-like sound, but it doesn't appear to have volume issues and I think it comes by default on most linux installations, meaning one wouldn't require Timidity. It sounds like a more stable default option for those who want to rely on midi.

For the confirmation screen, maybe you can instead just print the message and have the player reset manually i.e "For these changes to take effect, please reset the game."

@ptitSeb
Copy link
Owner

ptitSeb commented Aug 7, 2019

Mmm OPL3, old good adlib soundfount :)
Ok, I'll check if I can some parameter to prioritize this soundfont. I'm pretty sure you can do it in command line, prior to launching, with SDL_SOUNDFONTS=/PATH/TO/OPL-3_FM_128M.sf2, but having it automatic would be nice.

For the confirmation, it's not a reset, it's a change in music (like, if you enter a boss lair, it will start the new music in the newly selected format). I could restart the music myself during the change, but I need to change memory management for the music first. I'll probably spend some time in that direction.

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

The more I try the OPL adlib the more I like it. It seems VERY stable volume-wise, and sounds great too. It's a real no-nonsense approach.

For the confirmation, it's not a reset, it's a change in music

That's a bit a messy, having the game pulling the carpet on the sound mid game, but indeed, something that can be handled in the future.

On a side matter, although a debian package is still out of the picture until we get asset clearance, an universal AppImage is something that I could do anytime. :) I'll see if I can get it to work in the future.

@ptitSeb
Copy link
Owner

ptitSeb commented Aug 7, 2019

I'll see if the change of music in mid-air is ok. As the music pause during option screen, I think it can work.

Yes, AppImage. I have setup an automatic build of an AppImage for another one of my project: stuntcarramake.

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

Yes, AppImage. I have setup an automatic build of an AppImage for another one of my project: stuntcarramake.

Alright, no need for me to get in the middle then. :)

I just noticed, when using OGG files the music volume tends to be disproportionately lower than the sound volume, This depends on the track if I'm using the fluidsynth soundfonts, but it's universally lower with OPL-convered OGGs. I think a volume config option for sound effects, similar to the music one, will also be necessary.

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

Also the windows conversion for main01 you uploaded, does not seem to have the volume issues! Can you try converting the remaining tracks? If the sound volume is the same on all files then equalization won't be necessary.

@ptitSeb
Copy link
Owner

ptitSeb commented Aug 7, 2019

It's already done, all ogg uploaded are the windows one.

@sheepo99
Copy link
Author

sheepo99 commented Aug 7, 2019

Ah my bad, forgot to download the latest build. It seems the volume gaps between different songs also happens in the original windows version too, so it's just a general limitation of midi or bad composing from Buster's side. One more argument to make it adlib on midi mode by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants