Difference between revisions of "SteamVR/Environments/Adding Sound/Soundevents"

From Valve Developer Community
Jump to: navigation, search
(A guide to adding Soundevents to your Environment)
(Added headings and parameter documentation)
Line 47: Line 47:
 
'''"destinations.simple_2d"'''  <br />  
 
'''"destinations.simple_2d"'''  <br />  
 
For sounds without positional information, whose stereo information will be preserved no matter the orientation of the player. Example usages - non-diagetic music, ambience beds, atmospheric rumbles.
 
For sounds without positional information, whose stereo information will be preserved no matter the orientation of the player. Example usages - non-diagetic music, ambience beds, atmospheric rumbles.
 +
 +
== Using the Soundevents ==
 +
{{TODO}}
 +
===== point_soundevent =====
 +
 +
===== Animation Events =====
 +
 +
===== Emitting from VScript =====
 +
 +
 +
== Troubleshooting ==
 +
{{TODO}}
 +
== Extended Documentation ==
 +
 +
=== Properties ===
 +
 +
===== Required properties =====
 +
{| class="standard-table" style="width: 100%;"
 +
! Parameter
 +
! Type
 +
! Default
 +
! Description
 +
|-
 +
| type
 +
| string
 +
|
 +
| Replacing 'soundtype' inside the quotations with one of the two types explained below will determine the playback behavior of the sound.
 +
|-
 +
| vsnd_files
 +
| string/array
 +
|
 +
| The value here is the sound file you wish to play. Note for soundname_02, the square braces allow for multiple sound files to be added for one soundevent. When the soundevent is called to play, it will respond with one of the files chosen at random. Once a sound file is used it will not be chosen again until the list is exhausted.
 +
|}
 +
 +
===== Optional properties =====
 +
{| class="standard-table" style="width: 100%;"
 +
! Parameter
 +
! Type
 +
! Default
 +
! Description
 +
|-
 +
| volume
 +
| float
 +
| 1.0
 +
| An optional parameter requiring a float value, set between 0.0 and 1.0, that acts as a multiplier on the sounds volume.
 +
|-
 +
| pitch
 +
| float
 +
| 1.0
 +
| An optional parameter requiring a float value, that determines the pitch at which the sound plays back. Ideally set it between 0.9 and 1.1 to avoid digital distortion from extreme pitch shifting, but feel free to experiment if you want some crazy sounds.
 +
|-
 +
| delay
 +
| float
 +
| 0.0
 +
| An optional parameter requiring a float value, representing a millisecond delay between the soundevent being called to start and the sound file playing.
 +
|-
 +
| use_hrtf
 +
| float
 +
| 1.0
 +
| An optional parameter, available only to the "destinations.simple_vr" soundtype. By default this is a 1.0 for all soundevents, directing them to use the SteamAudio HRTF panning feature. To use regular/legacy panning, add this parameter and set it to 0.0.
 +
|-
 +
| volume_falloff_min
 +
| float
 +
| 200.0
 +
| At what distance the volume should start fading. Below this distance the sound will be played at the full volume.
 +
|-
 +
| volume_falloff_max
 +
| float
 +
| 2000.0
 +
| The maximum distance the sound can be heard.
 +
|-
 +
| volume_falloff_limit
 +
| float
 +
| 0.0
 +
| {{TODO}}
 +
|}
 +
 +
===== Advanced properties =====
 +
{| class="standard-table" style="width: 100%;"
 +
! Parameter
 +
! Type
 +
! Default
 +
! Description
 +
|-
 +
| fade_in
 +
| float
 +
| 0.0
 +
| Adds a fade in effect for the specified number of seconds.
 +
|-
 +
| fade_out
 +
| float
 +
| 0.0
 +
| Adds a fade out effect for the specified number of seconds.
 +
|-
 +
| occlusion_amount
 +
| float
 +
| 0.0
 +
|
 +
|-
 +
| occlusion_loss
 +
| float
 +
| -12.0
 +
|
 +
|-
 +
| occlusion_source_radius
 +
| float
 +
| 20.0
 +
|
 +
|-
 +
| size
 +
| float
 +
| 0.0
 +
|
 +
|-
 +
| spread_min
 +
| float
 +
| 0
 +
|
 +
|-
 +
| spread_max
 +
| float
 +
| 0
 +
|
 +
|-
 +
| spread_min_value
 +
| float
 +
| 0.0
 +
|
 +
|-
 +
| spread_max_value
 +
| float
 +
| 1.0
 +
|
 +
|-
 +
| use_passed_position
 +
| bool
 +
| false
 +
|
 +
|-
 +
| attachment
 +
| string_token
 +
| "<unknown>"
 +
|
 +
|-
 +
| memory_type
 +
| float
 +
| 0
 +
|
 +
|-
 +
| mixgroup
 +
| string
 +
| "ambient"
 +
|
 +
|-
 +
| event_type
 +
| float
 +
| 0.0
 +
|
 +
|-
 +
| draw_debug_on
 +
| float
 +
| 0.0
 +
|
 +
|-
 +
|-
 +
| minimum_volume
 +
| float
 +
| 0.5
 +
|
 +
|-
 +
| volume_filter_amount
 +
| float
 +
| 999.0
 +
|
 +
|-
 +
| block_stop
 +
| float
 +
| 0.0
 +
|
 +
|-
 +
| volume_input_01
 +
| float
 +
| 1.0
 +
|
 +
|-
 +
| volume_input_02
 +
| float
 +
| 1.0
 +
|
 +
|-
 +
| volume_input_03
 +
| float
 +
| 1.0
 +
|
 +
|-
 +
| start
 +
| float
 +
| 1.0
 +
| (2D only)
 +
|-
 +
| volume_rand_min
 +
| float
 +
| 0.0
 +
| (2D only)
 +
|-
 +
| volume_rand_max
 +
| float
 +
| 0.0
 +
| (2D only)
 +
|-
 +
| pitch_rand_min
 +
| float
 +
| 0.0
 +
| (2D only)
 +
|-
 +
| pitch_rand_max
 +
| float
 +
| 0.0
 +
| (2D only)
 +
|}
 +
 +
 +
