SDL2 No Audio produced on certain formats

I am trying to get audio format AUDIO_U16LSB working without any luck.

I have some sample raw audio in that format and I have verified with sox(d) by converting it to wav format

sox -r 44100 -e unsigned-integer -b 16 -c 2 -L audio.raw audio.wav

The wav file plays fine in any player and in SDL2 audio.

The raw file plays fine in Audacity.

However I cannot get the raw file to play in SDL2. I just get humming.

I am setting the audioSpec like so

		audioSpec.callback = NULL;
		audioSpec.channels = 2;
		audioSpec.freq = 44100;
		audioSpec.format = AUDIO_U16LSB;
		audioSpec.samples = 4096;

The returned spec from the open audio device is the same so I assume its supported.

Working in SDL2 windows 10 but not in SDL2 Linux Ubuntu 18.04!

Version is 2.0.8

Any ideas welcome!

At this point as the same code works in Windows 10 Mingw64 but fails under Linux Ubuntu 18.04 I’m going to raise a bug!

I’ve written a handy SDL2 utility to test the supported audio formats:

You can find it here :

SDLaudio format tester