Arma 3
63 ratings
How To Loop 3D Audio
By Frankovich
The easiest way to get 3D positional audio looping. Great for creating ambience!
   
Award
Favorite
Favorited
Unfavorite
Intro
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.

24 Comments
Joshua9797💾 11 Aug, 2023 @ 9:35am 
@Cypher_112
You probably have to set "isSpeech" to 2 as described here in the documentation [community.bistudio.com] under syntax 2.

Here's how it works for me:

nul = [this] spawn {
while {true} do {
(_this select 0) say3D ["sound01", 100, 1, 2];
sleep 150;
};
};
Cypher_112 8 Mar, 2023 @ 1:15am 
louder outside the vehicle can i change to say "inside the vehicle"?
Cypher_112 8 Mar, 2023 @ 1:14am 
seems for me i can hear it loudly in the passenger seat but driver and rear passenger seats i can barely hear it. anyone else have this issue or know of a fix?
Slap_Dat_LamaAss 30 Apr, 2020 @ 6:42am 
I have followed the steps, using the trigger option. I want the object "alarm1" to have the sound coming from, instead of the trigger. - How can I do this?
Umbhaki 24 Apr, 2020 @ 7:46am 
Hey, I find that in single player if you die and re load the looping sounds dont play until they have slept for one cycle, then start playing again, annoying if you have a 20 minutes sound. It kind of ruins the atmosphere if your obects with custom sounds have to wait for a full loop before playing again after loading.. Anyone else notice this?
Thatch 1 Aug, 2019 @ 1:12pm 
This works just fine in single player but when i try to use the mission on a dedicated server it fails to play anything. am i doing something wrong?
0ozymandias 12 Mar, 2019 @ 12:45am 
Apologies for the necro but how would one go about adding this to multiple objects at once? Its a terrible job to have to copy/paste this code 20+ times..
Bill D. Garrison 31 Oct, 2018 @ 10:10am 
Following up on nAtOeD's comment, where and how can I create an array to play random sounds? I'm thinking of having random chatter for AI units at base. I already have the CFGSounds set up properly in my mission's description.ext. Any ideas?
Laqueesha 14 Jul, 2018 @ 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 13 Jun, 2018 @ 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];
} ];