Crackling sound on Galaxy S4 (when using OpenSL)

Using low level API on a Galaxy S4, and OpenSL output (I set output to Auto-detect), I get “patchy” sound. If I change the output to Audio Track, then sounds perfectly. Is it safe to use Audio Track output in all Android devices? What can happen if I use Audio Track output for all Android devices?

Note: Using FMOD 1.07.06 worked perfectly using Auto-detect output. But after update to 1.08.09, I’m getting such crackling sound when I use Auto-detect in Galaxy S4 with Android 5.

Can you link with the logging version of FMOD and provide the LogCat output as part of your question?

The difference between 1.07 and 1.08 regarding auto detect would cause 1.07 to use AudioTrack and 1.08 to use OpenSL. You may have found a case where the detection is incorrect, that being said I’ve tested here with our Galaxy S4 running Android 4.3 and playback is smooth in the examples. Can you confirm this on your end with Android 5.0 and our play_stream example?.

Using AudioTrack on all Android devices is safe, but it means you’ll lose the ability to record from the microphone and you will get higher latency.

2 Likes

Please see my answer below. I added more info, and logs. Please, let me know if you need more info, or if I can help in any way.

I ran play_stream example and the sound is “patchy” too. I recorded a video so I hope you can detect the “crack” noise (it gets worse when I apply DSP filters): https://vid.me/gsmD

I linked with the logging version, and here is the LogCat output. Also, I provide the log for 1.07.06 version that is working fine: https://gofile.io/?id=eKUe63

Is there any way to fix it? Or should I wait for next FMOD release?

Thanks for the information, could you install the AudioBufferSize app for the play store and share the output?

https://play.google.com/store/apps/details?id=com.levien.audiobuffersize

Here is AudioBufferSize output:

samsung GT-I9505 5.0.1 LRX22C (api 21)
from platform: sampleRate=48000 bufferSize=512
buffer size estimate = 1401.7699115044247
sampleRate=44100 bufferSize=1408
ms per tick = 31,928; jitter (lr) = 67,423
buffer size estimate = 2104.9833887043187
sampleRate=48000 bufferSize=2112
ms per tick = 44,000; jitter (lr) = 71,840
result: 1408 44100

Please let me know it you need more info

Thanks for that, this just highlights the terrible situation of audio on Android. The device is reporting a buffer size of 512 samples, but in practice requires over 2000. To be fair, the device does say it doesn’t support low latency and FMOD ignored that. I’ll need to make the requirements for OpenSL selection stricter for our next release.

Thanks Mathew. I’ll wait for next release.