News:

SimuTranslator
Make Simutrans speak your language.

Sound playback in sdl2 backend and pak64

Started by captain crunch, November 22, 2013, 08:29:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

captain crunch

Version: simutrans r6913, linux-amd64, sdl2-backend, pak64
The sounds Water.wav and arctic.wav produce only noise and not the expected sound.
When I resample them to a multiple of 11025Hz using sox, they play alright.

prissi

Sounds more like an error of SDL2 then. They are legal wavefiles.

ArthurDenture

I can reproduce this problem as well. Turns out there's an open bug from 2006 where SDL 2.0 can only convert samples if the difference between their sample rate and the game's sample rate is a power of 2.

Given that that bug has been open for essentially forever, I wouldn't hold out hopes for a fix. Would it be possible to instead replace those sound files with ones that are at 11025 or 22050 Hz? Basically as captain crunch described. I think the following files are affected:

pak64/sound/arctic.wav
pak64/sound/planelow.wav
pak64/sound/Water.wav
pak128/sound/horsegallop2.wav

prissi

Some of them I got with lower rate. But indeed,  I can convert them. (Although it is strange that SDL cannot cope with 44100 and 48000 samples at the same time ...

Ters

Is SDL2 really doing the mixing itself? I thought those days were over, with every contemporary low-level sound API I know exposing abstracting mixing to hardware or software, even with mixed sampling rates.

prissi