# Fast firing weapon problems

**URL:** https://qa.fmod.com/t/fast-firing-weapon-problems/17287
**Category:** FMOD Studio
**Created:** [June 3, 2021, 1:19pm UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287 "2021-06-03T13:19:23Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 3, 2021, 1:19pm UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/1 "2021-06-03T13:19:23Z")

</div>

Ok, having an issue here.  
I have a fast firing weapon, but it is not _that_ fast.

I have it set up currently so it is playing a loop of fast firing sounds. Then on “not playing” i go to a tail sound. Works perfectly.  
If i single tap, the weapon only fires one projectile (i’m talking graphics here - I can see 1 projectile on screen). The problem is that I can hear 2 shots being fired. Or I can hear one shot and then an abrubt tail of the next sound in the loop, before it goes over to the tail of the sound.

If I pitch down the loop, so it is so slow that merely tapping the mouse button will only trigger the first shot of the loop, then when I hold down the mouse button, the audio does not match the visual projectiles at all. The visual projectiles are much faster than the audio loop.

How would you go about solving that problem?

In the past, I had the weapon firing a single event for each projectile, but that resulted way to many instances being spawned, and I have several of these weapons close to each other. (the weapon is scalable and can go very fast).

What would a good solution be?  
One solution I could see, is to have the coder to make it so that every first projectile is played as a one shot event, and the next one will be played as a looped event.  
Thanks

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 3, 2021, 2:06pm UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/2 "2021-06-03T14:06:52Z")

</div>

Seems like this might be a solution… going back to one shot sounds?  
“As long as you are correctly releasing your event instances (call `EventInstance::release()` after starting the one-shot gun fire event) then there shouldn’t be too much to worry about. Whilst you are correct that one event instance looping 10 times for 1 second would “perform” better than creating and releasing 10 separate event instances, the actual performance difference is so minute that you would not be able to tell. The benefit of having the sound sync up to your animations far outweighs the “increased” performance from using a looping event.”  
From

> [@Synch FMOD Machinegun event with shoot() method in unity weapon script](https://qa.fmod.com/t/synch-fmod-machinegun-event-with-shoot-method-in-unity-weapon-script/14402/3):
>
> Thank you for your help so far. Lets say i manage to create a single shot event that chains up with a separate event for a tail Sound and this constellation sounds as accurate as my looping event. So far so good. But how do the two approaches compare in terms of performance? As far as i understand it for the looping approach i would need to instantiate only one fmod event for each full auto action, no matter How high the RPM count goes. For your approach wouldnt i need to create one instance for…

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [June 3, 2021, 11:31pm UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/3 "2021-06-03T23:31:38Z")

</div>

What’s your problem, exactly? If I understand correctly, it’s that you’re not able to accurately quit the loop at the right moment, which is especially noticeable for one shots. How is set your loop exactly, can you share a screenshot?  
(Though the single shot implementation may be correct, I personally like to solves problems directly within FMOD Studio - but that’s just me)

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 4, 2021, 6:23am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/4 "2021-06-04T06:23:54Z")

</div>

Here is the the timeline loop, that in turn plays a loop under “RateOfFire” parameter.  
When stopping the loop, it goes to the tail marker.

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

And here is the actual loop that is being played.

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

And yes, I am not able to quit the loop at the right moment. If i quickly tap the mouse, and I have a high fire rate, I can hear multiple shot sounds (because the loop is being played fast). But I can only see one projectile on screen.  
Also if I press down and have the loop playing, and let go just when a new shot sound has been heard, I can hear it abruptly stopping, because it is going to the tail.

Thanks

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [June 4, 2021, 8:11am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/5 "2021-06-04T08:11:32Z")

</div>

Ah, but you’re using a baked-in loop. That may not be the right choice, to be able to quit the loop discretely after a single shot (and not in the middle of if). I would rather tend to chop each shot sound and put all of them in a multi instrument (or a scatterer, for variable rate of fire), which would be more manageable, for what you’re trying to achieve.

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 4, 2021, 8:16am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/6 "2021-06-04T08:16:26Z")

</div>

Currently it is set up as a loop. But your solution is to fire an event for each projectile? Then I will have to talk to the programmer again to set it up like that.  
Thanks

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [June 4, 2021, 8:20am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/7 "2021-06-04T08:20:02Z")

</div>

No, a single event with a looping on each shot, instead of a series of shots like it seems to be the case in your project.

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 4, 2021, 8:21am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/8 "2021-06-04T08:21:59Z")

</div>

But then the shots will have to be cut off very fast and have no tail (when exporting them from DAW), becuase otherwise they will take forever to loop (because they have to go to the end of the wavefile). Right? Thanks a lot:)

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [June 4, 2021, 8:26am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/9 "2021-06-04T08:26:17Z")

</div>

