playSound3D: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " </dl> <dl class="command_description"> <dt></dt>" to " <dt></dt>")
m (Text replacement - " <dl class="command_description"> <dt><dt>" to " <dl class="command_description"> <dt><dt>")
Line 49: Line 49:


<dl class="command_description">
<dl class="command_description">
<dt><dt>
<dt><dt>
<dd class="notedate">Posted on September 26, 2014 - 09:18 (UTC)</dd>
<dd class="notedate">Posted on September 26, 2014 - 09:18 (UTC)</dd>

Revision as of 15:47, 12 June 2021

Hover & click on the images for description

Description

Description:
Plays positional sound with given filename on every computer on network.
Groups:
Sounds

Syntax

Syntax:
playSound3D [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance, offset]
Parameters:
filename: String - See Arma 3: Sound Files for available file names or Example 3 to use mission files
soundSource: Object - The object emitting the sound. If "sound position" is specified this parameter is ignored
isInside: Boolean - (Optional, default false) - True to simulate a sound played inside a building or similar
soundPosition: PositionASL - (Optional, default [0,0,0]) Position for sound emitter. Will override "soundSource" position.
volume: Number - (Optional, default 1) Sound volume. A value >5 get capped at 5
soundPitch: Number - (Optional, default 1)
  • 1 → Normal
  • 0.5 → Darth Vader
  • 2 → Chipmunks
distance: Number - (Optional, default 0) How far the sound is audible. 0 means no maximum distance
offset: Scalar - (Optional, default 0) Offset in seconds. Same as with playMusic Template:Since
Return Value:
Nothing

Examples

Example 1:
playSound3D ["A3\Sounds_F\sfx\blip1.wav", player]
Example 2:
playSound3D ["A3\Sounds_F\sfx\blip1.wav", player, false, getPosASL player, 1, 1, 0]
Example 3:
playSound3D [getMissionPath "mySound.ogg", player]; // to play a mission directory sound
Example 4:
Sound file extension must be specified even if a config entry has none: playSound3D ["A3\Sounds_F\sfx\alarm_independent", player]; // no sound playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]; // alarm

Additional Information

See also:
say3DplaySoundsay2DsaycreateSoundSourcesetRandomLipgetMissionPath

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted on September 26, 2014 - 09:18 (UTC)
Killzone Kid
Currently, playSound3D is not JIP compatible, so joining players will not hear the sound if is started before and is still playing when player joins.
Posted on November 8, 2014 - 21:48 (UTC)
Killzone Kid
When object is supplied but not a position, the position is taken from object, otherwise the position is taken from supplied position. That doesn't mean that when position is taken from object it is going to follow object when it changes position. The sound is generated at object position and it stays there.

One other important note: If soundSource param is objNull then his command develops the same bug with first person view as createSoundSource and say3D. If soundSource param is player then the bug is inverted. It seems that passing vehicle player as soundSource param is the only way to make it behave correctly when vehicles involved.
Posted on October 7, 2020 - 12:24 (UTC)
R3vo
The sound will be distorted according to the doppler effect when passing by the sound source quickly.