Addon Sounds

From Valve Developer Community
< Half-Life: Alyx Workshop Tools
Revision as of 20:34, 15 June 2020 by VDCBot (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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".

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:

Addon Sounds-132120964.png


Sound Events files

Add a uniquely named soundevents file under the "soundevents" directory by prefixing it with the name of the addon:

Addon Sounds-132120961.png


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"
	}
}

Manifest files

Add a specifically named manifest file to the "resourcemanifests" directory to match the addon:

Addon Sounds-132120962.png

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"

See also

SteamVR/Environments/Adding_Sound/Soundevents -- additional reference on soundevents.