Sounds in a map
Sound is the youngest part of W4. Today there are two separate things: the hit sounds units make in the game, and the sound tools in the editor. They do not meet yet. The game does not play sound files from a map; that is the next step. This page explains what works now so you know what to expect.
Import and listen
Open Imports (Ctrl 4) and click Import…. WAV, MP3, OGG and FLAC files are copied into the map's assets/ folder, like models and textures, and show up in the list with their kind and size.
Select a sound. The preview has play and stop, a waveform, and the numbers: length, sample rate, channels, and the peak and RMS level in decibels. Peak is the loudest single sample. RMS is closer to how loud it feels. Two sounds from different packs often differ by ten decibels, which is why one is deafening and another is a whisper.
Normalise
Normalise works out a gain that brings the sound to a common level and stores it in the map's sounds.toml. The file itself is not changed. Reset removes the gain. The editor plays the sound with the gain applied, so you hear the corrected level.
# sounds.toml
["assets/hit_sword.wav"]
gain = 0.62The game does not read the gain yet, because it does not play these files yet. It is stored now so that it is ready.
Hit sounds on units
In Objects, a unit or hero definition has a Hit sound drop-down and a Volume in percent from 0 to 200. A unit plays its hit sound when one of its attacks lands. Buildings and decorations have none.
The hit sound is one of six that W4 makes in code: None, Slash, Blunt, Pierce, Claw and Magic. Pick the one that fits the unit: a blade, a club or hammer, a spear or arrow, a tearing claw, a zap. There is a play button next to the drop-down. The volume scales the sound, and the engine also changes it with distance and the effects volume in the settings, and keeps it quiet when you cannot see the unit through the fog.
Renaming
If you rename or move a sound in Imports, its gain in sounds.toml moves with it.
What is coming
Playing your own sound files in the game, sound from Go scripts at a place or for a player, music in a map, and spatial sound with Dolby Atmos. Until then, imported sounds are for checking and normalising only. Note that sounds are not packed into an exported .a4m yet.