# Some sounds in certain Unity scenes do not work on Android

**URL:** <https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103>\
**Category:** Unity\
**Created:** [September 15, 2018, 5:43am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103 "2018-09-15T05:43:22Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 15, 2018, 5:43am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/1 "2018-09-15T05:43:22Z")

</div>

If I use a normal event emitter with start on create in two different scenes, it will work in both scenes on a Mac build, Windows build, in the editor, but on Android it only works in one of the two scenes and I cannot figure out why.  
Some other sounds work…

There is no difference in the two objects from the two different scenes, also using the exact same audio track in FMOD.

The sound starts playing for 1 second and then simply stops.  
I can see one error in my logcat logs which is:  
Error setting CPU thread affinity

Once the audio randomly started working after a few minutes.

I’m testing on a One Plus 2.  
Any ideas ?

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 15, 2018, 6:06am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/2 "2018-09-15T06:06:20Z")

</div>

> [@](#):
>
> If I use a normal event emitter with start on create in two different scenes, it will work in both scenes on a Mac build, Windows build, in the editor, but on Android it only works in one of the two scenes and I cannot figure out why.  
> Some other sounds work…
> 
> There is no difference in the two objects from the two different scenes, also using the exact same audio track in FMOD.
> 
> The sound starts playing for 1 second and then simply stops.  
> I can see one error in my logcat logs which is:  
> Error setting CPU thread affinity
> 
> Once the audio randomly started working after a few minutes.
> 
> I’m testing on a One Plus 2.  
> Any ideas ?

So some sounds started working again, and the logs say that this was triggered exactly when the battery dropped from 37% to 36%.

Seems like as if the system is shutting down some audio/music threads randomly and then bringing them back ?

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 15, 2018, 6:06am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/3 "2018-09-15T06:06:25Z")

</div>

So some sounds started working again, and the logs say that this was triggered exactly when the battery dropped from 37% to 36%.

Seems like as if the system is shutting down some audio/music threads randomly and then bringing them back ?

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [September 18, 2018, 4:54am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/4 "2018-09-18T04:54:07Z")

</div>

Hi Patric,

This is some very odd behaviour you’re experiencing.

As far as I know, there is no thread affinity for Android as it’s available for all cores. Can you post all FMOD errors logged from your logcat log? There might be something we’re missing.

Are you able to replicate this issue on any other Android device?

Thanks,  
Richard

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 18, 2018, 5:06am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/5 "2018-09-18T05:06:34Z")

</div>

> [@](#):
>
> Hi Patric,
> 
> This is some very odd behaviour you’re experiencing.
> 
> As far as I know, there is no thread affinity for Android as it’s available for all cores. Can you post all FMOD errors logged from your logcat log? There might be something we’re missing.
> 
> Are you able to replicate this issue on any other Android device?
> 
> Thanks,  
> Richard

Hi Richard, thanks for the reply! I’ve not created a mobile bank and we are using ogg vorbis, that’s not ideal for mobile. So I’m trying to use a more common file format, and create a separate mobile bank and see if that solves the issue. I can’t see any FMOD error that’s the thing, the audio simply doesn’t play.

Could I email you a full log?

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [September 18, 2018, 12:21pm UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/6 "2018-09-18T12:21:31Z")

</div>

Hi Patric,

You can send the log through to [support@fmod.com](mailto:support@fmod.com) and someone will take a look.

Let me know if using a different file format in the Mobile banks helps.

Thanks,  
Richard

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 20, 2018, 4:28am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/7 "2018-09-20T04:28:04Z")

</div>

Unity audio does automatically compress it to the best fitting format specific to the platform. In FMOD does Unity still compress the sounds we add, or those it player exactly whatever we use in the bank ? Thanks

I will follow up with an email asap.

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [September 21, 2018, 6:01am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/8 "2018-09-21T06:01:15Z")

</div>

Hi Patric,

As far as I’m aware, Unity shouldn’t compress your audio files further than what you’ve specified in your banks.

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 24, 2018, 10:30am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/9 "2018-09-24T10:30:32Z")

</div>

Hi Richard, what is the preferable way of resetting a sound from an emitter. Just start playing it from second 0 again. Calling Stop() and then Start() works on PC but not on mobile. Looking into the C# implementation of Stop() it looks like you are freeing the instance, could this be a cause of this weird issue ? is this a race condition ?

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [September 24, 2018, 1:07pm UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/10 "2018-09-24T13:07:36Z")

</div>

Hi Patric,

Calling Stop() shouldn’t free the instance unless Release() is also called on the instance at any point.

You can just call Start() on the event instance for it to start again from the beginning.

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 24, 2018, 8:25pm UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/11 "2018-09-24T20:25:06Z")

</div>

Hi Richard. This is the implementation of Stop() in Unity:

```
public void Stop()
{
    if (instance.isValid())
    {
        instance.stop(AllowFadeout ? FMOD.Studio.STOP_MODE.ALLOWFADEOUT : FMOD.Studio.STOP_MODE.IMMEDIATE);
        instance.release();
        instance.clearHandle();
    }
}
```

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [September 25, 2018, 3:57am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/12 "2018-09-25T03:57:56Z")

</div>

Hi Patric,

I can see the Stop() function contains a release and clearHandle call, so this is why it won’t work. After calling this function the event instance is no longer there to play. You can simply call start() on the event instance for it to begin again from the beginning.

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 25, 2018, 5:34am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/13 "2018-09-25T05:34:44Z")

</div>

Good to know, thanks.  
I wonder why it still works on standalone builds and the editor.

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 25, 2018, 8:38am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/14 "2018-09-25T08:38:47Z")

</div>

Calling just Play() is working on Standalone and Editor, but is also not working on mobile sometimes… No errors in the logs

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 25, 2018, 9:12am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/15 "2018-09-25T09:12:05Z")

</div>

This is called on a studio sound emitter, that is created in a previous seen and carried on through DontDestroyOnLoad maybe that has something to do with it… it is really weird though. Because not calling start() just unmuting works… Start works everywhere. And on mobile just sometimes, and sometimes it would just start after a few minutes out of nowhere

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 27, 2018, 7:53am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/16 "2018-09-27T07:53:53Z")

</div>

I’ve just experienced the issue in another scene as well. Unrelated to DontDestroyOnLoad -\> some sound only randomly work, or they start out of nowhere, or just simply don’t play at all.

Are multiple regions in FMOD not fully supported on mobile ?

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [September 29, 2018, 3:54am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/17 "2018-09-29T03:54:23Z")

</div>

Unfortunately this is a production blocker for us, and makes it unusable

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [October 1, 2018, 5:43am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/18 "2018-10-01T05:43:55Z")

</div>

Hi Patric,

Given the complexity and urgency of your issue it would be better for you to upload your Unity project for support to take a look.

Open your FMOD profile page (where you download FMOD Studio) and select the “Upload” tab and upload a .zip of your Unity project there.

Thanks,  
Richard

---

<div class="post-metadata">

**Author:** ![wildboystudios](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@wildboystudios](https://qa.fmod.com/u/wildboystudios)\
**Post date:** [October 12, 2018, 11:18am UTC](https://qa.fmod.com/t/some-sounds-in-certain-unity-scenes-do-not-work-on-android/14103/19 "2018-10-12T11:18:39Z")

</div>

Hi Richard,

I think the issue might be too many concurrent parallel streaming sounds. Putting all sounds to not “streaming” seems to be working on android. I read somewhere that there is a pretty low limitation of parallel streaming sound effects.
