Skip to main content

Python bindings for the GeneralPlus A1800 audio codec

Project description

a1800_codec

A Rust encoder and decoder for the GeneralPlus A1800 audio codec, reverse-engineered from A1800.DLL.

The A1800 is a fixed-point subband audio codec that splits 320-sample frames (20 ms at 16 kHz) into 32 subbands using a 5-stage butterfly filterbank. It supports bitrates from 4800 to 32000 bps in steps of 800. All arithmetic uses ITU-T G.729-style saturating i16/i32 operations.

See Codec.md for the full technical reference, including the decode/encode pipelines, constant tables, DLL function map, and known differences between this implementation and the original DLL.

Authoring

This code was co-developed with Claude Opus 4.6 and made use of Ghidra 12.0.2 and ghidra-mcp v2.0.0

Building

cargo build --release

No external dependencies.

Usage

# Decode .a18 to WAV
a1800_codec decode input.a18 output.wav [--sample-rate 16000]

# Encode WAV to .a18
a1800_codec encode input.wav output.a18 [--bitrate 16000]

Input WAV files must be mono 16-bit PCM. The default sample rate is 16000 Hz and the default bitrate is 16000 bps.

.a18 File Format

Offset Size Type Description
0x00 4 LE u32 Byte count of frame data
0x04 2 LE u16 Bitrate
0x06 ... bytes Frames, each (bitrate/800) x 2 bytes

Round-trip Quality

At 16 kHz / 16 kbps:

  • Overall correlation: ~0.60
  • RMS ratio (output/input): ~1.02
  • 1 kHz sine SNR: ~15 dB

Bitrates 4800-24000 bps are supported for encoding. Decoding works at all bitrates.

Tests

See Testing.md for more information about non-synthetic tests.

cargo test

52 tests cover fixed-point arithmetic, bitstream I/O, encoder/decoder round-trips at multiple bitrates, filterbank invertibility, and a 5-second WAV round-trip.

License

This is an independent clean-room reimplementation based on static analysis of the original DLL. No original source code or proprietary headers were used.

Other Resources

  • A python implementation of the encoder by @prekageo at a1800_codec
  • Furby reverse engineering tools which decode via python and proprietary A1800.DLL Furby

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a1800_codec-1.1.0.tar.gz (138.2 kB view details)

Uploaded Source

File details

Details for the file a1800_codec-1.1.0.tar.gz.

File metadata

  • Download URL: a1800_codec-1.1.0.tar.gz
  • Upload date:
  • Size: 138.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for a1800_codec-1.1.0.tar.gz
Algorithm Hash digest
SHA256 82a20a392dd081bf631399fd072e261216c62df64f954f429d0bc5741b616e4e
MD5 da669d2a46fe19ab8aaed7f1ef966172
BLAKE2b-256 b9b46bf0b349aa92cbe49040837664710209433582caf769e3238fd0da9c5800

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page