Arma 3
38 ratings
How To Loop 3D Audio
By Frankovich
The easiest way to get 3D positional audio looping. Great for creating ambience!
3D Positional Audio is sound that comes from a specific position in-game. It's very useful for adding immersion to missions as it can be used for background ambience as well as general sound effects.
While getting a positional sound to play once is relatively easy to figure out, getting it to loop is another story. Due to the amount of outdated/incomplete information regarding this particular problem, I thought, since I finally figured this out, that I would write a guide...

So, here's the simplest way I've found to create looped 3D positional audio in Arma 3.
I'll explain how to have the audio running constantly from mission start and also how to trigger it with an event.

You'll need:
  • An audio file converted to .ogg format
  • A description.ext file in your mission folder (I'll explain how to make one in the following steps)
Step 1 - Audio File
First, you need an .ogg format audio file to play.
(There are many free online converters or you can use Audacity to convert an mp3)

Once you have your .ogg audio file you need to place it in your mission folder.
(...\Documents\Arma 3 (Other Profiles)\--Username--\missions\--MissionName--\)

To keep things tidier, consider making a "sounds" folder in your mission folder to store all the mission's audio files.
(For the purpose of this guide, we will assume you made a sounds folder and placed the audio file inside.)
Step 2 - Description File
Now, you need a description.ext file in your mission folder to give your audio file a variable name.

1 - Navigate to your mission folder.
(...\Documents\Arma 3 (Other Profiles)\--Username--\missions\--MissionName--\)

2 - Create a new text document.

3 - Paste the following code in the text document:
class CfgSounds { sounds[] = {}; class sound01 // This (sound01) is the classname you will use to refer to the sound in your code. { name = "Sound 01"; // This line is only needed if you want to be able to select the sound in the Trigger effects drop-down menus for sound. Call it whatever you want otherwise remove the line. sound[] = {"\sounds\audiofile.ogg", 1, 1}; // This is the path to the audio file in your mission folder. The first 1 is volume. The second 1 is speed of playback. titles[] = {}; }; };

4 - Adjust the audio file path in the code to match the path to your audio file.

5 - Save the text document as description.ext
(You will be asked if you are sure you want to change the file format. Click yes.)
Step 3 - Using an Object
Finally, you need to set up an object or trigger to play the sound in the Arma editor.
First I'll explain how to do it with an object.

1 - Place an object on the map.

2 - Double click the object and insert the following code in the object's init field:
nul = [this] spawn {while {true} do {(_this select 0) say3D "sound01"; sleep 150;};};
(Notice in quotes the sound classname "sound01", which we defined in the description.ext file. If you named your sound classname something different, it needs to reflect that here also.)

3 - Notice the section of code that says sleep 150? The 150 is the length in seconds of my audio file which is 2 minutes and 30 seconds long. (2x60+30=150) Adjust this to whatever the length of your audio file is.

Sleep is the function that makes the game wait before starting the audio track again, so if you set it correctly, you will get a continuous audio loop

That's it! Preview your mission and you will have a continuous audio loop originating from the position of the object you placed.
Read on to learn how to implement this code in a trigger rather than an object.
Optional - Using a Trigger
To use this method via a trigger, follow these steps:

1 - Place a trigger on the map.

2 - Double click the trigger and insert the following code in the trigger's onActivation field:
nul = [thisTrigger] spawn {while {true} do {(_this select 0) say3D "sound01"; sleep 150;};};
(Again, the sound classname "sound01", needs to be the same as what you defined in the description.ext file. Also, notice that nul = [this] has changed to nul = [thisTrigger])

3 - Adjust the sleep length to match the length of your audio file in seconds.

4 - Now you can set the trigger's conditions. Fulfilling them will trigger the audio loop with the sound originating from the trigger's position.

< >
Laqueesha Jul 14 @ 12:54pm 
Tip: If you want the sound to come from a specific object, replace "ThisTrigger" with the object's name. Also bear in mind that using time compression might cause the repeated sound to overlap, creating double sounds.
TPM Jun 13 @ 12:10am 
Is there anyway to increase the distance in which the sound will be heard? I know you can do it with with an action, like turning on a radio, but this requires player interaction. eg

radio1 addAction [ "Music On", {
radio1 say3D ["msuic1", <distance in meters>, 1];
} ];
Jaki Jan 23 @ 6:36pm 
any idea how would you do it for playSound?
marksha88 Dec 23, 2017 @ 1:21pm 
Hi i add this well!! cool!
But i want add mission with music to my server And the music not work why?
nAtOeD Sep 6, 2017 @ 3:14am 
thx for the reply Frankovich, I just joined the music tracks together as a work around for now, but the array method sounds much better so please have a look for me cheers natoed
Frankovich  [author] Sep 2, 2017 @ 4:34am 
Hey Natoed, sorry for the late reply. You can absolutely do that! Basically you need to define an array of songs. Then have the code randomly pick from the array instead of playing a single song. It would get a little tricker though as far as the looping aspect goes. Possible though. I have a similar thing set up in a mission I was working on but I can't remember if it loops or not, I'll check it out for you and let you know.
nAtOeD Aug 17, 2017 @ 7:27pm 
Hey Frankovich
Is there any way I can randomism "sound01" and have say 3-4 sounds that it could play!
I use your code to play a music track at the traders, just the same song is doing my head in
nAtOeD Jul 11, 2017 @ 7:17pm 
thx , 2 days trying to use say3d cause epoch love to block shit
but now it works as it should:steamhappy:
Frankovich  [author] Jul 1, 2017 @ 10:20am 
Hey guys, sorry for the late reply! Glad I could help! :)
@TommyYWaffleZ Hey mate, try checking that you've typed the names of everything correctly and that the paths are correct.
@Tinteex Hey mate, What exactly do you mean? If you mean how to make a single object play a series of audio files on loop, there is a number of ways to do it. You could manually add in to the init field code to play each track then sleep for that tracks length.
But much easier and tidier would be to make an array of sounds and then tell the object to play the array of sounds, then sleep for the total time of all the tracks in the array. Tell me exactly what you want your mission to do and I'll try to help as best I can. :)
Gefr.Schultz.23PzD Apr 28, 2017 @ 11:28am 
how to add multiple sounds?