You are viewing a potentially older version of this package. View all versions.
Wire-WiresAcoustics-0.2.4 icon

WiresAcoustics

Ray traced sound for Valheim.

By Wire
Date uploaded 2 days ago
Version 0.2.4
Download link Wire-WiresAcoustics-0.2.4.zip
Downloads 70
Dependency string Wire-WiresAcoustics-0.2.4

README

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 the camera 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.

Features

Reverb from the real space

The reverb is worked out from what the rays hit, so a stone hall rings, a log cabin sounds warm, a cave sounds like a cave, and a furnished room sounds lived in while an empty one echoes. Outdoors is measured the same way: open ground is dry, and a forest has its own soft tail from the trunks around you. The game's fixed static reverb is replaced everywhere.

Muffling through walls

Walls, floors, hills and rocks between you and a sound make it quieter and duller, more so through several layers. Furniture and trees muffle a little. The transmission now depends on the material too: thin timber muffles less than thick stone and metal, without needing any more raycasts.

Sound finds its way round

A sound behind a wall also reaches you through the openings: a window, a door, a hole in the roof, round a corner, or bouncing off a surface. You hear it from where it comes through, so a deer outside is heard at the window much more clearly than through the wall. Corner candidates now use the blocking object's real bounding box when available. Reflections are prioritized by both path length and how much the surface absorbs, not distance alone.

Echo

Out in the open, a cliff or a wall facing you sends sounds back from its side, a moment later. Bare rock echoes clearly; a snowy slope barely does. It's barely noticeable, as most situations in Valheim won't have you facing huge walls. I haven't tested it there, but I'd guess it's pretty noticeable next to a fortress in the Ashlands. Just speculating, though.

Material matters

Snow swallows sound, grass and forest floors soften it, stone and paving reflect it, and water reflects almost everything. Just like IRL. Cool, right?

Sound takes time

Sound travels at the speed of sound. A tree falling far away is heard after you see it.

Doppler

Moving sounds rise in pitch as they come toward you and drop as they go away.

Distance

Sounds fade with distance the way real sound does, instead of cutting out after a few metres. Quiet sounds fade sooner than loud ones, the air takes the highs off far sounds, and the wind carries sound downwind.

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, 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 have a place and a shape

Creature sounds follow the creature, a death wail follows the falling body, and a creature's calls are duller when it faces away. Big sources (a hearth, a cart, a troll) sound as wide as they look and are only hidden when all of it is. Your own sounds (steps, equipping, drawing a bow) come from your character, even the ones the game plays "in the camera". The point being: sounds don't all come from a single point, and they move with their source, unlike vanilla.

Weather and the sea

Rain and wind indoors come muffled through the walls and clearer from the window. The sea is heard from the actual shore. Underwater, everything is muffled.

Portals

Going through a portal, its hum doesn't stop and restart: it carries through with you and keeps playing from the exit portal. This is more of an extra feature and not really a sound physics thing, but I added it anyway since it's audio-related.

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 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 per-sound DSP runs on the audio thread. The game's audio update handles a small amount of main-thread bookkeeping. Sounds have varying LODs: the most audible get the full HRTF, the rest a lighter directional filter, and the count adjusts to actual audio-thread load. Sounds already faded below -80 dB take a cheap silent-audio path while their echoes are inactive. Opening/corner paths and second-bounce rays are scheduled primarily when a sound is blocked; unchanged rooms and a stationary shoreline are sampled less often, with periodic safety refreshes and build/door invalidation. Exact savings depend on the scene and need A/B profiling.

Settings

  • General: Enabled, Room reverb, Muffling, HRTF (headphones), Realistic distance.
  • Tuning: Reverb strength, Muffling strength, HRTF strength.
  • Debug: Debug log. This also reports detailed full/light/plain DSP costs, silent-buffer bypasses, acoustic path winners, first versus second reflection contributions, and saved room/ocean raycasts.
  • Turning the mod off now restores the original in-world reverb zones and the original positioning of player/ambient sounds without requiring a reload (provided those objects are still loaded).
  • Note that the settings will be expanded upon eventually.

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

CHANGELOG

