playSound3D: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
(28 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{Command|Comments=
____________________________________________________________________________________________
____________________________________________________________________________________________


| arma3 |= Game name
| arma3 |Game name=


|0.50|= Game version
|0.50|Game version=


|arg= global |= Arguments in MP
|arg= global |Multiplayer Arguments=


|eff= global |= Effects in MP
|eff= global |Multiplayer Effects=
 
|gr1= Sounds |GROUP1=
____________________________________________________________________________________________
____________________________________________________________________________________________


| Plays a sound with given filename. At least 2 parameters must be added. |= Description
| Plays positional sound with given filename on every computer on network. At least 2 parameters must be specified.
{{Important | Since A3 v1.91.145537 the maximum volume allowed is '''5'''. Exceeding this will result in sound not being played when executed remotely.}} |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''playSound3D''' [filename, source, isInside, position, volume, frequency, distance] |= Syntax
| [[playSound3D]] [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance, offset] |SYNTAX=
 
|p1= filename: [[String]] - see [[Arma 3: SoundFiles]] for available filenames or [[#Examples|Example 3]] to use mission files. |PARAMETER1=
 
|p2= soundSource: [[Object]] - the object emitting the sound. If "sound position" is specified this parameter is ignored |PARAMETER2=


|p1= [filename, source, isInside, position, volume, frequency, distance]: [[Array]] |= PARAMETER1
|p3= isInside: [[Boolean]] - (Optional, default [[false]]) |PARAMETER3=


|p2= filename: [[String]] |= PARAMETER2
|p4= soundPosition: [[PositionASL]] - (Optional, default [0,0,0]) position for sound emitter, will override "sound source" position. |PARAMETER4=


|p3= source: [[Object]] |= PARAMETER3
|p5= volume: [[Number]] - (Optional, default 1) Maximum value: 5 (limited since A3 v1.91.145537) |PARAMETER5=


|p4= isInside: [[Boolean]] |= PARAMETER4
|p6= soundPitch: [[Number]] - (Optional, default 1) 1: Normal, 0.5: Darth Vader, 2: Chipmunks, etc. |PARAMETER6=


|p5= position: [[Position]] |= PARAMETER5
|p7= distance: [[Number]] - (Optional, default 0) How far is sound audible (0 {{=}} no max distance) |PARAMETER7=


|p6= volume: [[Number]] |= PARAMETER6
|p8= offset: [[Scalar]] - (Optional, default 0) Offset in seconds. Same as with [[playMusic]] {{since|arma3|1.99.146480|true}} |PARAMETER8=


|p7= frequency: [[Number]] |= PARAMETER7
| [[Nothing]] |RETURNVALUE=  


|p8= distance: [[Number]] - How far is sound audible (0 <nowiki>=</nowiki> no max distance). |= PARAMETER8
|x1= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]]]</code> |EXAMPLE1=


| [[Nothing]] |= RETURNVALUE
|x2= <code>[[playSound3D]] ["A3\Sounds_F\sfx\blip1.wav", [[player]], [[false]], [[getPosASL]] [[player]], 1, 1, 0]</code> |EXAMPLE2=


|x3= <code>[[playSound3D]] [<nowiki/>[[getMissionPath]] "mySound.ogg", [[player]]]; {{cc|to play a mission directory sound}}</code> |EXAMPLE3=


|x1= <code>playSound3D ["A3\Sounds_F\sfx\blip1.wav", player]</code>|= EXAMPLE1
|x4= Sound file extension must be specified even if a config entry has none:
|x2= <code>playSound3D ["A3\Sounds_F\sfx\blip1.wav", player, false, getPos player, 1, 1, 0]</code>|= EXAMPLE2
<code>[[playSound3D]] ["A3\Sounds_F\sfx\alarm_independent", [[player]]]; {{cc|no sound}}
[[playSound3D]] ["A3\Sounds_F\sfx\alarm_independent.wss", [[player]]]; {{cc|alarm}}</code> |EXAMPLE4=


____________________________________________________________________________________________
____________________________________________________________________________________________


| |= SEEALSO
| [[say3D]], [[playSound]], [[say2D]], [[say]], [[createSoundSource]], [[setRandomLip]], [[getMissionPath]] |SEEALSO=  


| |= MPBEHAVIOUR
| |MPBEHAVIOUR=  
____________________________________________________________________________________________
____________________________________________________________________________________________
}}
}}
Line 49: Line 58:
<dl class='command_description'>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on September 23, 2013
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''
<dd class="note">This command works well with addon sounds, however getting it to play mission sound files is a bit tricky. Follow [http://killzonekid.com/arma-scripting-tutorials-mission-root/ this guide]


<dd class="notedate">Posted on September 26, 2014 - 09:18 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dd class="note">
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.
</dd>
<dd class="notedate">Posted on November 8, 2014 - 21:48 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dd class="note">
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.<br><br>One other important note: If <i>soundSource</i> param is [[objNull]] then his command develops the same bug with first person view as [[createSoundSource]] and [[say3D]]. If <i>soundSource</i> param is [[player]] then the bug is inverted. It seems that passing [[vehicle]] [[player]] as <i>soundSource</i> param is the only way to make it behave correctly when vehicles involved.
</dd>


<!-- Note Section END -->
<!-- Note Section END -->
Line 58: Line 75:


<h3 style='display:none'>Bottom Section</h3>
<h3 style='display:none'>Bottom Section</h3>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
 
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<dl class="command_description">
<dd class="notedate">Posted on October 7, 2020 - 12:24 (UTC)</dd>
<dt class="note">[[User:R3vo|R3vo]]</dt>
<dd class="note">
The sound will be distorted according to the [https://en.wikipedia.org/wiki/Doppler_effect doppler effect] when passing by the sound source quickly.
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 14:24, 7 October 2020

Hover & click on the images for description

Description

Description:
Plays positional sound with given filename on every computer on network. At least 2 parameters must be specified.
Since A3 v1.91.145537 the maximum volume allowed is 5. Exceeding this will result in sound not being played when executed remotely.
Groups:
Sounds

Syntax

Syntax:
playSound3D [filename, soundSource, isInside, soundPosition, volume, soundPitch, distance, offset]
Parameters:
filename: String - see Arma 3: SoundFiles for available filenames 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)
soundPosition: PositionASL - (Optional, default [0,0,0]) position for sound emitter, will override "sound source" position.
volume: Number - (Optional, default 1) Maximum value: 5 (limited since A3 v1.91.145537)
soundPitch: Number - (Optional, default 1) 1: Normal, 0.5: Darth Vader, 2: Chipmunks, etc.
distance: Number - (Optional, default 0) How far is sound audible (0 = no max 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

Notes

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.

Bottom Section

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.