Issue640

Title play_sound_cached() distorts sounds?
Priority critical Status resolved
Assigned To Keywords
Linked issues Watchers

Submitted on 2013-02-03 09h08 by matthiaskrgr, last changed by fluzz.

Files
File name Uploaded Type Edit Remove
actual_sound.ogg matthiaskrgr, 2013-02-03.09:13:28 video/ogg
Messages
Author: matthiaskrgr Date: 2013-02-03   09h08
sound/effects/Menu_Item_Selected_Sound_1.ogg is sounds a lot shorted and
crackier ingame than it is actually when I play it using mplayer.

I have no idea how this happens but well, it is a grave issue in my opinion.
Author: matthiaskrgr Date: 2013-02-03   09h13
Added sample of how it sounds to me ingame.

Attached actual_sound.ogg.
Author: matthiaskrgr Date: 2013-02-03   09h21
Other sounds are distorted a well!
Author: matthiaskrgr Date: 2013-02-03   09h41
bot_sounds/First_Contact_Sound_6.ogg: Ogg data, Vorbis audio, mono, 22050 Hz,
~40222 bps, created by: Xiph.Org libVorbis I
appears to be played fine while

bot_sounds/Start_Attack_Sound_14.ogg: Ogg data, Vorbis audio, mono, 8000 Hz,
~22400 bps, created by: Xiph.Org libVorbis I
does not.
Author: matthiaskrgr Date: 2013-02-03   16h41
original sounds:
http://freedroid.git.sourceforge.net/git/gitweb.cgi?p=freedroid/freedroid;a=blob;f=sound/effects/Menu_Item_Deselected_Sound_0.ogg;h=e88b9486813e96e77bb2c21ac3b4dd76ecb88f69;hb=HEAD

http://freedroid.git.sourceforge.net/git/gitweb.cgi?p=freedroid/freedroid;a=blob;f=sound/effects/Menu_Item_Selected_Sound_1.ogg;h=169c55a810a6f95a01b34a2ed7d7762d6bb06b78;hb=HEAD
Author: ahuillet Date: 2013-02-03   16h43
I don't see any reason why all of our sounds wouldn't be standardized to stereo
44.1KHz honestly.
Author: matthiaskrgr Date: 2013-03-08   16h49
17:40 < matthiaskrgr> sound.c            int audio_rate = 44100;
17:40 < matthiaskrgr> if the sound we play is sampled with a different rate, it
sounds strange
17:42 < matthiaskrgr> so we can either try to fix the code and make the game
choose the sample rate for every sound (is that possible?) or we convert the
sounds which will reduce their quality
17:42 < matthiaskrgr> and make them sound different
Author: joseph Date: 2013-03-08   19h34
We can't fix this in our code. We don't want to implement resampling in fdrpg
;-) It's a SDL bug. See https://bugzilla.libsdl.org/show_bug.cgi?id=58
Author: matthiaskrgr Date: 2013-03-08   19h54
Hmm, can we play sounds through opengl as workaround maybe?
Author: matthiaskrgr Date: 2013-03-08   20h05
I tried to convert the affected sounds to 44100 with several tools, but that
made them sound different/less clean or cracky as far as I noticed.

I tried to record (pc-internally) the played audiofiles with audacity but the
result (recording) didn't sound the same as well. :/
Author: ahuillet Date: 2013-03-30   22h34
No, OpenGL is a graphics library, it doesn't display sound. :)
Author: matthiaskrgr Date: 2013-03-31   00h08
Mh ok.
Author: salimiles Date: 2013-05-07   02h36
I agree with arthur, we should standardize.
Author: fluzz Date: 2013-10-08   14h37
On 02/03/2013 05:43 PM, Arthur Huillet - Roundup wrote:
>
> Arthur Huillet <ahuillet@freedroid.org> added the comment:
>
> I don't see any reason why all of our sounds wouldn't be standardized to stereo
> 44.1KHz honestly.
>

Mhhh... We have spatialization of some sounds, right ?
Those have to be mono, or spatialization will not make sense.
Author: matthiaskrgr Date: 2013-10-08   21h51
Yes, but I wouldn't convert all current stereo-sounds to mono because of that...
I don't remember sounds that had a something like a clear positional direction
coming from played with a normal player.
Author: jesusalva Date: 2014-01-06   17h14
"Note that you most likely will have to change the sample rate, even if you
already have OGG files that are supposed to replace the music that ships with
the game. The sample rate needs to be at 22050 Hz, not 44100 Hz. This makes the
music sound worse indeed, but if you don't do that, you will have the file
playing at half time. Which is no good. In Audacity, you can find the thing for
changing the sample rate in the lower left corner of the window. Change that to
22050, then export to OGG and you should be fine."

source: http://forums.wolfire.com/viewtopic.php?f=7&t=17652
Author: matthiaskrgr Date: 2014-01-07   07h13
I tried converting via audacity some months ago but the result sounded a bit
strange.
Author: fluzz Date: 2015-01-04   14h43
All sounds were resampled using 'sox' (44.1kHz, 16bits, stereo, -3dB peak level).

Some of them (too crispy or with too much noise) were also reworked.

Pushed in commit c2ddc202ad6b.

Note: The spat code of SDL_mixer uses stereo samples internally, so the
standardization of all sounds is ok.
History
Date User Action Args
2015-01-04 14:43:27fluzzsetstatus: open -> resolved
messages: + msg3024
2014-01-07 07:13:46matthiaskrgrsetmessages: + msg2667
2014-01-06 17:14:02jesusalvasetmessages: + msg2647
2013-10-08 21:51:13matthiaskrgrsetmessages: + msg2612
2013-10-08 14:37:07fluzzsetmessages: + msg2607
2013-05-07 02:36:34salimilessetmessages: + msg2483
2013-03-31 00:08:29matthiaskrgrsetmessages: + msg2472
2013-03-30 22:34:26ahuilletsetmessages: + msg2467
2013-03-08 20:05:00matthiaskrgrsetmessages: + msg2462
2013-03-08 19:54:31matthiaskrgrsetmessages: + msg2461
2013-03-08 19:34:01josephsetmessages: + msg2460
2013-03-08 16:49:59matthiaskrgrsetmessages: + msg2457
2013-02-03 16:43:50ahuilletsetmessages: + msg2416
2013-02-03 16:41:03matthiaskrgrsetmessages: + msg2415
2013-02-03 09:41:53matthiaskrgrsetmessages: + msg2414
2013-02-03 09:21:17matthiaskrgrsetmessages: + msg2413
2013-02-03 09:13:28matthiaskrgrsetfiles: + actual_sound.ogg
messages: + msg2412
2013-02-03 09:08:30matthiaskrgrcreate