Addon Sounds
The playing of sounds in Source 2 and Half-Life:Alyx addons are triggered by starting and stopping a sound event.
Sound events are started/altered/stopped by game code, map entities, animations or other soundevents by name.
Sound events are of a "type" and contain a collection of property values that correspond to that "type".
Contents
Adding sounds to your Addon
To add new sound events or change the contents of pre-existing soundevents from the base game you will need to:
- Add your new .wav sound files to your addon "sounds" directory.
- Add your own addon soundevent file.
- Declare your soundevent(s) within it to point to your new sounds (the compiled .vsnd version).
- Add a "sound resources" manifest that points to your soundevents file.
- Compile all of these files.
To override existing soundevents, that is all that is required.
To add new soundevents to a map, a snd_event_point entity is needed in the map. The entity can be started and stopped with entity triggers.
Add new sounds
Place sound files in the "sounds" directory inside the addon:
Sound Events files
Add a uniquely named soundevents file under the "soundevents" directory by prefixing it with the name of the addon:
Define soundevents
As an example, to override some soundevents for zombies:
<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
"Addon.AudioNewSoundDemo" =
{
type = "hlvr_default_3d"
volume = 1.0
volume_falloff_min = 70.0
volume_falloff_max = 2700.0
volume_fade_out = 1
volume_fade_in = 0
spread_min = 30
spread_max = 150
vsnd_files =
[
"sounds/snd_sound_add_demo_01.vsnd",
]
}
// overwriting existing soundevents
"Step_Zombie.Metal_Solid" =
{
base = "Step_Zombie.Base"
volume_mult_step_layer = 2
vsnd_files_step =
[
"sounds/fs_squeaky_01.vsnd",
"sounds/fs_squeaky_02.vsnd",
"sounds/fs_squeaky_03.vsnd",
"sounds/fs_squeaky_04.vsnd",
"sounds/fs_squeaky_05.vsnd",
"sounds/fs_squeaky_06.vsnd",
"sounds/fs_squeaky_07.vsnd",
"sounds/fs_squeaky_08.vsnd",
"sounds/fs_squeaky_09.vsnd",
"sounds/fs_squeaky_10.vsnd",
// Entries removed to shorten this example, all the files should be referenced here.
"sounds/fs_squeaky_39.vsnd",
"sounds/fs_squeaky_40.vsnd",
"sounds/fs_squeaky_41.vsnd",
"sounds/fs_squeaky_42.vsnd"
]
}
"Step_Zombie.Default" =
{
base = "Step_Zombie.Metal_Solid"
}
"Step_Zombie.Concrete" =
{
base = "Step_Zombie.Metal_Solid"
}
"Step_Zombie.Dirt" =
{
base = "Step_Zombie.Metal_Solid"
}
"Step_Zombie.Gravel" =
{
base = "Step_Zombie.Metal_Solid"
}
"Step_Zombie.Metal_Walkway" =
{
base = "Step_Zombie.Metal_Solid"
}
"Step_Zombie.Wood" =
{
base = "Step_Zombie.Metal_Solid"
}
}
There are several different sound types you can use when creating new sounds:
- hlvr_default_3d
- hlvr_2d_w_falloff
- hlvr_2d_w_occlusion
- hlvr_music_3d
- hlvr_music_3d_takeover
- hlvr_music_2d
- hlvr_music_fixed_rotation
- hlvr_music_start_multi_quad
Manifest files
Add a specifically named manifest file to the "resourcemanifests" directory to match the addon:
Name format:
<addon_name>_addon_resources.vrman
Add a reference to one or more soundevent files with the manifest:
<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} --> { resourceManifest = [ [ "soundevents/audio_new_sound_soundevents.vsndevts", ], ] }
Compile
Use either the Asset Browser or "resourcecompiler", compile all of the above assets. Using resourcecompiler in the Steam directory often requires specifying full paths:
c:\Program Files (x86)\Steam\steamapps\common\Half-Life Alyx\content\hlvr_addons\audio_new_sound\resourcemanifests>"c:\Program Files (x86)\Steam\steamapps\common\Half-Life Alyx\game\bin\win64\resourcecompiler.exe" -i -f "c:\Program Files (x86)\Steam\steamapps\common\Half-Life Alyx\content\hlvr_addons\audio_new_sound\resourcemanifests\audio_new_sound_addon_resources.vrman"
Loading addon soundevents
Addon soundevents are not loaded until a map is loaded in game, or the addon soundevent file is reloaded in the Asset Browser.
This means that if you launch the Workshop Tools and only open Hammer, you will find that your addon soundevents are not yet available in the soundevent picker.
In such cases, to load addon soundevents, do either of the following:
- Launch the Workshop Tools and load any map by using “addon_tools_map <mapname>.”
- Recompile and reload your <addon_name>_soundevents.vsndevts file in the Asset Browser.
- These steps are only necessary if you have not yet loaded a map after launching the Workshop Tools.
Another useful way to check the existence of your addon soundevents is by entering the “snd_list_soundevents” console command into the vconsole.
See also
SteamVR/Environments/Adding_Sound/Soundevents -- additional reference on soundevents.
Soundevents -- list of soundevents in Half-Life: Alyx.