SDL2_mixer & ogg vorbis file for android. Problems in IC

Every time I load my app on my Samsung galaxy ace II I get the distorted helicopter sound instead of the .ogg music file it is meant to be playing. Will be trying to figure it out over next few days ( testing different sound files etc… )

Also I’m loading the ogg file from the apk files assets directory

SDL_InitSubSystem(SDL_INIT_AUDIO);

if(Mix_OpenAudio(22050, AUDIO_S16SYS , 2, 2048)) {
	  LOGD("Unable to open audio!");
	  exit(1);
	}

Mix_Music *music;
music=Mix_LoadMUS("Initiate.ogg");
if ( music == NULL )
{
	LOGD("No music file found");
}

if ( ! Mix_PlayingMusic() )
{
	Mix_PlayMusic(music, -1);
}

Check if your ogg files are encoded using 48000 Hz freq. if it the
case, encode them using standard 44100 Hz freq.On Tue, 12 Mar 2013, image28 wrote:

Every time I load my app on my Samsung galaxy ace II I get the distorted helicopter sound instead of the .ogg music file it is meant to be playing. Will be trying to figure it out over next few days ( testing different sound files etc… )

**
Also I’m loading the ogg file from the apk files assets directory

Are u using libtremor to decode the vorbis streams?

I’m doing the same thing in my game and it works perfectly (but I had to
get an updated version of libtremor since there are a few bugged versions
around that exhibit their bugs when used with SDL_mixer).On Tue, Mar 12, 2013 at 6:16 PM, image28 wrote:


Bye,
Gabry

Yeah, there’s the issue that phones usually don’t support hardware
accelerated Vorbis so they’re horribly slow at that. You’ll end up
with a scratchy sound because it can’t keep up with the streaming (so
there are gaps in the buffer all the time).

If using Tremor doesn’t fix it for you may want to consider other
alternatives. I suppose you’re probably avoiding the hardware
accelerated formats as they’re usually patented… An alternative
would be to decompress the entire Vorbis data in RAM, and if you need
to save space use DPCM, ADPCM or something like that (there’s a Sega
Genesis sound engine called TMSE that can decompress two ADPCM streams
at 22KHz simultaneously on the 3.58MHz Z80, to give you an idea of how
lightweight are those two algorithms).

2013/3/13, Gabriele Greco <gabriele.greco at darts.it>:> On Tue, Mar 12, 2013 at 6:16 PM, image28 wrote:

**
Also I’m loading the ogg file from the apk files assets directory

Are u using libtremor to decode the vorbis streams?

I’m doing the same thing in my game and it works perfectly (but I had to
get an updated version of libtremor since there are a few bugged versions
around that exhibit their bugs when used with SDL_mixer).


Bye,
Gabry

a standard wav file plays fine, but if I use audacity to compress it into a adpcm wave file SDL_mixer doesn’t find the file… did a search for the sega sound engine but couldn’t find it…

ADPCM WAV files rarely are supported, I meant using your own format.
Audacity won’t help you much there (other than saving it as raw and
then using some quick conversion tool), and storing the file directly
may not be a good idea anyway since it doesn’t compress as well as
Vorbis.

First try Tremor, it’s a much faster decoder for Vorbis files (as it
doesn’t use floating point). Resort to other methods only if Tremor
doesn’t work and you really need to save RAM. If you have spare RAM
you can also try decompressing the files in RAM and playing that
(mostly useful for sound effects).

2013/3/13, image28 :> a standard wav file plays fine, but if I use audacity to compress it into a

adpcm wave file SDL_mixer doesn’t find the file… did a search for the
sega sound engine but couldn’t find it…

SDL2_mixer is compiled with tremor… and decompressing music to ram would take up to much ram, a lot of phones don’t have all that much.