Skip to main content
The WwiseConsole class provides a Python interface to Wwise’s command-line tools for converting WAV files to WEM format, which is required for creating custom audio mods.

WwiseConsole

Constructor

from src.wwise_wrapper import WwiseConsole

wwise = WwiseConsole(
    wwise_dir=None,
    project_path=None
)
wwise_dir
str | Path
default:"None"
Path to Wwise installation directory. If None, uses tools/wwise/.
project_path
str | Path
default:"None"
Path to Wwise project (.wproj). If None, uses bundled WAVtoWEM project.
Behavior:
  • Auto-detects Wine on Linux/Flatpak systems
  • Ensures project structure exists
  • Creates required directories if missing

Methods

is_installed

Checks if Wwise is properly installed.
if wwise.is_installed():
    print("Wwise is ready")
else:
    print("Please install Wwise")
installed
bool
True if WwiseConsole.exe exists (and Wine available on Linux).

convert_to_wem

Converts a single WAV file to WEM format.
wem_file = wwise.convert_to_wem(
    wav_file,
    output_dir=None
)
wav_file
str | Path
required
Path to input WAV file.
output_dir
str | Path
default:"None"
Output directory. If None, uses same directory as input file.
wem_file
Path
Path to the converted WEM file.
Raises:
  • RuntimeError: If conversion fails or WEM file not created
Behavior:
  • Creates temporary .wsources file
  • Runs WwiseConsole with convert-external-source command
  • Cleans up temporary files after conversion
  • Searches for WEM in subdirectories if not found in output_dir

batch_convert_to_wem

Converts multiple WAV files to WEM format efficiently.
converted = wwise.batch_convert_to_wem(
    wav_files,
    output_dir
)
wav_files
list[Path]
required
List of WAV file paths to convert.
output_dir
str | Path
required
Output directory for WEM files.
converted
list[Path]
List of successfully converted WEM file paths.
Behavior:
  • All WAV files must be in the same directory for batch mode
  • If in different directories, converts individually
  • Falls back to individual conversion on batch failure
  • More efficient than multiple single conversions

Wwise Project Structure

The wrapper uses a minimal Wwise project:
WAVtoWEM/
  WAVtoWEM.wproj              # Wwise project file
  GeneratedSoundBanks/        # Output directory
  Originals/                  # Source files
  Attenuations/
  Conversion Settings/
  Actor-Mixer Hierarchy/
Conversion Settings:
  • Profile: “Vorbis Quality High”
  • Matches game’s audio codec

Installation Paths

Windows

tools/wwise/WWIse/Authoring/x64/Release/bin/WwiseConsole.exe

Linux (via Wine)

  • Uses wine64 or wine from system PATH
  • In Flatpak: Uses flatpak-spawn --host wine64

Project Resources

resources/WAVtoWEM/WAVtoWEM.wproj

Example Usage

Convert Single WAV

from src.wwise_wrapper import WwiseConsole
from pathlib import Path

wwise = WwiseConsole()

# Check installation
if not wwise.is_installed():
    print("Wwise not installed! Please run setup.")
    exit(1)

# Convert file
try:
    wem_file = wwise.convert_to_wem(
        wav_file="my_audio.wav",
        output_dir="./output"
    )
    print(f"Created: {wem_file}")
except RuntimeError as e:
    print(f"Conversion failed: {e}")

Batch Convert WAVs

from src.wwise_wrapper import WwiseConsole
from pathlib import Path

wwise = WwiseConsole()

# Get all WAV files
wav_dir = Path("./wav_files")
wav_files = list(wav_dir.glob("*.wav"))

if not wav_files:
    print("No WAV files found")
    exit(1)

print(f"Converting {len(wav_files)} files...")

# Batch convert
output_dir = Path("./wem_output")
output_dir.mkdir(exist_ok=True)

converted = wwise.batch_convert_to_wem(wav_files, output_dir)