0.2.6

  • Sorry, I put the wrong thing in the last changelog. Claude screwed me over: the crackles on wood/stone footsteps are a vanilla bug I'm trying to fix, but he put it in there like it's my damn fault. I shouldn't trust AI with changelogs. Sorry, fellas.
  • No changes to the mod itself.

0.2.5

  • Fixed: birds, seagulls and other outside sounds came through wooden walls too clearly. A wooden wall muffles as much as it did before 0.2.3 again; stone, marble and iron still muffle more than wood.
  • Fixed: random biome sounds (birds, insects) and lava noises use the same game object, so lava could be treated as background ambience. They're now told apart where the game plays them: lava stays a real sound in the world, muffled by walls.
  • Fixed: looping sounds the game itself doesn't keep updating were never rechecked for walls after they started. They're now rechecked like other sounds.
  • Fixed: short random ambient sounds (an insect, a splash) could be cut off by the game's fade timer before their sound ended; they now play to their natural end.
  • Fixed: a sound starting while the same source still played could restart or cut the old one, and a distance-delayed sound was started and then restarted. Delayed sounds now start once, and stale delayed stops are dropped.
  • Fixed: possible crackle when a sound switched between full and light HRTF, and a rare case where an echo's memory was reused while still being played.
  • Fixed: a sound made right next to you (opening a gate or door, chopping, mining) was attached to your character and turned with it, so it stayed on the same side as you turned. It now stays where it was made; only your own item sounds (equipping, eating, picking up, dropping) move with you.
  • Fixed: random ambience indoors (a bird, an insect) kept the left/right it started with as you turned; it now stays in place.
  • Debug log: more detail on wildlife sounds, footstep clips and audio-thread cost.

0.2.4

  • Improved: entering and leaving caves, crypts and other enclosed spaces updates room reverb much faster, without lingering wet acoustics outside.
  • Improved: exterior ambience switches promptly at room boundaries instead of waiting through Valheim's long sequential ambient-loop fades. Normal weather and biome fades keep their original timing.
  • Fixed: distant sounds whose fade has already reached silence now stop immediately rather than repeatedly scheduling delayed stops; pending stop requests for the same source no longer accumulate.
  • Known issues: occasional clicks on constructed wood/stone footsteps and abrupt endings of some swamp random ambient effects are still under investigation. The experimental footstep attack fade and ambient-clip pitch-timing workaround were removed because they did not resolve the reported problems.

0.2.3

  • Optimized: HRTF priority follows estimated audibility rather than distance alone; callbacks for sounds already below -80 dB bypass expensive processing if no audible delayed echo remains. New debug counters break down full/light/plain DSP and silent buffers.
  • Optimized: alternative paths are scheduled only for previously blocked sounds; room second-reflection jobs run on demand. The debug log now counts actual opening, corner, first- and second-reflection winners to judge whether added complexity pays off.
  • Optimized: still rooms and coastlines reuse recent measurements with periodic refreshes; doors, pieces and new dungeon rooms invalidate the geometry measurements.
  • Corrected: extended sounds now base future blocked-path decisions on their least-obstructed sampled point, not always the central ray.
  • Added: timber, stone, marble and metal transmit different amounts of sound using the already known collider material; reflection candidates use absorption and angular plausibility in addition to path length. Corner candidates prefer physical blocker edges over fixed arbitrary offsets.
  • Fixed: switching the mod off restores vanilla reverb zones instead of losing destroyed components, and reverts modified player and random-ambience AudioSource positioning and stereo panning. Conversion backups live on per-source filters so short-lived sounds don't accumulate stale tracking entries.
  • Compatibility: dungeon audio setup uses the per-room placement method rather than the two DungeonGenerator methods whose postfixes Valheim AVX displaced.
  • All existing acoustic features remain; the diagnostics help identify which processing and reflection paths are actually useful. Performance improvements vary by scene.
  • Note: using Windows Sonic or Dolby Atmos spatial processing alongside the mod's own HRTF can reduce its positional clarity. For best results, disable Windows spatial processing while playing Valheim (manually; no system settings are changed by the mod).

0.2.2

  • Fixed: birds and other random ambience could play inside your house, loud and unmuffled (the game places them at a random spot around you, often in your own room). Indoors they're heard through the walls and from the windows, like rain and wind.
  • Fixed: rocky valleys and ravines barely echoed: their sides counted as being indoors. Echoes now fade only under a roof.

