Thealexbarney / VGAudio

A library for encoding, decoding, and manipulating audio files from video games.
MIT License
219 stars 37 forks source link

VGAudio

VGAudio is a library for encoding, decoding, and manipulating audio files and formats that are usually found in video games.

The most recent release of the library can be found on NuGet

The Universal Windows app can be found in the Windows Store

Supported Audio Formats and Containers

Audio Formats

Format Encode Decode Notes
ATRAC9 X MDCT-based codec from Sony
CRI ADX X X 4-bit ADPCM codec from CRI
CRI HCA X X MDCT-based codec from CRI
Nintendo GC-ADPCM X X 4-bit ADPCM codec from Nintendo
PCM 8-bit X X Signed and unsigned
PCM 16-bit X X

Container Formats

Container Write Read Notes
AT9 X X
BCSTM X X
BCSTP X
BCWAV X
BFSTM X X
BFSTP X
BFWAV X
BRSTM X X
BRWAV X
DSP (Nintendo) X X
GENH X GC-ADPCM only
HCA X X
HPS X X HAL Laboratory "HALPST" container for GC-ADPCM audio
IDSP (Interleaved Nintendo DSP) X X
MDSP X X Multi-channel Nintendo DSP
WAV X X

VGAudioCli

The tool VGAudioCli provides a command-line interface (CLI) to convert audio files supported by the VGAudio library.

Examples

Basic Usage

Splitting and Combining Files

Batch Conversions

Batch conversion allows an entire folder of files to be converted at a time. These conversions are done in parallel, and will be faster the more CPU cores you have.

Batch mode is used by inputting -b or --batch as the first command-line argument. Unlike single-file conversions, you must explicitly specify the output file type in batch conversions.

Examples

Lossless conversions

Depending on which format is used, when the input and output files are the same audio format, the conversion is often lossless. For example, both the DSP and BRSTM containers contain GC-ADPCM audio, so converting a DSP file to a BRSTM file would be a lossless conversion. The encoded audio data is read from the DSP file and repackaged into a BRSTM file without any modification.

The channels from some formats like ADX and GC-ADPCM can be losslessly split and combined. For example, a stereo ADX file can be split into two mono ADX files without any loss of quality. Conversely, two stereo ADX files can be combined into a single 4-channel ADX file.

Because no audio encoding is done, these types of conversions are very quick compared to normal conversions.