AudioConverter class provides audio format conversion using FFmpeg and vgmstream for WEM files, and Wwise for WAV to WEM conversion.
Constructor
- Automatically detects FFmpeg location
- Automatically detects vgmstream-cli location
- Initializes Wwise Console if available
Methods
wem_to_wav
Converts a Wwise WEM file to WAV format.Path to input WEM file.
Output WAV path. If None, uses same name with .wav extension.
Path to the converted WAV file.
RuntimeError: If conversion tools not found or conversion fails
- Tries vgmstream-cli first (recommended for WEM)
- Falls back to FFmpeg if vgmstream fails
- Provides installation instructions on failure
any_to_wav
Converts any audio format to WAV (MP3, FLAC, OGG, M4A, etc.).Path to input audio file (any format FFmpeg supports).
Output WAV path. If None, uses same name with .wav extension.
Output sample rate in Hz. Default 48000 matches game audio.
Number of audio channels (1=mono, 2=stereo).
If True, normalizes audio to -9 LUFS for consistent volume.
Path to the converted WAV file.
RuntimeError: If FFmpeg not found or conversion fails
- Integrated loudness: -9 LUFS
- True peak: -1.5 dBTP
- Loudness range: 11 LU
wav_to_wem
Converts a WAV file to Wwise WEM format.Path to input WAV file.
Output WEM path. If None, uses same name with .wem extension.
Custom Wwise installation directory. If None, uses default.
Path to the converted WEM file.
RuntimeError: If Wwise not installed or conversion fails
- Wwise must be installed (see Wwise Wrapper)
- WAV should be 48kHz, 16-bit for best results
batch_convert_wem_to_wav
Converts all WEM files in a directory to WAV.Directory containing WEM files.
Output directory. If None, creates ‘wav’ subdirectory in input_dir.
List of successfully converted WAV file paths.
- Processes all
*.wemfiles - Continues on error
- Prints progress for each file
batch_convert_to_wav
Converts all audio files in a directory to WAV.Directory containing audio files.
Output directory. If None, creates ‘wav’ subdirectory in input_dir.
File pattern to match (currently unused, processes all audio extensions).
Whether to normalize audio volume.
List of successfully converted WAV file paths.
.mp3.flac.ogg.m4a.aac.opus.wma
batch_convert_wav_to_wem
Converts all WAV files in a directory to WEM.Directory containing WAV files.
Output directory. If None, creates ‘wem’ subdirectory in input_dir.
List of successfully converted WEM file paths.
RuntimeError: If Wwise not installed
- Uses Wwise batch conversion for efficiency
- Returns empty list if no WAV files found
Tool Detection
FFmpeg
Windows:- Checks
tools/audio/ffmpeg/ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe - Checks
tools/audio/ffmpeg/bin/ffmpeg.exe - Falls back to system PATH
- Requires system installation:
sudo pacman -S ffmpeg
vgmstream-cli
Windows:- Checks
tools/audio/vgmstream/vgmstream-cli.exe
- Checks system PATH
- Install:
sudo pacman -S vgmstream(Arch) or build from source
Wwise
See Wwise Wrapper for installation details.Example Usage
Convert WEM to WAV
Convert MP3 to WAV for Modding
Batch Convert Music Files
Compare Audio Quality
Command-Line Usage
Convert WEM to WAV
Convert Any Format to WAV
Convert WAV to WEM
Audio Specifications
Game Audio Format
- Sample Rate: 48000 Hz
- Bit Depth: 16-bit PCM (for WAV)
- Channels: 1 (mono) or 2 (stereo)
- Codec: Vorbis (inside WEM)
Recommended Settings
For voice replacements:Error Handling
Platform-Specific Notes
Windows
- Audio tools can be installed from ZZAR Settings page
- Tools stored in
tools/audio/directory - No system dependencies required
Linux
- Requires system packages:
vgmstream ffmpeg - Arch:
sudo pacman -S vgmstream ffmpeg - Ubuntu:
sudo apt install vgmstream-cli ffmpeg
Flatpak
- Uses host system’s tools via
flatpak-spawn - Wine required for Wwise (WAV to WEM)
Notes
- WEM is a proprietary Wwise format based on Ogg Vorbis
- vgmstream provides the best WEM decoding quality
- FFmpeg can decode some WEM files but not all
- Normalization ensures consistent volume across mods
- WAV to WEM conversion requires Wwise (see setup guides)
- Always use 48kHz sample rate to match game audio