print(f"Successfully converted {len(converted)}/{len(wav_files)} files")

for wem_file in converted:
    print(f"  ✓ {wem_file.name}")

Custom Wwise Installation

from src.wwise_wrapper import WwiseConsole
from pathlib import Path

# Use custom Wwise installation
wwise = WwiseConsole(
    wwise_dir="/custom/path/to/wwise",
    project_path="/custom/path/to/project.wproj"
)

if wwise.is_installed():
    wem = wwise.convert_to_wem("audio.wav")

Command-Line Usage

Convert Single File

python -m src.wwise_wrapper audio.wav ./output

Convert Directory

python -m src.wwise_wrapper ./wav_folder ./wem_output

.wsources File Format

The wrapper generates .wsources XML files for Wwise:
<?xml version='1.0' encoding='utf-8'?>
<ExternalSourcesList SchemaVersion="1" Root="Z:\path\to\wav\files">
  <Source Path="audio1.wav" Conversion="Vorbis Quality High" />
  <Source Path="audio2.wav" Conversion="Vorbis Quality High" />
</ExternalSourcesList>
Windows Path Format:
C:\Users\Name\audio
Wine Path Format (Linux):
Z:\home\user\audio

WAV Requirements

Recommended Specifications:
  • Sample Rate: 48000 Hz
  • Bit Depth: 16-bit PCM
  • Channels: 1 (mono) or 2 (stereo)
  • Format: WAV (RIFF)
Supported Formats: Wwise accepts most standard WAV formats, but 48kHz 16-bit PCM is recommended for game audio.

Wwise Installation

Windows

  1. Download Wwise from ZZAR Settings page
  2. Extract to tools/wwise/
  3. Verify: tools/wwise/WWIse/Authoring/x64/Release/bin/WwiseConsole.exe exists

Linux

  1. Install Wine: sudo pacman -S wine (Arch) or sudo apt install wine (Ubuntu)
  2. Download Wwise for Windows
  3. Extract to tools/wwise/
  4. Verify Wine: wine64 --version

Flatpak

  1. Install Wine on host system (not inside Flatpak)
  2. Wwise will run via flatpak-spawn --host wine64

Troubleshooting

WEM Not Created

Check:
  • Project structure exists (auto-created by wrapper)
  • WAV file is valid and not corrupted
  • Sufficient disk space
  • WwiseConsole output for errors
Solution:
# Enable debug output
import subprocess
wwise.convert_to_wem("test.wav")  # Check console output

Wine Issues (Linux)

Check Wine installation:
wine64 --version
# or
wine --version
Flatpak check:
flatpak-spawn --host wine64 --version

Permission Errors

from pathlib import Path

# Ensure directories are writable
output_dir = Path("./output")
output_dir.mkdir(exist_ok=True, mode=0o755)

Performance Notes

Single Conversion:
  • ~0.5-2 seconds per file
  • Wwise startup overhead per conversion
Batch Conversion:
  • ~0.1-0.5 seconds per file (after startup)
  • Shares Wwise instance across conversions
  • Much faster for multiple files
Recommendation: Use batch_convert_to_wem() for 3+ files.

Technical Details

WwiseConsole Command

WwiseConsole.exe convert-external-source \
  "path/to/project.wproj" \
  --source-file "list.wsources" \
  --output "output/dir"

Artifact Cleanup

Automatically removes after conversion:
  • list.wsources file
  • Windows/ subdirectory (Wwise temp files)

Project Migration

If project is from older Wwise version:
wwise._migrate_project()  # Called automatically if needed

Notes

  • WEM format uses Ogg Vorbis codec internally
  • Conversion is lossy (like MP3)
  • Original WAV quality matters - use high quality sources
  • Wwise is required for WEM creation (no open-source alternative)
  • License: Wwise is free for non-commercial use
  • Project template is minimal and portable

Build docs developers (and LLMs) love