Help with sound issues on Kindle Fire?

Previous topic - Next topic

BasicMe

I'm finalizing a game for the Kindle Fire.  The graphics are working fine (fantastic performance, in fact!), but I'm having some issues with audio.

Per this thread:
http://www.glbasic.com/forum/index.php?topic=7359.msg61486#msg61486
Quote from: AlienMenace on 2011-Dec-16
I think it may still be a sound buffer issue. The sounds are choppy and seem to cause a bit of a program delay when too many are played at once.
Quote from: Kitty Hello on 2011-Dec-16
what sample format are you loading? Try 44KHz, 16 bit (mono/stereo).

I think I'm seeing the exact same sound issue: sounds sometimes play choppy, other times they lag by about 1/2 to 1 second behind where they should be.  I'm using 44.1KHz 16 bit stereo Windows *.wav files.

In addition, I can't get my *.mp3 files to play at all:
Code (glbasic) Select

PLAYMUSIC "Media/music.mp3", TRUE


The file is 44.1KHz, stereo, 128kbps.  The music plays fine when I compile for Windows; it just doesn't play on the Kindle.

Has anyone discovered a workaround for either of these audio issues?

Kitty Hello

For WAV - can you try 22050 Hz, 16bit, mono/stereo files?

erico

sounds like a bit rate problem to me.
I tried to look around for a more specific sound spec on this device but no luck.

44KHz or 48KHz, 16 bit mono or stereo should do fine.
I´m not sure about the  128kbps, so try 256 or 64.
You may want to search the net for exactly what is a more native bit rate for this device.

Newer devices are all about processors ou gfx chips, it has been a while people don´t talk about what sound capabilities it can cope with other then formats.

spacefractal

#3
Mp3 is a problem format for Android generally in apps, so you should try to use ogg files for music. Its dont play on Sony Expira Play as well. I mind still have issue, but its simply because I have not got feedback from friend as well. but ogg should been the way.

For sfx I use 22khz mono samples and only use few channels (actuelly no more 2 channels is played sametime). Dont try to play 30 channels or such, which might cause issues with some devices. Hold them in few channels as possible.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

AlienMenace

As I mentioned in other threads some weeks back, there are serious Kindle Fire issues...

Sprite collisions locks up Fire, same issue that was present on the iPad before it was fixed. Crash is to the point that it requires a hard-reset to regain control of device.
See attached example code.

Sounds are delayed and choppy and it seems only 1 or 2 will play at a time.
Changed all samples to mono 22K, made no difference.

I have a control panel graphic that displays at 0,0. Every once in a while the program executes and it places the graphic origin correctly in the upper left corner of the screen where 0,0 is suppose to be.. at other times, 0,0 is pushed up offscreen. It is looks to me as though the Fire's mandatory menu bar at the bottom is screwing up the display screen somehow. Sometimes, GLB plays nice with it and everything is fine but at other times, it lets the menu bar push everything up off the screen.

Related I think to the previous issue is the touch coordinates are not always correctly reported. All these issues are related to the Y-axis, the X-axis is fine. It seems to be related to the screen offset issue mentioned above.

Would be great to see these things fixed...

[attachment deleted by admin]
Apps published: 3

BasicMe

Quote from: Kitty Hello on 2012-Jan-02
For WAV - can you try 22050 Hz, 16bit, mono/stereo files?

I converted my WAV files all the way down to 16 kHz 8bit mono, and they're still lagging by about 1 second. :(  For the record, I'm mainly playing only a single sound at a time, and the lag is still entirely there.

Quote from: spacefractal on 2012-Jan-02
Mp3 is a problem format for Android generally in apps, so you should try to use ogg files for music. Its dont play on Sony Expira Play as well. I mind still have issue, but its simply because I have not got feedback from friend as well. but ogg should been the way.

Thanks, Spacefractal!  You were right, it seems to be the MP3.  I had tried converting it to different rates, but it just would not play.  I finally used an uncompressed WAV file (22kHz 16-bit) as a test, and it worked! ...although it made my APK file almost 40mb.  I don't currently have a way to create OGG files, but I'll definitely look into that!

Quote from: AlienMenace on 2012-Jan-02
As I mentioned in other threads some weeks back, there are serious Kindle Fire issues...

Sprite collisions locks up Fire, same issue that was present on the iPad before it was fixed. Crash is to the point that it requires a hard-reset to regain control of device.
See attached example code.

Sounds are delayed and choppy and it seems only 1 or 2 will play at a time.
Changed all samples to mono 22K, made no difference.

