{"name":"createSoundSource","operator":null,"title":"createSoundSource","type":"command","url":"https://community.bistudio.com/wiki/createSoundSource","revid":377426,"updated":"2026-01-02T06:45:39Z","groups":["Sounds"],"status":"ok","replaced_by":[],"games":[{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":"global","server_exec":false},"exec":null,"description":"Creates a sound source of the given type (type is the name of the subclass of CfgVehicles which is pointing to the sound defined in CfgSFX).\nThe actual sound object created is of type `\"#dynamicsound\"` and could be detected with allMissionObjects.\nIf the markers array contains several marker names, the position of a random one is used, otherwise, the given position is used.\nThe sound source is placed inside a circle with this position as its center and placement as its radius. Some of the vanilla classes pre-configured in Arma 3:\n- `\"Sound_Alarm\"`\n- `\"Sound_Alarm2\"`\n- `\"Sound_BattlefieldExplosions\"`\n- `\"Sound_BattlefieldFirefight\"`\n- `\"Sound_Fire\"`\n- `\"Sound_SmokeWreck1\"`\n- `\"Sound_SparklesWreck1\"`\n- `\"Sound_SparklesWreck2\"`\n- `\"Sound_Stream\"`\n\nSince Arma 3 v1.70 it is possible to define sounds for use with createSoundSource in Description.ext.\nAs mentioned earlier, the sounds needed for this command should be defined inside CfgVehicles class, which itself references CfgSFX class.\nIf given class searched in main config and is not found, the search will continue in description.ext - see #Example 3.\n\n> [!NOTE]\n> A sound created by createSoundSource will always be looping.\n\n> [!NOTE]\n> **Arma 3:** In earlier Arma 3 versions, the sound created was greatly attenuated if the player was in first person view inside a vehicle at the moment of execution.","syntaxes":[{"syntax":"createSoundSource [type, position, markers, placement]","since":null,"effect":null,"exec":null,"params":[{"name":"type","type":"String","optional":false,"default":null,"description":"CfgVehicles class","types":["String"],"since":null,"text":"type: String - CfgVehicles class"},{"name":"position","type":"Object or PositionAGL or Position2D","optional":false,"default":null,"description":"desired placement position","types":["Object","PositionAGL","Position2D"],"since":null,"text":"position: Object or PositionAGL or Position2D - desired placement position"},{"name":"markers","type":"Array","optional":false,"default":null,"description":"if the markers array contains any markers, the position is randomly picked from array of given markers plus desired placement position.\nIf any of the markers were given a Z coordinate with setMarkerPos, the sound will also be created at the given Z coordinate","types":["Array"],"since":null,"text":"markers: Array - if the markers array contains any markers, the position is randomly picked from array of given markers plus desired placement position.\nIf any of the markers were given a Z coordinate with setMarkerPos, the sound will also be created at the given Z coordinate"},{"name":"placement","type":"Number","optional":false,"default":null,"description":"the sound is placed inside a circle with given position as center and placement as its radius","types":["Number"],"since":null,"text":"placement: Number - the sound is placed inside a circle with given position as center and placement as its radius"}],"returns":{"type":"Object","types":["Object"],"description":null,"text":"Object"},"form":"unary","operator":null,"left":null,"right":{"text":"[type, position, markers, placement]","types":["Array"]}}],"examples":[{"text":"```sqf\n_soundSource = createSoundSource [\"LittleDog\", position player, [], 0];\n```","code":["_soundSource = createSoundSource [\"LittleDog\", position player, [], 0];"]},{"text":"```sqf\n0 spawn \n{\n    _alarm = createSoundSource [\"Sound_Alarm\", position player, [], 0]; // starts alarm\n    sleep 10;\n    deleteVehicle _alarm; // stops alarm\n};\n```","code":["0 spawn \n{\n\t_alarm = createSoundSource [\"Sound_Alarm\", position player, [], 0]; // starts alarm\n\tsleep 10;\n\tdeleteVehicle _alarm; // stops alarm\n};"]},{"text":"Arma 3 v1.70 Here is an example of suitable mission config definition:\n\n```cpp\n// description.ext\nclass CfgSFX\n{\n    class MyOwl\n    {\n        sound0[] = { \"@A3\\Sounds_F\\environment\\animals\\birds\\owl1\", db-10, 1.0, 1000, 0.2, 0, 15, 30 };    // path to addon sound\n        sound1[] = { \"@A3\\Sounds_F\\environment\\animals\\birds\\owl2\", db-10, 1.0, 1000, 0.2, 0, 15, 30 };    // path to addon sound\n        sound2[] = { \"@A3\\Sounds_F\\environment\\animals\\birds\\owl3\", db-10, 1.0, 1000, 0.2, 0, 15, 30 };    // path to addon sound\n        sounds[] = { \"sound0\", \"sound1\", \"sound2\" };\n        empty[] = { \"\", 0, 0, 0, 0, 0, 0, 0 };\n    };\n};\n\nclass CfgVehicles\n{\n    class MyOwlSound // class name to be used with createSoundSource\n    {\n        sound = \"MyOwl\"; // reference to CfgSFX class\n    };\n};\n```\n\n```sqf\nprivate _owl = createSoundSource [\"MyOwlSound\", position player, [], 0];\n```","code":["private _owl = createSoundSource [\"MyOwlSound\", position player, [], 0];"]}],"multiplayer":"When a CfgSFX sound definition contains more than 1 sound, there is no guarantee that the sound played will be the same on every PC in Multiplayer.","problems":null,"aliases":[],"see_also":["createSoundSourceLocal","playSound","playSound3D","sideRadio","say","say2D","say3D","playMusic","playSoundUI"],"notes":[],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Sounds","Introduced with Operation Flashpoint: Elite version 1.00","Operation Flashpoint: Elite: New Scripting Commands","Operation Flashpoint: Elite: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}