=== Sound Types ===
 +
{{TODO |Sound types other than the main two may have more properties available. The properties are listed in .vsndstck_c files in the VPK archives.}}
 +
 +
{| class="standard-table" style="width: 100%;"
 +
! Type
 +
! Description
 +
|-
 +
| destinations.simple_vr
 +
| For sounds with positional information and that require a falloff of volume against distance. Example usages - a bird call, dog bark, door closing.
 +
|-
 +
| destinations.simple_2d
 +
| For sounds without positional information, whose stereo information will be preserved no matter the orientation of the player. Example usages - non-diagetic music, ambience beds, atmospheric rumbles.
 +
|-
 +
| destinations.advanced_vr
 +
| This type has more SteamAudio settings available.
 +
|-
 +
| destinations.randompos
 +
|
 +
|-
 +
| destinations.simple_vr_scalable
 +
|
 +
|-
 +
| destinations.voip
 +
|
 +
|-
 +
| destinations.voip_simple
 +
|
 +
|-
 +
| destinations.rand_pos_line
 +
|
 +
|-
 +
| destinations.3line_rand_pos_3d
 +
|
 +
|-
 +
| destinations.simple_vr_soundscapes
 +
|
 +
|-
 +
| destinations.ambient_fixed_rotation
 +
|
 +
|-
 +
| destinations.ambient_closest_pos_on_box
 +
|
 +
|-
 +
| destinations.2d_w_falloff
 +
|
 +
|-
 +
| destinations.envelope_2d
 +
|
 +
|-
 +
| destinations.focuschange_2d
 +
|
 +
|-
 +
| destinations.src1_2d
 +
|
 +
|-
 +
| destinations.drone_acc
 +
|
 +
|-
 +
| destinations.drone_dec
 +
|
 +
|-
 +
| destinations.cache_finder_rate
 +
|
 +
|-
 +
| destinations.cache_finder_progress
 +
|
 +
|-
 +
| destinations.cache_finder_ping
 +
|
 +
|-
 +
| destinations.cache_finder_progress
 +
|
 +
|}
  
 
[[Category:SteamVR]]
 
[[Category:SteamVR]]
 +
[[Category:SteamVR Home]]

Revision as of 12:05, 22 July 2019

A guide to adding Soundevents to your Environment


First, sound files go in the content/youraddon/sounds/ folder.

With a text editor, open the provided file, "soundevents_addon.vsndevts" from the content soundevents folder. Do not rename this file to match your addon, just edit the contents.

You add soundevent definitions inside the existing curly braces already present in the file-


Soundevent examples 2.jpg


name
Replace 'soundname_01/02' with the name for your soundevent, this is what you will reference elsewhere in the tools to call your sound.

type
Replacing 'soundtype' inside the quotations with one of the two types explained below will determine the playback behavior of the sound.

volume
An optional parameter requiring a float value, ideally set between 0.0 and 1.0, that acts as a multiplier on the sounds volume. If undeclared, it will default to 1.0.

pitch
An optional parameter requiring a float value, that determines the pitch at which the sound plays back. Ideally set it between 0.9 and 1.1 to avoid digital distortion from extreme pitch shifting, but feel free to experiment if you want some crazy sounds. If undeclared, it will default to 1.0.

delay
An optional parameter requiring a float value, representing a millisecond delay between the soundevent being called to start and the sound file playing. If undeclared, it will default to 0.0.

