SuperTux / supertux

SuperTux source code
https://supertux.org
GNU General Public License v3.0
2.5k stars 476 forks source link

Audio quality in-game is greatly deteriorated #1707

Open Semphriss opened 3 years ago

Semphriss commented 3 years ago

rain.zip

Opening the sound file above in a generic sound player vs playing it in-game shows a clear, distinct difference in quality.

HybridDog commented 3 years ago

I replaced the main menu theme.ogg with this sound and couldn't here a difference between playing it in SuperTux and in Audacious.

Semphriss commented 3 years ago

Normal audio (played using Totem, Ubuntu 20.04's default media player) vs in-game audio (using play_music() on the raw OGG file)

https://user-images.githubusercontent.com/66701383/112763403-55c7e580-8fd2-11eb-81b7-c2cac13b8694.mp4

HybridDog commented 3 years ago

When I use play_music ((script "play_music(\"music/rain.ogg\");")), I cannot hear the quality difference, but I can clearly hear the differences in your audio-diff.mp4. Even though I cannot hear the difference in my case, the spectrum of the sound differs a lot from the sound played by Audacious. game_vs_audacious.opus.zip

The file has 24 kHz sampling frequency and in the in-game case more high frequencies appear, so perhaps there's a resampling problem. What happens if you re-encode the file with 44.1 kHz or 8 kHz?

Spectrum of your audio-diff.mp4 file: 112763403-55c7e580-8fd2-11eb-81b7-c2cac13b8694 mp4

Spectrum of my game_vs_audacious.wav file (before encoding it to opus): game_vs_audacious wav

Semphriss commented 3 years ago

I tried resampling the file manually at 8, 24, 44.1 and 48 kHz with FFmpeg. They all sounded the same (crystal clear in media player and compressed in-game), except 8 kHz which sounded compressed in the media player too. I notice that in-game 8 kHz sounds more bitcrushed than compressed, though.

For the info, the recording was done with OBS @ 48kHz.

Also, the file has a bitrate of 112kbps, though I don't think it'd be a problem since bitrate varies a lot though game files (Quick search showed 96 to 160 kbps).

Semphriss commented 3 years ago

For the record, I tried resampling with Audacity instead; same result.

HybridDog commented 3 years ago

I tried it in .wav format and set the OpenAL resampler to bsinc12 in the alsoftrc configuration file, and the spectrum still looked wrong.