Author Topic: Android Sound latency  (Read 4017 times)

Offline nicoatek

  • Mc. Print
  • *
  • Posts: 13
    • View Profile
Android Sound latency
« on: 2012-Jul-27 »
Hi, all!

Not sure it s a bug or may be due to my phones, but I have noticed that in my android systems, sounds are not playing at the good time.
Nothing dramatically, but... 

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: Android Sound latency
« Reply #1 on: 2012-Jul-29 »
Which Android systems are you using? Sound latency is a well known problem on earlier Android platforms for many developers, not just GLB devs.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3925
    • View Profile
    • Space Fractal
Re: Android Sound latency
« Reply #2 on: 2012-Jul-31 »
Sound is quite bad in some Android devices, example Kindle Fire (no I dont have the device my self) which have a long delay. Its a well known Android issue. Here is more info:
http://developer.coronalabs.com/forum/2011/01/01/audio-delay-android

Me thinks, the only way to fix some of them is simply use music commands for playing sound, and remove music completly. This might works better doing that, but you would only have one sound channel.

But I do thinks thee is nothing Gernot can fix me think (and you should also wrote which devices its have issues with)......

PS. Which devices do you have with that issue?
« Last Edit: 2012-Jul-31 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline nicoatek

  • Mc. Print
  • *
  • Posts: 13
    • View Profile
Re: Android Sound latency
« Reply #3 on: 2012-Jul-31 »
Thanks for answers,

I have got a JXD S601 (Android tablet/console), and a LG Optimus Black as phone.
Both are running Android 2.2.x.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4336
    • View Profile
    • FUED
Re: Android Sound latency
« Reply #4 on: 2012-Jul-31 »
A JXD? Russian console?

Is the sound problem exact similar on both?

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: Android Sound latency
« Reply #5 on: 2012-Jul-31 »
On Froyo (2.2.x) sound latency is going to be bad. From what I've heard this is still ongoing, e.g. IceCream Sandwich (4.0.x) is still troublesome. There is no universal fix and what fixes can be found are often model specific. They won't work on all devices.

Audio is one area where iOS is way better than Android. Ugh.

Offline nicoatek

  • Mc. Print
  • *
  • Posts: 13
    • View Profile
Re: Android Sound latency
« Reply #6 on: 2012-Jul-31 »
Quote
A JXD? Russian console?
http://www.jxd.hk/download.asp?selectclassid=020001

I am having the same problem on each device.
Hopefully, sound latency is not so disturbing, as for the action game I am working on.

Hope this could be fixed in v11, thanks.

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
Re: Android Sound latency
« Reply #7 on: 2012-Jul-31 »
Not likely to be fixed in v11. GLBasic has to rely on the installed sound libraries for Android, native or modded.

Hopefully, sound latency is not so disturbing, as for the action game I am working on.

Most Android owners get used to it. Where it becomes a massive problem is with music programs that require very low audio latency. Gaming should be fine.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4336
    • View Profile
    • FUED
Re: Android Sound latency
« Reply #8 on: 2012-Jul-31 »
yep, I have heard that even the android emulators suffer hard sound delays. :(

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3925
    • View Profile
    • Space Fractal
Re: Android Sound latency
« Reply #9 on: 2012-Aug-01 »
That way Android sucks very ball when its came to sound (its java and I have never liked java sound). iOS have nearly no Latency at all. I even have played Wi-Guitar on my iPhone 4 and people mistaked I played on a real guitar.

Its would been nice to test what it happens if we could change the final mixer when invoking audioInit() in SLDActivity.java with different values than those glbasic currently use? Would been nice if we could invoked that with different values which might works better for some devices to shorting the delay (and values we could set by your self).

some devices do still require to use music commands for sound and just use one channel.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline nicoatek

  • Mc. Print
  • *
  • Posts: 13
    • View Profile
Re: Android Sound latency
« Reply #10 on: 2012-Aug-21 »
I've seen this on the processing forum (which is based on java), it should help:

Quote
Sounds was one of the biggest problems when developing this game. First i was using ApWidgets with multiple MediaPlayers. But later in process i find out that this was very laggy on some devices. After days of searching and studying i found way to use SoundPool and get contents from /data folder ( /assets after export ). AssetManager was the solution.

Music files was too big for the SoundPool, so i had to use MediaPlayer instead.

original post from the processing forum: https://forum.processing.org/android-processing/13