# Audio stuttering when playing Event continuously

**URL:** <https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482>\
**Category:** FMOD Studio\
**Created:** [April 10, 2024, 5:54pm UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482 "2024-04-10T17:54:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eneskp3441](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/eneskp3441/32/6516_2.png) [@Eneskp3441](https://qa.fmod.com/u/Eneskp3441)\
**Post date:** [April 10, 2024, 5:54pm UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/1 "2024-04-10T17:54:25Z")

</div>

I have a weapon sound event and in the Gamemaker engine I create and play the event every time I shoot with my weapon (weapon cooldown 0.078). The sound plays, but it seems to stutter occasionally. There is no such problem when I shoot less frequently. I don’t know what the problem is or how to fix it.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [April 17, 2024, 4:28am UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/2 "2024-04-17T04:28:17Z")

</div>

Hi,

Could you please share the version number of the FMOD studio you used and a code snippet of how you trigger the events? Also, could you please collect a profiler capture ([12.2 Recording a New Session](https://fmod.com/docs/2.02/studio/profiling.html)) while reproducing the issue you mentioned in-game, then package your profiler session ([12.1 Managing Sessions](https://fmod.com/docs/2.02/studio/profiling.html)) including banks (ticking the “Banks” option when exporting), and upload it to your FMOD [Profile](https://fmod.com/profile)?

---

<div class="post-metadata">

**Author:** ![Eneskp3441](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/eneskp3441/32/6516_2.png) [@Eneskp3441](https://qa.fmod.com/u/Eneskp3441)\
**Post date:** [April 17, 2024, 7:29pm UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/3 "2024-04-17T19:29:15Z")

</div>

My fmod studio version is **2.02.10**  
The Fmod Extension For Gamemaker Engine: [GitHub - YoYoGames/GMEXT-FMOD: Repository for GameMaker's FMOD Extension](https://github.com/YoYoGames/GMEXT-FMOD)  
**Code:**

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/8/8a1147e8e8037e373efeffb47ad134c7504b3bde.png)

The Profile (I don’t have a project right now, I’m just testing the plugin so I couldn’t uplaod it.)  
But there seems to be a problem in the places I have drawn in yellow here.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/4/4acb2d8466f04cec44e3a66b71fbeea8181a0b31.png)

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [April 18, 2024, 3:03am UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/4 "2024-04-18T03:03:37Z")

</div>

Hi,  
Please try updating to the most recent FMOD version (2.02.21) and let me know if the issue persists. Are there any errors or warning logs when you encountered the issue?  
Could I please get a screenshot of the event in your FMOD Studio project? Specifically, if the gunshot event is a 3D sound or not. If it is a 3D sound, please try providing 3D attributes to the event instance right after creating it: [FMOD Engine | 6. Studio API Reference | Studio::EventInstance::set3DAttributes](https://www.fmod.com/docs/2.02/api/studio-api-eventinstance.html#studio_eventinstance_set3dattributes)  
Thanks for the images, without the profiler recording or more information it is difficult to identify the potential issue.

---

<div class="post-metadata">

**Author:** ![Eneskp3441](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/eneskp3441/32/6516_2.png) [@Eneskp3441](https://qa.fmod.com/u/Eneskp3441)\
**Post date:** [April 18, 2024, 3:01pm UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/5 "2024-04-18T15:01:39Z")

</div>

Version 2.02.21 has the same error, I get no error message. gunshot event is from the default examples project.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [April 23, 2024, 4:15am UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/6 "2024-04-23T04:15:48Z")

</div>

Thank you for the video.  
The `machine_gun` event was initially created to be played in a loop rather than starting a new instance per ‘shot’. Please try re-adding the loop region ([FMOD Studio | 27.57 Loop Region](https://www.fmod.com/docs/2.01/studio/glossary.html#loop-region)) as the event was originally set.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/c/c5ebd39b129df3bb34d043c4af65233fe3a44642.png)  
and a parameter ([FMOD Studio | 7 Parameters](https://www.fmod.com/docs/2.00/studio/parameters.html)) to define whether the event loops or not. For documentation outlining the use of a parameter, please check [FMOD Studio | 7.1.3 Parameter Trigger Conditions](https://www.fmod.com/docs/2.00/studio/parameters.html#parameter-trigger-conditions).

For ‘continuous’ firing set the parameter to a value that triggers the loop region to loop

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/7/744338a4f59f8fe84da5fc5c051841d8206193be.png)  
While the ‘single’ can use the default value (`0`) as we do not wish it to loop.

For ‘continuous’ firing you could use [mouse\_check\_button](https://manual.gamemaker.io/monthly/en/GameMaker_Language/GML_Reference/Game_Input/Mouse_Input/mouse_check_button.htm) for starting the looping event, and [mouse\_check\_button\_released](https://manual.gamemaker.io/monthly/en/GameMaker_Language/GML_Reference/Game_Input/Mouse_Input/mouse_check_button_released.htm) to stop it. Please note you will have to keep a reference to the `event instance` started by the `mouse_check_button` function so it can be passed into the `released` function. [mouse\_check\_button\_pressed](https://manual.gamemaker.io/monthly/en/GameMaker_Language/GML_Reference/Game_Input/Mouse_Input/mouse_check_button_pressed.htm) can be used for the ‘single’ shot.

Hope this helps. If you have any more questions please do not hesitate to ask.

---

<div class="post-metadata">

**Author:** ![Eneskp3441](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/eneskp3441/32/6516_2.png) [@Eneskp3441](https://qa.fmod.com/u/Eneskp3441)\
**Post date:** [April 23, 2024, 10:34am UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/7 "2024-04-23T10:34:10Z")

</div>

I understand, but the firing rate of each weapon will be different, if I use loop region, how will I set the firing rate with the code?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [April 24, 2024, 1:55am UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/8 "2024-04-24T01:55:08Z")

</div>

An option may be increasing the pitch of the event instance depending on the rate of fire [fmod\_studio\_event\_instance\_set\_pitch()](https://github.com/YoYoGames/GMEXT-FMOD/wiki/event_instance#fmod_studio_event_instance_set_pitch)  
For more information about setting the pitch, please see [FMOD Engine | 6. Studio API Reference | Studio::EventInstance::setPitch()](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#studio_eventinstance_setpitch)

---

<div class="post-metadata">

**Author:** ![Eneskp3441](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/eneskp3441/32/6516_2.png) [@Eneskp3441](https://qa.fmod.com/u/Eneskp3441)\
**Post date:** [April 27, 2024, 11:06am UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/9 "2024-04-27T11:06:43Z")

</div>

If I adjust the pitch of the sound, the sound changes. I need to adjust it without the sound changing.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [April 30, 2024, 4:32am UTC](https://qa.fmod.com/t/audio-stuttering-when-playing-event-continuously/21482/10 "2024-04-30T04:32:28Z")

</div>

I understand.

A solution may be creating events for each fire rate with different loop lengths, this will trigger the instrument more frequently without affecting the sound.
