Don't forget to up-vote the question or answer if you find it helpful! If it's your own question and you're very happy with an answer you can accept it as best answer.
Just wanted to pick some peoples brains on how they arrange high rpm gun sounds in a game engine. Previously I would work out how many bullets are fired per second (say 10) then I would make a bullet sound last 100ms. I would then make 6-7 variants and then in the engine get it to randomize between each sound adding slight modulation and then once the trigger has been release to play a tail sound.
I am working on a space sim atm and the programmer is using OpenAL as the sound engine. Currently the way he wants to approach fast machine gun like sounds is for me to make a seamless loop of a few seconds which he can just have looping when someone clicks and holds fire.
This got me wondering which way is better and what experience other people have had when dealing with really fast firing gun sounds?
I remember sitting in a talk at AES two years ago where someone was talking about the sound implementation for Halo (Reach I think). One particular example was for a vehicle mounted Gatling gun. There were multiple states that the game would switch to, depending on how the player used the gun: a bank of single shots, a bank of short to medium duration rapid fire sounds for bursts of fire, and a longer file of continuous fire. For initiation of continuous fire, the game engine would play back sounds from the bank of short/medium bursts. If the firing continued (let's say past 3 loops/files, for arguments sake), the game engine would then switch over to looping the single longer continuous file. This system allowed the game to reduce the instances of file playback as the player fell into sustained behavior.
Please note: When commenting on someone's question or answer, you will not receive notification on follow up comments unless you are mentioned with @Username. So for Andrew Spitz, you only need to use @Andrew
As with many things in sound the answer to which is better is ... it depends on a few things which is the best to go for and which sounds best.
First thing to consider is fire rates and frame rates and if you audio engine is frame rate dependent.
Granular systems (e.g. 100ms sounds 6-7 variants played consecutively) this works well if the rpm of the gun is well below the frame rate or your audio engine is capable of playing sounds between frames (frame rate independent). If you try to play a high rpm weapon with a frame rate dependent audio engine it plays back un evenly.
For example if the frame rate is 30 Hz and the rpm of the gun is 25 the audio engine will try to play a sound every 1.2 frames. This is can't do so what you'll get is something like 4 frames where a sound will play then it will skip a frame and then start playing again for 4 frames etc.
In my humble opinion this can make the gun sound weaker and not as convincing for the player. Also if the game is not at a stable frame rate this can seriously effect the sound.
Games like Battlefield use the frame rate independent system build into layers. Max Payne 1 and 2 however had a frame rate dependent rapid firing guns, and if I remember correctly so does Death Rally for iOS.
Looping is a good solution if you have a frame dependent audio engine and the fire rate of the weapons is high. if you know the clip length of each weapon then you can make one 'taka taka taka' sound that covers the whole clip length, this way you can bake in the 'swell' of the gun sound into the wav file which adds nicely to the sound.
'Looping' systems are usually broken into 3 parts. A single shot when the player pulls the trigger, followed by the loop as the trigger is help, then a single shot tail when the trigger is released. The good things about the looping system is that it is easy to integrate and the quality is guaranteed each time. The bad thing is that the loop is the same each time which can get annoying and if you want to change the fire rate of the weapon for any reason then you have to remake the sound. This is the system we used on Alan Wake American Nightmare in general we got pretty good response for the gun sounds.