use_hrtf
An optional parameter, available only to the "destinations.simple_vr" soundtype explained below. By default this is a 1.0 for all soundevents, directing them to use the SteamAudio HRTF panning feature. To use regular/legacy panning, add this parameter and set it to 0.0.

vsnd_files
The value here is the sound file you wish to play. Note for soundname_02, the square braces allow for multiple sound files to be added for one soundevent. When the soundevent is called to play, it will respond with one of the files chosen at random. Once a sound file is used it will not be chosen again until the list is exhausted.


Note: The .vsnd extension is for the compiled version of audio files in Source 2. When the sound first plays, it will get compiled into a .vsnd automatically. You don't need to change the audio file extension by hand, just use .vsnd in the script.


Types

There are 2 'type' settings you can use for sound behavior control in environments.

"destinations.simple_vr"
For sounds with positional information and that require a falloff of volume against distance. Example usages - a bird call, dog bark, door closing.

"destinations.simple_2d"
For sounds without positional information, whose stereo information will be preserved no matter the orientation of the player. Example usages - non-diagetic music, ambience beds, atmospheric rumbles.

Using the Soundevents

To do

point_soundevent
Animation Events
Emitting from VScript

Troubleshooting

To do

Extended Documentation

Properties

Required properties
Parameter Type Default Description
type string Replacing 'soundtype' inside the quotations with one of the two types explained below will determine the playback behavior of the sound.
vsnd_files string/array The value here is the sound file you wish to play. Note for soundname_02, the square braces allow for multiple sound files to be added for one soundevent. When the soundevent is called to play, it will respond with one of the files chosen at random. Once a sound file is used it will not be chosen again until the list is exhausted.
Optional properties
Parameter Type Default Description
volume float 1.0 An optional parameter requiring a float value, set between 0.0 and 1.0, that acts as a multiplier on the sounds volume.
pitch float 1.0 An optional parameter requiring a float value, that determines the pitch at which the sound plays back. Ideally set it between 0.9 and 1.1 to avoid digital distortion from extreme pitch shifting, but feel free to experiment if you want some crazy sounds.
delay float 0.0 An optional parameter requiring a float value, representing a millisecond delay between the soundevent being called to start and the sound file playing.
use_hrtf float 1.0 An optional parameter, available only to the "destinations.simple_vr" soundtype. By default this is a 1.0 for all soundevents, directing them to use the SteamAudio HRTF panning feature. To use regular/legacy panning, add this parameter and set it to 0.0.
volume_falloff_min float 200.0 At what distance the volume should start fading. Below this distance the sound will be played at the full volume.
volume_falloff_max float 2000.0 The maximum distance the sound can be heard.
volume_falloff_limit float 0.0 To do
Advanced properties
Parameter Type Default Description
fade_in float 0.0 Adds a fade in effect for the specified number of seconds.
fade_out float 0.0 Adds a fade out effect for the specified number of seconds.
occlusion_amount float 0.0
occlusion_loss float -12.0
occlusion_source_radius float 20.0
size float 0.0
spread_min float 0
spread_max float 0
spread_min_value float 0.0
spread_max_value float 1.0
use_passed_position bool false
attachment string_token "<unknown>"
memory_type float 0
mixgroup string "ambient"
event_type float 0.0
draw_debug_on float 0.0
minimum_volume float 0.5
volume_filter_amount float 999.0
block_stop float 0.0
volume_input_01 float 1.0
volume_input_02 float 1.0
volume_input_03 float 1.0
start float 1.0 (2D only)
volume_rand_min float 0.0 (2D only)
volume_rand_max float 0.0 (2D only)
pitch_rand_min float 0.0 (2D only)
pitch_rand_max float 0.0 (2D only)


Sound Types

To do: Sound types other than the main two may have more properties available. The properties are listed in .vsndstck_c files in the VPK archives.

Type Description
destinations.simple_vr For sounds with positional information and that require a falloff of volume against distance. Example usages - a bird call, dog bark, door closing.
destinations.simple_2d For sounds without positional information, whose stereo information will be preserved no matter the orientation of the player. Example usages - non-diagetic music, ambience beds, atmospheric rumbles.
destinations.advanced_vr This type has more SteamAudio settings available.
destinations.randompos
destinations.simple_vr_scalable
destinations.voip
destinations.voip_simple
destinations.rand_pos_line
destinations.3line_rand_pos_3d
destinations.simple_vr_soundscapes
destinations.ambient_fixed_rotation
destinations.ambient_closest_pos_on_box
destinations.2d_w_falloff
destinations.envelope_2d
destinations.focuschange_2d
destinations.src1_2d
destinations.drone_acc
destinations.drone_dec
destinations.cache_finder_rate
destinations.cache_finder_progress
destinations.cache_finder_ping
destinations.cache_finder_progress