# Urgent! Audio glitches on Samsung S9+

**URL:** <https://forum.juce.com/t/urgent-audio-glitches-on-samsung-s9/37509>\
**Category:** Android\
**Created:** [February 7, 2020, 11:35pm UTC](https://forum.juce.com/t/urgent-audio-glitches-on-samsung-s9/37509 "2020-02-07T23:35:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![path77](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@path77](https://forum.juce.com/u/path77)\
**Post date:** [February 7, 2020, 11:35pm UTC](https://forum.juce.com/t/urgent-audio-glitches-on-samsung-s9/37509/1 "2020-02-07T23:35:31Z")

</div>

SOLVED! Now rendering to a circular buffer which is then consumed by getNextAudioBlock. No glitches at all on device no matter what I do.

Hi guys! I am currently working on a generative music library which works really well on mac and iOS. It works pretty well in Android Emulator (Pixel 3) but when running on a Samsung S9+ the audio goes from barely acceptable to complete rubbish.

It seems to get worse when not constantly touching the screen, but even when touching the screen it is very unstable. I am using Juce 5.4.6 with Oboe 1.3. I have tried all I can think of. I have modified juce\_android\_Oboe.cpp to use stabilizedCallback and I have verified that it is being used. C/++ optimization set to -Ofast.

I have tried busywaiting to keep CPU spinning. I have tried WakeLock’s. I have set FLAG\_KEEP\_SCREEN\_ON. I have set thread priority to THREAD\_PRIORITY\_URGENT\_AUDIO. I even tried creating the basic audio app template in projucer and had it output a simple sine wave. Even that is glitchy and unstable. I don’t really need short latency, so maybe that could present a solution?

Now, I have seen other posts about this, but I haven’t seen a solution. So, please let me know how to proceed. This is pretty urgent and we are about to purchase a JUCE license really soon, but if it turns out we can’t use it on Android, we may have a problem.

Anyone have a clue?

---

<div class="post-metadata">

**Author:** ![path77](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@path77](https://forum.juce.com/u/path77)\
**Post date:** [February 8, 2020, 5:39pm UTC](https://forum.juce.com/t/urgent-audio-glitches-on-samsung-s9/37509/2 "2020-02-08T17:39:31Z")

</div>

Never mind! I solved it and it now runs 100% glitch free on the device.

---

<div class="post-metadata">

**Author:** ![electropict](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/electropict/32/4463_2.png) [@electropict](https://forum.juce.com/u/electropict)\
**Post date:** [February 4, 2021, 5:46pm UTC](https://forum.juce.com/t/urgent-audio-glitches-on-samsung-s9/37509/3 "2021-02-04T17:46:17Z")

</div>

Hi, I’ve been having trouble specifically with Samsung note phones. I find that some models use a very short buffer (note9 and note10) of 96 which causes glitches from time to time. However, my note20ultra uses a buffer of 240 which doesn’t have any audio glitches.

Could you please explain your circular buffer solution? I’d like to try that.
