Valheim
You are viewing a potentially older version of this package. View Latest Version
Install with App

Details

Date Uploaded
Downloads
3.3K
Size
227KB
ADDatHost Valheim hosting
30% off

Wire's Acoustics

Sound physics.

Inspired by the video Physically-based audio: why most games sound fake [Voxel Devlog #31], on ray traced audio.

Showcase video

Coming later, sorry lol. If you want, you can record your own, I guess.

How it works

The mod traces rays through the world, the way light is traced in a renderer, but for sound. A few times a second, rays go out from your character's head in every direction and find out what's around you: how closed in you are, how big the space is, what it's made of, and where the openings are. Every sound you hear is then shaped by that space and by everything between it and you.

Which way a sound is comes from the camera, as you see it. How far it is, what's in the way and which room you're in come from your character's head, so zooming out doesn't make your own steps quieter and the camera slipping behind a wall doesn't muffle the world.

Wherever I could, the numbers come from real measurements and standards instead of being made up. The sources are at the bottom.

Features

Reverb from the real space

The reverb is worked out from what the rays hit: how big the space is, how closed in, and what it's made of. A stone hall rings, a log cabin sounds warmer, a cave sounds like a cave, and a furnished room is drier than an empty one. Windows, doors and gaps let sound out instead of counting the sky behind them as part of the room. Open ground is dry.

Walls block sound like real walls

A door lets through more sound than a plank wall, and stone keeps out more than wood. The next room is muffled, not silent. How much of a sound you can hear also changes as you move past the edge of a wall: a little bit hidden shouldn't sound the same as being completely behind it. Sounds can still reach you over a wall or round its corners.

Sound goes round things

A sound behind a wall also reaches you through openings: a window, a door, a hole in the roof, or round a corner. More than one opening can carry the same sound. When you move, the sound changes direction gradually instead of jumping between windows. The sound through the wall arrives first, but a much louder arrival through an opening can take over, as your hearing does in real life. Hills, rocks, trees and furniture muffle sound by their size: a trunk barely matters, a boulder takes the highs off, and a hill blocks more the higher it rises.

Material matters

Every surface absorbs the lows and highs by published data for what it is. Snow swallows sound, moss and forest floors soften it, grass a bit less, paving and stone reflect it, water reflects almost everything. Just like IRL. Cool, right?

Distance and air

Sounds fade with distance the way real sound does, instead of cutting out after a few metres: a quiet sound still reaches far, just quietly. Sound takes time to travel, so far sounds arrive late, and sounds coming towards you or going away shift in pitch. A small fire crackles more softly than a large one. The air takes the highs off distant sounds, with warm, cold and freezing weather matched to the real Norwegian weather Valheim is modelled on.

Wind

Downwind, a distant sound carries further; upwind, it can become quieter. The effect depends on the wind, the distance and the ground around you, and falls away when you're sheltered behind a wall, a rock or a hill. The wind itself is heard from where it comes round and over things: behind a wall it drops to a low rumble, and it gusts and lulls rather than blowing as one even loop. Wind in the Plains reeds follows the wind too; birds and rain don't get mistaken for wind.

HRTF (headphones)

HRTF stands for head-related transfer function: how your head and ears change a sound depending on where it comes from. A sound on your left reaches your right ear a tiny bit later and duller, sounds behind you lose some brightness, and your outer ear colours sounds from above and below. The mod models this itself, for every sound, so you can tell front from back and up from down, not just left from right. Best with headphones. I'd recommend turning HRTF off on speakers, as your real head already produces ACTUAL HRTF. For the mod's own HRTF to sound its best, turn off Windows Sonic or Dolby Atmos spatial processing on your output device while playing Valheim; running both spatializers together can reduce directional clarity.

Sounds come from where they're made

The game plays a lot of sounds at a character's feet or at the base of a piece. Here, a weapon swing comes from the moving weapon itself, a bow's draw from the bow, holstering from your back, eating from your head. Creatures roar from their head, claw with their arm and stomp with their feet. A chest opens at its lid, a door sounds from its hinge, a fire or furnace from its flame, crafting from the part of the station you use, a ward from its head, a trader from their head. Whatever you're using, building, removing or repairing is heard clearly while it's within your reach, even in a tight wall of chests. Raising terrain makes a sound above the new ground, not inside it. Rotated pieces stay in the right place. Bigger things can sound wider, while a specific hit or action still comes from the spot where it happened.

Weather and the sea

The rain, wind and birds are outside, not in the room with you. Windows, doors and gaps let more of them in; the walls round you let through a quieter, duller sound. Rain stays audible under a roof, and the roof gives it a little more presence without treating a floor between storeys as the roof. The rain keeps Valheim's own ambient recording. The sea is heard from the actual shoreline, including more than one direction where the coast surrounds you. A house blocks the part of the shore behind it, but a post barely matters. Under water, the world above is about 30 dB quieter, as the physics of the water surface says.

Portals

Going through a portal, its hum doesn't stop and restart: it carries through with you and keeps playing from the exit portal. More of an extra than sound physics, but it's audio-related so it's here.

Also

  • No pitch drop in the Mistlands mist (fog doesn't do that to sound, and I don't like it).
  • The main menu's sounds get the HRTF too. Barely noticeable there, tbh, but it's there.

Works with

  • Proximity Voice Chat (Azumatt): voices come from the speaker's head and get the walls, openings and HRTF like any sound.
  • Wire's Stackify: its chest sounds come from each chest.
  • (kinda) Immersive Weather & Acoustics: set its EnableAudioOcclusion = false so only one audio system runs; its visual weather can stay on.

Performance

The ray tracing runs on Unity's worker threads, and the per-sound processing runs on the audio thread: sounds too quiet to hear aren't processed. The mod asks Unity to mix 128 sounds at once instead of the game's 32, so in a busy base far sounds don't drop out and nothing is cut off mid-sound. The game's audio update does a small amount of bookkeeping on the main thread. Paths round walls are only traced for sounds that are blocked, and rooms that don't change are scanned less often, with a refresh when something is built, removed or a door opens.

Settings

  • General: Enabled, Room reverb, Muffling, HRTF (headphones), Realistic distance, Travel time, Doppler, Under water, Air, Wind, Sound placement, Voice chat.
  • Tuning: Reverb strength, Muffling strength, HRTF strength.
  • Debug: Debug log: the measured space, muffled sounds and the mod's costs, every few seconds.
  • Turning the mod off restores the game's own reverb zones, reverb sends and sound placement without a reload (for whatever is still loaded). Only the 128 voices stay until you restart the game: changing that restarts Unity's audio.

Sources

Every value below was checked against the source it's credited to.

Not from a source (judgement values): the wind in the lee of things (12 dB less, down to 800 Hz) and its gusts (up to 4 dB either way), the approximations used to blend partial enclosure and multiple obstruction paths, a wall counting once however many pieces it's built from, indoors 3 dB softer first reflections and 4 dB darker reverb (cozy), random calls kept off buildings within 10 m of you (moved out 4 m at a time), where you count as inside (a third to two thirds closed in), the reverb's loudness and tone, rooms heard at half their built size and as furnished homes (Valheim builds are about twice real size and bare), how much soft obstacles muffle, how much trees enclose a space, props' absorption, random bird and insect calls sitting 1 m above whatever is at their spot, upwind sounds held to 10 dB quieter at most (measured: 20 dB and more), the HRTF's amounts (level, shading, the outer ear's notch), past the game's own range for a sound, 6 dB more each time the distance doubles (instead of a cut-off), fire strength normalized to each fire loop's original authored audio range (10 m reference), where round a wall the mod looks for a way (just past the edge of what blocks it, 1 to 7 m to the sides and up to 5.5 m over), how finite sampled ray paths approximate a partially covered emitter, a player's own unplaced sounds made placed with a near distance of at least 1 m, the wind in your ears (up to 2 dB louder facing it, 3 dB quieter with your back to it), the two rays beside every line 8 cm off (two of three must agree), a line through more than 16 things counting as through a plank wall at least, and a door's sounds 15 cm in from its hinge.

Disclaimer: development is AI assisted. Not fully human or AI. Donations: ko-fi.com/krosshair

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.