Skip to content

About

A small tool to convert the custom Eurocom ADPCM files to a WAV PCM 16-bit encoding file and vice versa.

Topics

Resources

Stars

1 star

Watchers

2 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

License Issues GitHub Release

Eurocom IMA ADPCM Audio Tool

Console utility for encoding and decoding the custom Eurocom IMA ADPCM format used by EngineXT. It accepts mono and stereo 16-bit PCM WAV files and produces raw, headerless Eurocom IMA ADPCM data.

Features

  • Encodes mono and stereo 16-bit PCM WAV files.
  • Decodes mono and stereo Eurocom IMA ADPCM into PCM WAV files.
  • Uses the EngineXT block format: 32 bytes encode 56 samples per channel.
  • Writes the high nibble before the low nibble, matching EngineXT.
  • Interleaves stereo blocks exactly as EngineXT expects.
  • Optimizes the predictor and initial step index independently for every block and channel.
  • Selects each ADPCM nibble by testing the exact PCM16 reconstruction.
  • Validates block alignment, step indices and block markers while decoding.

EngineXT format

Every channel block is 32 bytes:

Offset Size Description
0x00 2 bytes Signed 16-bit little-endian predictor
0x02 1 byte IMA step index (0 to 88)
0x03 1 byte Block marker (A to Z, cycling)
0x04 28 bytes 56 four-bit ADPCM samples

The first sample in each packed byte is stored in the high nibble. The second sample is stored in the low nibble.

Stereo data is interleaved by complete channel blocks, not sample-by-sample:

Left block 0  (32 bytes)
Right block 0 (32 bytes)
Left block 1  (32 bytes)
Right block 1 (32 bytes)
...

This is the layout consumed by the EngineXT IMA ADPCM decoder.

Requirements

Encoding input must be:

  • A valid WAV file.
  • PCM encoding.
  • 16 bits per sample.
  • Mono or stereo.

Raw ADPCM data does not contain its sample rate, channel count or exact unpadded sample length. These values must be known when decoding.

Usage

Encoding

The channel count is read automatically from the WAV header.

ImaAdpcmTool.exe <input.wav> <output.adpcm>

Mono example:

ImaAdpcmTool.exe "input_mono.wav" "output_mono.adpcm"

Stereo example:

ImaAdpcmTool.exe "input_stereo.wav" "output_stereo.adpcm"

Decoding

ImaAdpcmTool.exe Decode <input.adpcm> <output.wav> <sample-rate> [channels] [--samples frames]

channels can be:

  • 1 for mono.
  • 2 for stereo.

If channels is omitted, mono is assumed for compatibility with earlier versions.

Use --samples <frames> when the original PCM length is known. It removes silent padding from the final 56-sample block without changing the raw ADPCM format.

Mono example:

ImaAdpcmTool.exe Decode "input_mono.adpcm" "output_mono.wav" 44100

Stereo example:

ImaAdpcmTool.exe Decode "input_stereo.adpcm" "output_stereo.wav" 44100 2

Supported raw ADPCM input extensions are .adpcm, .ima, .raw and .wav. A .wav input passed to Decode must contain raw Eurocom IMA ADPCM data; ordinary RIFF PCM WAV files must be passed to the encoder instead.

Help

ImaAdpcmTool.exe --help

The aliases help, -h and ? are also accepted.

Block padding

The encoder always writes complete blocks of 56 samples per channel. When the PCM frame count is not a multiple of 56, the final block is padded with silence.

Because this is a raw headerless format, the decoder cannot determine how many samples in the last block were padding. The decoded WAV therefore contains a whole number of 56-sample blocks. Trim the decoded result to the original PCM frame count when exact length is required.

Examples:

  • 56 mono frames produce 32 ADPCM bytes.
  • 56 stereo frames produce 64 ADPCM bytes.
  • 112 stereo frames produce 128 ADPCM bytes.

Compatibility and validation

The decoder rejects:

  • Data whose length is not aligned to complete channel block groups.
  • Stereo data without a complete left/right block pair.
  • Step indices above 88.
  • Block markers other than zero or A through Z.
  • Truncated 32-byte blocks.

The PCM reconstruction uses the standard signed 16-bit IMA predictor with saturation to -32768...32767 after every nibble.

Download

Prebuilt releases are available from the project releases page:

GitHub All Releases

About

A small tool to convert the custom Eurocom ADPCM files to a WAV PCM 16-bit encoding file and vice versa.

Topics

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages