Automatic gunfire w/ Fmod

TLDR: How do I set up a fast firing gun in UE4 w/ fmod without it stuttering?

Currently having major issues with trying to implement my AK47 gun sound into UE4 with fmod.

Right now I have had my programmer set up our AK47 gun to do time between shots for the fire rate and have an event that triggers the gunshots with left mouse pressed down. So basically your typical automatic gun fire. The issue is that the audio isnt consistent with the fire rate 1:1.
Recorded example of audio:


fullscreen ss

We’re using a single audio file and not a loop for consistancy.
Here’s what the basic bp looks like:


fullscreen ss

The print string we set up shows the fire is consistant physically but with fmod, but the audio seems to stutter and isnt 1:1. Any idea why this is happening. I’ve also included a short video to kind of show you what i mean. If you skip to 1min in you can hear the gun fire:

Thanks in advance, really looking forward to getting some help on this as its driving me nuts lol :slight_smile:

Generally using a looped event would be best for this, but you could also use a scatter sound without all the 3D area attributes.

When creating and playing multiple events, it can be difficult to guarantee the accuracy at which they are played. There are a few things you can do to help though.

Make sure banks are loaded well before hand, as well as the sample data, and not using streamed files for short quick events.

Problem is being able to stop that loop in UE4 with release of mouse button one, fmod doesnt even have a simple “stop event sound” and event instance stop doesnt seem to work.
Imgur: The magic of the Internet my bp

The return value of “Play Event at Location” is a FMODEvent Instance, which has a Stop function.

Otherwise you could add a FMOD Audio Component to the object, this will keep it in the world relative to the parent, and call stop/start as needed without having to create a new event each time.

We have the fmod fire sound set to a loop inside fmod studio. If you look at the bp screenshot i posted, that’s how we have it setup, the loop just continues to play though after 1 mouse click http://imgur.com/a/vx42G

Sorry didn’t see the picture, can you verify the blueprint is passing through the stop call? I am able to use almost the exact same setup with no issues. http://imgur.com/jt47UBa

What version of UE4 and the FMOD Integration are you using?

Using straight BP and no c++ doesn’t work either. I replicated exactly what you did and the looping continues on release.

Screen of BP: http://imgur.com/a/3VXgn
FMOD Studio loop: http://i.imgur.com/v3qJhof.png

Cameron, we have done this, we are using a mixture of C++ and Blueprint, so the Fire Audio Trigger calls on Left Mouse Down and Stop Fire runs on Release, both in the Player Controller. Even with your BP duplicated in the blueprint FirstPersonCharacter we have the same issue.

We are both very stumped

1 Like

4.15.1 & 1.09.03

1 Like

Some progress here: Problem 1 solved with removing all release on AHDR but now if i press the left mouse quickly for 1 shot, it doesnt play the entire clip through for a single gun shot.

Ah yes, I didn’t anticipate that.
I would probably suggest using a parameter and trigger condition on the loop. Then instead of telling the event to stop, you change the parameter to allow the sound to play out but end the loop. Then the sound will produce no noise and remove itself.
http://imgur.com/nDU7dEF
http://imgur.com/pFmvKaL

It’s odd because I have it set up exactly as you do but it just keeps looping after 1 press of the mouse

I’m assuming when you say it triggers on Left Mouse Down, its only the first frame the button is down and not repeated while the button is held down.

It sounds like there are multiple looped instances being played then when you release only the last will be stopped because you aren’t keeping a reference to them all.
You can verify this using Studio and Live Update to track the number of events being played.

In Studio, you shouldn’t need another sound in the loop parameter otherwise it will play an additional sound when that parameter value is set. The parameter should just turn the loop region on and off on the main sound.
If you have set it up that way on purpose then ignore this comment.