Dynamic Audio V2 (BepInEx)
Tired of the same flat audio no matter where you are? Dynamic Audio V2 is a complete audio overhaul mod that brings Ravenfield’s soundscape to life with unprecedented realism and immersion.
This is the new and improved script from the previous plugin. It adds more immersion into your gameplay and enhances the gaming experience.
– Dynamic Environmental Reverb: Hear the difference between fighting in a tight concrete bunker, a dense forest, or an open plain. The mod constantly "probes" your surroundings to apply realistic echo, decay, and reverb based on the space you’re in.
– Realistic Sound Occlusion: Sound is realistically muffled and blocked by terrain and objects. An enemy firing from behind a thick wall will sound muffled, giving you crucial audio cues about their location.
– Immersive Hearing Damage System: Loud sounds have consequences! Sustained gunfire and nearby explosions will build up "noise exposure," causing a temporary ringing in your ears (tinnitus).
1. Download BepInEx: https://github.com/BepInEx/BepInEx/releases/tag/v5.4.23.3
2. Put it inside your Ravenfield folder > Right click the file > Extract here > Boot up Ravenfield and go to instant action > Close Ravenfield
3. Download the plugin: https://github.com/Hazcodestuff/dynamic-audio/releases/tag/v1.0.0
4. Put it in Ravenfield > BepInEx > Plugins folder
5. Bam done!
PLEASE WATCH THE VIDEO CLOSELY
THIS MOD IS NOT PERFECT! EXPECT SOME BUGS!
How "Dynamic Audio V2" Works
This script is a comprehensive audio enhancement tool for Ravenfield that operates as a BepInEx plugin. It injects several real-time audio processing features by attaching components to the scene’s AudioListener and directly manipulating AudioSource s.
1. Core Concept: Environmental Probing
The central feature is the dynamic reverb system, which simulates the acoustic properties of the player’s current environment.
The Probe Method: At a regular interval (probeInterval), the Probe() method is called. It casts a number of rays (rays) in a sphere around the AudioListener’s position. The directions of these rays are pre-calculated using a Fibonacci sphere algorithm in BuildDirections() to ensure even distribution.
Analyzing the Environment: The script uses the results of these raycasts to measure three key metrics:
– Coverage: The percentage of rays that hit something. This determines how "enclosed" the space is.
– Open Sky: The percentage of "upward-facing" rays that do not hit anything. This is used to differentiate between an open field and a large indoor space.
– Average Distance: The average length of the rays that hit a surface. This defines the "size" of the space.
Applying Reverb: These metrics are combined to calculate an enclosure value. The script then uses this value to smoothly interpolate (Mathf.Lerp or Mathf.MoveTowards) between minimum and maximum presets for the standard Unity AudioReverbFilter component. The key parameters adjusted are:
decayTime: How long the echo lasts.
room: The overall volume level of the reverb effect.
reverbLevel: The volume of the late reverberations.
reflectionsDelay: The time it takes for the first echo to be heard, calculated from the lastAvgDist (Time-of-Flight).
2. Audio Occlusion and Source Management
The script actively tracks and modifies AudioSource components throughout the scene to create occlusion effects.
Source Scanning: ScanAudioSources() is called periodically to find all active AudioSources in the scene that use spatial blending. It stores their original volume for later restoration.
Occlusion Checks: In CheckSourcesOcclusionAndDoppler(), the script performs a Raycast from each nearby audio source to the listener.
– If the ray is blocked, it assumes the sound is occluded. The script then calculates the "thickness" of the obstructing object(s) by analyzing the colliders hit.
– The sound source’s volume is then reduced based on this thickness, creating a realistic muffling effect. If the path is clear, the volume is restored to its original level.
3. Loudness Monitoring and Hearing Damage Simulation
This feature creates an immersive "shell-shock" and tinnitus effect based on in-game audio levels.
Sampling Loudness: The SampleLoudness() method uses AudioListener.GetOutputData() to capture a small sample of the final audio mix being sent to the player’s speakers. It calculates the Root Mean Square (RMS) and peak amplitude of this sample.
Noise Exposure: The script maintains a noiseExposure variable. This value increases based on the measured RMS loudness (amplified by factors like enclosureGain) and slowly decays over time.
Tinnitus: When noiseExposure exceeds a certain tinnitusThreshold, a tinnitus effect is triggered.
A persistent, high-frequency ringing sound is played from a procedurally generated AudioClip (CreateTinnitusClip).
The game’s master AudioLowPassFilter is activated, cutting off higher frequencies to simulate hearing damage. The cutoff frequency and tinnitus volume are determined by the tinnitusSeverity.
Made by:
– Me
– ChatGPT
Required items:
Click the title to search on this site.
Flyby Audio Replacements — Steam Workshop
Vehicle Impact SFX — Steam Workshop