Overview
Thenormalize_audio.sh script uses FFmpeg to:
- Remove DC offset (unwanted baseline shift in audio)
- Detect the peak volume level
- Apply gain to bring audio to -1.0 dB target level
- Process all
.oggfiles in a directory
File Location
Audio Structure
Orbis Galactic organizes audio files in:Usage
Basic Syntax
Parameters
Directory containing
.ogg files to normalize.Example: Server/Audio/SoundEvents/SFX/Lightsabers/Directory where normalized files will be saved.
- If omitted and
--in-placeis not used, defaults to<input_dir>/normalized - Ignored if
--in-placeflag is set
Normalize files directly in the input directory, overwriting originals.
Examples
Normalize to New Directory
Process files and save normalized versions to a separate folder:Custom Output Directory
Specify exactly where normalized files should go:In-Place Normalization
Replace original files with normalized versions:Batch Process Multiple Directories
Normalize all sound effect categories:How It Works
Step 1: DC Offset Removal
The script first removes DC offset, which is an unwanted baseline shift in the audio waveform:Step 2: Peak Detection
FFmpeg analyzes the audio to find the maximum volume level:Step 3: Gain Calculation
The script calculates how much gain to apply to reach -1.0 dB:Step 4: Apply Normalization
FFmpeg processes the file with DC removal and gain adjustment:Target Level
The script normalizes all audio to -1.0 dB:- Provides headroom to prevent clipping
- Ensures consistent volume across all sounds
- Leaves room for in-game audio mixing
-1.0 dB is just below the maximum (0 dB) to prevent distortion while maximizing perceived loudness.
Requirements
The script requires FFmpeg to be installed and available in your PATH.Install on Ubuntu/Debian:Install on macOS:Install on Windows:
Download from ffmpeg.org
Script Output
The script provides detailed progress information:Best Practices
Before Normalization
When to Normalize
- After adding new sound effects
- When sounds have inconsistent volume levels
- Before releasing a mod update
- After editing audio in external tools
When NOT to Normalize
Testing
After normalization:- Test sounds in-game to verify volume levels
- Check that quiet sounds aren’t too loud
- Ensure loud sounds don’t clip or distort
- Verify ambient sounds maintain proper balance
Troubleshooting
”Failed to detect peak”
This error occurs if FFmpeg cannot analyze the file:- Verify the file is a valid
.oggfile - Check that the file isn’t corrupted
- Ensure FFmpeg is properly installed
Files Too Quiet After Normalization
If normalized files seem too quiet:- The original recording may have very low levels
- Consider re-recording or amplifying in an audio editor first
- Check that the source audio has adequate signal
Files Distorting After Normalization
If you hear distortion:- The original file may have already been at or near maximum volume
- Check the “Detected peak” value - if it’s near 0 dB, the file was already loud
- Consider lowering the target level by modifying the script