0.2.1

  • Fixed: the mod reported its version as 0.1.2.
  • README rewritten.

0.2.0

  • Added: sound takes time to travel (343 m/s). A sound far away starts and stops as late as its distance makes it.
  • Added: Doppler. Moving sounds shift in pitch as they come and go; our own, so the camera bumping about doesn't make sounds warble.
  • Added: portals carry their hum. Going through, it isn't stopped and started again: it glides to where the exit portal will be, rides with you while you load and carries on as the exit portal's hum.
  • Added: forests have their own soft reverb tail from the trunks round you.
  • Added: the ground counts by what it is where each ray lands (snow, grass, forest floor, mud, sand, rock, paving, tilled soil), and the sea's surface reflects sound instead of rays passing through it to the sea bed.
  • Changed: no reverb from the game is used anywhere now. Outdoors is measured like any room: open ground is dry, where the game added the same long reverb everywhere (open mountains sounded wetter than a forest).
  • Changed: echo per sound, from each sound's own way there and back, instead of one delay for all; loops don't echo, and how hard the surface is decides how strong it is.
  • Changed: quiet sounds fade out sooner than loud ones, by the game's own range for each.
  • Changed: all your own movement and action sounds come from your character and move with it; a death wail follows the falling body; a creature's facing only shapes its calls.
  • Changed: creatures' and players' shapes are their bodies (a player counted as 4 m wide before).
  • Changed: levels of detail for the processing: every sound is processed, the nearest get the full HRTF, the rest a lighter direction, crossfaded when they switch.
  • Added: HRTF strength setting.
  • Fixed: stutter spikes of a few ms, several times a second. Switching a sound's filter on and off made Unity wait for its audio mixer; filters now stay on and simply pass sounds through when there's nothing to do.
  • Fixed: birds, gusts and other random ambience were far too quiet with Realistic distance (up to 20 dB); they keep the game's own fade.
  • Fixed: a tick at the start of some sounds (old audio left in the delay line).
  • Fixed: errors from creatures without a head point (fish, birds) stopped some sounds being checked.

0.1.3

  • Fixed: stutter, distorted sound and hitches where a lot plays at once (a swamp in the rain), worst on slower machines. Only the nearest playing sounds are processed now, up to a count that follows how busy the audio thread really is (measured, lowered at once when it's busy); the rest are left to the game's own panning. Sounds that don't need processing no longer cost anything, and the per-sound work is faster.
  • Fixed: forests and swamps sounded like a cave. Trees counted as walls: a dense swamp measured as an enclosed room (long reverb, muffled rain), every trunk muffled sounds and echoed them. Trees now scatter sound instead: they barely enclose you, muffle little and never echo.

0.1.2

  • Added: sound reaching you by bouncing. Room rays bounce a second time off what they hit (angle in = angle out), and sounds behind walls also try the shortest bounce paths: down a corridor and round its far corner, round two corners.
  • Added: echo. Out in the open, a big hard surface facing you 15 to 50 m away (a cliff, a hillside, a wall) sends sounds back from its direction, delayed by its real distance.
  • Added: rain and wind indoors come from the opening's real direction with the HRTF on (behind and above as well as left and right), keeping their stereo.
  • Added: the air dulls distant sounds' highs (a fight 60 m away is duller, not just quieter).
  • Changed: no more pitch drop for distant sounds in the Mistlands mist (fog doesn't change pitch); they keep their reverb there too.
  • Added: Wire's Stackify support. Its chest sounds after a quick stack or restock come from each chest, as world sounds.
  • Changed: sounds that used to cut off at their max distance now reach twice as far and fade out there, instead of fading inside their range (a hit 30 m away is heard again).
  • Optimized: the list of sounds tracked for direction and distance changes in place instead of being rebuilt; locations and dungeons get their sound filters and lose their reverb zones as they're placed, instead of scene-wide searches every few seconds.
  • Changed: the HRTF's outer-ear dip is narrower and only for sounds well above or below you, so equipment and other sounds near your character aren't dulled.

0.1.0

  • First upload: ray traced room reverb, muffling through walls, paths through openings and round corners, ambience and under-water muffling, the sea heard from the sea, HRTF, sounds following their source, your own sounds from your character, distance fade, Proximity Voice Chat support.