# Crackling sound on Galaxy S4 (when using OpenSL)

**URL:** https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627
**Category:** FMOD Studio
**Created:** [August 3, 2016, 6:17pm UTC](https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627 "2016-08-03T18:17:21Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sviudes](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sviudes](https://qa.fmod.com/u/sviudes)
#### Post date: [August 3, 2016, 6:17pm UTC](https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627/1 "2016-08-03T18:17:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)
#### Post date: [August 3, 2016, 10:47pm UTC](https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627/2 "2016-08-03T22:47:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sviudes](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sviudes](https://qa.fmod.com/u/sviudes)
#### Post date: [August 5, 2016, 6:35am UTC](https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627/3 "2016-08-05T06:35:45Z")

</div>

> [@](#):
>
> 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.

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.

---

<div class="post-metadata">

### Author: ![sviudes](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sviudes](https://qa.fmod.com/u/sviudes)
#### Post date: [August 4, 2016, 10:06am UTC](https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627/4 "2016-08-04T10:06:24Z")

</div>

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](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](https://gofile.io/?id=eKUe63)

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

---

<div class="post-metadata">

### Author: ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)
#### Post date: [August 7, 2016, 10:48pm UTC](https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627/5 "2016-08-07T22:48:49Z")

</div>

> [@](#):
>
> 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](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: [Gofile - Your all-in-one storage solution](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](https://play.google.com/store/apps/details?id=com.levien.audiobuffersize)

---

<div class="post-metadata">

### Author: ![sviudes](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sviudes](https://qa.fmod.com/u/sviudes)
#### Post date: [August 8, 2016, 3:30pm UTC](https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627/6 "2016-08-08T15:30:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)
#### Post date: [August 8, 2016, 11:38pm UTC](https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627/7 "2016-08-08T23:38:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sviudes](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sviudes](https://qa.fmod.com/u/sviudes)
#### Post date: [August 9, 2016, 6:38am UTC](https://qa.fmod.com/t/crackling-sound-on-galaxy-s4-when-using-opensl/12627/8 "2016-08-09T06:38:45Z")

</div>

Thanks Mathew. I’ll wait for next release.
