ADX ADPCM Audio Codec

class PyCriCodecsEx.adx.ADX[source]

Bases: object

ADX class for decoding and encoding ADX files, pass the either adx file or wav file in bytes to either decode or encode respectively.

NOTE: Direct usage of this class is not recommended, use the ADXCodec wrapper instead.

static decode(data: bytes) bytes[source]

Decodes ADX to WAV.

static encode(data: bytes, BitDepth=4, Blocksize=18, Encoding=3, AdxVersion=4, Highpass_Frequency=500, Filter=0, force_not_looping=False) bytes[source]

Encodes WAV to ADX.

class PyCriCodecsEx.adx.ADXCodec(stream: str | bytes, filename: str = 'default.adx', bitdepth: int = 4, **kwargs)[source]

Bases: ADX

Use this class for encoding and decoding ADX files, from and to WAV.

__init__(stream: str | bytes, filename: str = 'default.adx', bitdepth: int = 4, **kwargs)[source]

Initializes the ADX encoder/decoder

Parameters:
  • stream (str | bytes) – Path to the ADX or WAV file, or a BinaryIO stream. WAV files will be automatically encoded with the given settings first.

  • filename (str, optional) – Output filename. Defaults to “default.adx”.

  • bitdepth (int, optional) – Audio bit depth within [2,15]. Defaults to 4.

get_encoded() bytes[source]

Gets the encoded ADX audio data.

save(filepath: str | BinaryIO)[source]

Saves the decoded WAV audio to filepath or a writable stream