I have a control panel graphic that displays at 0,0. Every once in a while the program executes and it places the graphic origin correctly in the upper left corner of the screen where 0,0 is suppose to be.. at other times, 0,0 is pushed up offscreen. It is looks to me as though the Fire's mandatory menu bar at the bottom is screwing up the display screen somehow. Sometimes, GLB plays nice with it and everything is fine but at other times, it lets the menu bar push everything up off the screen.

Related I think to the previous issue is the touch coordinates are not always correctly reported. All these issues are related to the Y-axis, the X-axis is fine. It seems to be related to the screen offset issue mentioned above.

Would be great to see these things fixed...

I don't use sprite collisions, so I can't speak to that.  But I have encountered the Y-axis offset you mentioned.  I also think I identified what seemed to cause it in my case, at least most of the time.

I used to test my app by creating my APK, copying it to the Kindle, and using a 3rd-party app (ES File Explorer) to install it.  I would then launch it immediately after it finished the install.  I noticed that these first-launches were the times I would primarily see the Y-axis offset.

So what I do now is finish installing it, exit the installer without launching, quit ES File Explorer, and then launch it from the icon on the Kindle's home page.  Since doing this, I've launched my app numerous times, and so far I have not encountered the Y-axis offset issue again (knocking heavily on wood).  Once it's in the Amazon store, users will probably only launch it from the home page, so I'm hoping it won't be an issue.

I suppose I'll find out for sure once it's in the store...  :|

erico

try wav with the adpcm compression.

other then that, 11khz 8bit mono should be enough for sound fx,
specially coming out of small speakers.

ogg or the acc could help out on quality and size.

spacefractal

Adpcm is not supported. Look like driver issues as well it's not follow android standard, which can been annoying. I guess it's can only been fixed when kitty have one to test?
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

BasicMe

Quote from: erico on 2012-Jan-02
try wav with the adpcm compression.

other then that, 11khz 8bit mono should be enough for sound fx,
specially coming out of small speakers.

ogg or the acc could help out on quality and size.

Yes, I also can confirm that ADPCM is a no-go on the Kindle.  Also, 11kHz 8bit mono might sound okay coming from the speaker, but it sounds terrible when using headphones.  But it seems to be moot anyway, because the bitrate of the audio files doesn't seem to impact the 1/2 to 1 second lag issue.

However, OGG works great for music!  I used open source Audacity to convert it.

For now, I'll probably remove all sound effects from my game, keep the background music in, and put it in the store as a 1.0 release.  But it would be great to get synced sound effects down the road...  :)

AlienMenace

Quote from: BasicMe on 2012-Jan-02
I don't use sprite collisions, so I can't speak to that.  But I have encountered the Y-axis offset you mentioned.  I also think I identified what seemed to cause it in my case, at least most of the time.

I used to test my app by creating my APK, copying it to the Kindle, and using a 3rd-party app (ES File Explorer) to install it.  I would then launch it immediately after it finished the install.  I noticed that these first-launches were the times I would primarily see the Y-axis offset.

So what I do now is finish installing it, exit the installer without launching, quit ES File Explorer, and then launch it from the icon on the Kindle's home page.  Since doing this, I've launched my app numerous times, and so far I have not encountered the Y-axis offset issue again (knocking heavily on wood).  Once it's in the Amazon store, users will probably only launch it from the home page, so I'm hoping it won't be an issue.

I suppose I'll find out for sure once it's in the store...  :|

I am just installing directly from GLB, running the app from the home screen. The first time after install it seems to orientate on the y-axis okay but subsequent runs are all screwed up. Weird.
Apps published: 3

BasicMe

Quote from: AlienMenace on 2012-Jan-03
I am just installing directly from GLB, running the app from the home screen. The first time after install it seems to orientate on the y-axis okay but subsequent runs are all screwed up. Weird.

Hmm...I never install directly from GLB.  I'd be curious if you still get the same issue installing the APK manually.

Kitty Hello

Don't try 11khz, but really 22050 Hz samples. I "think" SDL will have to convert the samples when running otherwise and that might choke the cpu.

spacefractal

It's should not been that much anyway. If 200mhz old pentium could play an 32 channels xm module nice, then kindle fire should could handle it as least for one channel. So its could been buffer, mixer or even sld driver issue or a known issue?

however my game don't support it because it's us only anyway (and no android market),  so I can't test it.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

I think SDL has to inject Java code for the sound mixer, so there's a huge overhead. It's a known Android problem.

spacefractal

#14
Sound works fine on the Sony and Samsung I tested. For me it's sound a buffer issue? If its mix and play fine without cutting, but only lags, then nothing with mixer itself. Do you use newest version of sdl? Or do we need openal for sound?

Also those devices require various set of buffer length? Can you set mixer sample rate? That could been why it's could been cool to detect kind of device it is (I do the same in ios to set graphics as well frame rate setting). On android I let user set graphics detail manually.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/