playSound3D: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "(\|p[0-9]+ *= *[^(]+\(Optional(, default[^)]*)\) )O([a-z])" to "$1o$3") |
Lou Montana (talk | contribs) m (Text replacement - "(\|p[0-9]+ *= *[^(]+\(Optional(, default[^)]*)\) )S([a-z])" to "$1s$3") |
||
Line 24: | Line 24: | ||
{{Feature|informative|If a following parameter has to be used, simply use <sqf inline>getPosASL _soundSource</sqf> for ''soundPosition'' instead of <sqf inline>_soundSource</sqf> for ''soundSource''.}} | {{Feature|informative|If a following parameter has to be used, simply use <sqf inline>getPosASL _soundSource</sqf> for ''soundPosition'' instead of <sqf inline>_soundSource</sqf> for ''soundSource''.}} | ||
|p5= volume: [[Number]] - (Optional, default 1) | |p5= volume: [[Number]] - (Optional, default 1) sound volume. A value greater than 5 gets capped | ||
|p6= soundPitch: [[Number]] - (Optional, default 1) | |p6= soundPitch: [[Number]] - (Optional, default 1) |
Revision as of 12:32, 8 November 2023
Description
- Description:
- Plays positional sound with given filename on every computer on network. Since Arma 2.10 the leading slash in file path will be ignored.
- Groups:
- Sounds
Syntax
- Syntax:
- playSound3D [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance, offset, local]
- 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 soundPosition below is specified this parameter is ignored
- isInside: Boolean - (Optional, default false) - true to simulate a sound played inside a building or similar
- soundPosition: Array format PositionASL - (Optional, default [0,0,0]) position for sound emitter, overrides soundSource
- volume: Number - (Optional, default 1) sound volume. A value greater than 5 gets capped
- soundPitch: Number - (Optional, default 1)
- 1.0 → normal
- 0.5 → Darth Vader
- 2.0 → Chipmunks
- distance: Number - (Optional, default 0) how far the sound is audible, in meters. 0 means no maximum distance
- since 2.00
- offset: Number - (Optional, default 0) offset in seconds. Same as with playMusic
- since 2.06
- local: Boolean - (Optional, default false) if true the sound will not be broadcast over network
- Return Value:
- Number - id of the sound (0..65535) (was Nothing before 2.12)
Examples
- Example 1:
- Example 2:
- Example 3:
- Example 4:
- Sound file extension must be specified even if a config entry has none:
Additional Information
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 Sep 26, 2014 - 09:18 (UTC)
- 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 Nov 08, 2014 - 21:48 (UTC)
-
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 this command develops the same bug with first person view as createSoundSource and say3D. If soundSource 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 Oct 07, 2020 - 12:24 (UTC)
- The sound will be distorted according to the Doppler effect when passing by the sound source quickly.