# Pausing Music create bug / Numeric clip when restart event

**URL:** <https://qa.fmod.com/t/pausing-music-create-bug-numeric-clip-when-restart-event/20823>\
**Category:** FMOD Studio\
**Created:** [October 31, 2023, 11:33am UTC](https://qa.fmod.com/t/pausing-music-create-bug-numeric-clip-when-restart-event/20823 "2023-10-31T11:33:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbdutoo](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sbdutoo](https://qa.fmod.com/u/sbdutoo)\
**Post date:** [October 31, 2023, 11:33am UTC](https://qa.fmod.com/t/pausing-music-create-bug-numeric-clip-when-restart-event/20823/1 "2023-10-31T11:33:19Z")

</div>

Hi,

I discover the line code “setPaused(false)” to stop and restart my music in same location after the game paused. Its works perfectly !  
But every time the music restart, there are glitchs or numeric glitch and with a little delay.  
This problem can be heard directly in FMOD and with any event.

Where does the problem come from ? It is possible to debug directly in FMOD ? Or Maybe in Unity ?

For the moment, we have cut in Unity the gain from bus music before the bug. But this creates a big delay (less 1 sec but it’s obvious)

I hope there is a solution.

Thanks for your response and thanks for this fabulous soft that respecte AUDIO in video game perfectly.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [November 1, 2023, 12:49am UTC](https://qa.fmod.com/t/pausing-music-create-bug-numeric-clip-when-restart-event/20823/2 "2023-11-01T00:49:25Z")

</div>

> [@sbdutoo](#):
>
> I discover the line code “setPaused(false)” to stop and restart my music in same location after the game paused. Its works perfectly !  
> But every time the music restart, there are glitchs or numeric glitch and with a little delay.  
> This problem can be heard directly in FMOD and with any event.

This is expected behavior. `EventInstance::setPaused` pauses/unpauses an event with a 64-sample ramp in/out, and `Bus::setPaused` uses no ramp, the latter of which especially can create clicks/pops. A very small delay is to be expected due to the asynchronous nature of the [Studio System’s processing model](https://www.fmod.com/docs/2.02/api/studio-guide.html#studio-system-processing), but this should be around 20ms-40ms, which is the default update rate, unless you’re using streamed assets. With streamed assets, from a brief test I was able to observe a delay of about 200ms with a streamed asset between the API command being enqueued, and the event’s output pausing/unpausing.

There’s a number of ways to make the pause/unpause less noticeable, and to work around the lack of a fade, both of which typically involves creating some means of fading the event volume yourself. A common one is to create a snapshot with an AHDSR that modulates the volume of the bus your event is routed to. In code, you can then start/stop the snapshot just before pausing/unpausing the event.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [November 9, 2023, 12:11am UTC](https://qa.fmod.com/t/pausing-music-create-bug-numeric-clip-when-restart-event/20823/3 "2023-11-09T00:11:00Z")

</div>

Just following up on this @sbdutoo - was my suggestion sufficient to work around the issue? If not, can you elaborate on any issues you were running into?

---

<div class="post-metadata">

**Author:** ![sbdutoo](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sbdutoo](https://qa.fmod.com/u/sbdutoo)\
**Post date:** [November 9, 2023, 5:16pm UTC](https://qa.fmod.com/t/pausing-music-create-bug-numeric-clip-when-restart-event/20823/4 "2023-11-09T17:16:24Z")

</div>

Hi Leah,

I read your answer which unfortunately does not give a solution for the delay but makes the clicks/glitchs invisible.

After various tests carried out with the tech of my project we found a solution which works perfectly !  
This is to put setPitch(0) and setPitch(1) instead of setPause(true) and setPause(false). It works beautifully, without delay and glitches.

Thanks for your answer Leah

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [November 9, 2023, 10:22pm UTC](https://qa.fmod.com/t/pausing-music-create-bug-numeric-clip-when-restart-event/20823/5 "2023-11-09T22:22:57Z")

</div>

> [@sbdutoo](#):
>
> I read your answer which unfortunately does not give a solution for the delay but makes the clicks/glitchs invisible.

My apologies, I neglected to mention that the expected delay should be fairly low, around 20-40ms, which aligns with the default update rate of 20ms, **unless** you’re streaming the assets being played, in which case the delay can potentially be more significant, like the 200ms I noted. I’ve edited my initial post accordingly. If the assets you’re playing are set to stream, I would recommend disabling that in the Asset Browser, and seeing whether it makes a difference.

Otherwise, I’m happy to hear that you’ve managed to find a solution that works for you!

---

<div class="post-metadata">

**Author:** ![sbdutoo](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sbdutoo](https://qa.fmod.com/u/sbdutoo)\
**Post date:** [November 28, 2023, 5:10pm UTC](https://qa.fmod.com/t/pausing-music-create-bug-numeric-clip-when-restart-event/20823/6 "2023-11-28T17:10:54Z")

</div>

Yes I apply this method on music that is in streaming. Therefore, the delay is longer like 200ms as you say. Oui, j’ai trouvé une solution parfaite avec le pitch. N’hésitez pas à la partager.

Thanks a lot for Fmod and this forum !

Samuel