No, with a scatterer, the new shot can be spawned even if the previous isn’t finished. Here’s a video capture of one of my events (a variable speed footsteps loop) that works pretty similarly. I use a sustain point rather than a loop because I found that extremely reliable and responsive, and works really well to have the last sound played entirely before exiting. At the end, I show how you could add a tail sound that would trigger when exiting the loop.

[![](https://img.youtube.com/vi/BV4OrH-7Zck/hqdefault.jpg "Variable speed footsteps loop") ](https://www.youtube.com/watch?v=BV4OrH-7Zck)

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 4, 2021, 8:32am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/10 "2021-06-04T08:32:21Z")

</div>

Great, thanks, will have a look. Have had lots of problems with the scatterer cutting up audio in the past, but will try again:)

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 4, 2021, 8:35am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/11 "2021-06-04T08:35:50Z")

</div>

Yeah, there is still the same problem. Because of the fast fire rate, I have to have voices set to 12 to not get weird souding audio because of instances playing on top of each other (if i got to a lower poly). If I set it to 1 (which I would like), then audio gets cut up.  
So it seems like I will be using 12 voices for one weapon which is not good. Will post a screen recording

[![]( " - YouTube") ](https://www.youtube.com/watch?v=vCKDxReuG7Y)

@Alcibiade  
Maybe a bug? @joseph

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [June 4, 2021, 8:44am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/12 "2021-06-04T08:44:44Z")

</div>

If you’re using the event only at fast rates, chop your shot tighter and put the tail after exiting the loop.  
Is it really problematic in terms of performance to stack 12 voices? I don’t know… I don’t really hear a problem in your exemple, except at poly=1, which is weird.

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 4, 2021, 8:45am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/13 "2021-06-04T08:45:51Z")

</div>

Thanks. There is a problem at 4 voices as well, and the 1 voice problem is really weird.

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [June 4, 2021, 8:48am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/14 "2021-06-04T08:48:35Z")

</div>

That being said, I’ve already made [a suggestion](https://qa.fmod.com/t/suggestion-steal-release-time/17144) to have a steal delay (for smooth cuts). Though I understand the argument for not adding this in the event macros (because it’s more of a resource management question), it should be present in the scatterer. Don’t you think so, @joseph?  
Though not sure it’s the exact problem here.

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 4, 2021, 8:55am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/15 "2021-06-04T08:55:04Z")

</div>

Yeah it isnt working for me. I get a lot of choppy audio when using the scatterer. Too bad. So I still have the same problem as in the beginning.

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [June 4, 2021, 9:01am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/16 "2021-06-04T09:01:34Z")

</div>

You still should try with shorter sounds, higher poly, and a separate tail.

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 4, 2021, 9:04am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/17 "2021-06-04T09:04:29Z")

</div>

Same problem. With a 120ms short sample and spawn rate set to 100%, poly set to 6, everything is fine. I go to 110% and everything gets choppy and stuttery. Doesnt matter how high I set the poly actually

---

<div class="post-metadata">

### Author: ![trjaudio](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@trjaudio](https://qa.fmod.com/u/trjaudio)
#### Post date: [June 4, 2021, 12:02pm UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/20 "2021-06-04T12:02:42Z")

</div>

Turns out the scatter problem is an fmod problem. It is solved in 2.01.09

---

<div class="post-metadata">

### Author: ![Skaven252](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/skaven252/32/63_2.png) [@Skaven252](https://qa.fmod.com/u/Skaven252)
#### Post date: [June 9, 2021, 5:59am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/21 "2021-06-09T05:59:18Z")

</div>

Instead of scatterer you can just use a timeline loop (or a transition to marker with a condition) with an Async Multi-Sound to retrigger the shot in a loop. The Multi-Sound can also be given a poly limit with Steal Oldest. Even with limit of 2-3 voices it should have enough overlap to not sound choppy.

Another way to set a precise transition from loop to tail is to match the BPM of the timeline with the loop sound (in timeline sync) and set the transition to tail to occur on beat. That should let you avoid hearing ‘half a shot’ on stop.

However… overall, getting shots synced and matched with game on fast firing weapons is a bit of a nightmare in any game. For example in Destiny they had to dictate that the frame rate of the game is fixed, and that the auto weapons only fire at multiples of frame rate (every 2 or 3 or 4 frames). Only that way they could achieve perfect sync. Many game designers are not willing to submit to such measures just for the sake of sound.

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [June 9, 2021, 7:11am UTC](https://qa.fmod.com/t/fast-firing-weapon-problems/17287/22 "2021-06-09T07:11:19Z")

</div>

It seems he wants a variable rate of fire (he has a parameter), that’s why the scatterer seemed a good solution. A simple loop won’t be able to achieve that.

Interesting points, concerning image synchronization with fast firing weapons.

[Next page](https://qa.fmod.com/t/fast-firing-weapon-problems/17287.md?page=2)
