Skip to main content

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

Metadata

Release files for a1800-codec 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a1800-codec 1.1.0
File Size Uploaded
a1800_codec-1.1.0.tar.gz 138.2 kB Details

Release files / a1800_codec-1.1.0.tar.gz

Download URL a1800_codec-1.1.0.tar.gz
Size 138.2 kB
Tags Source
SHA-256 checksum
How to use checksums
82a20a392dd081bf631399fd072e261216c62df64f954f429d0bc5741b616e4e
BLAKE2b-256 checksum
How to use checksums
b9b46bf0b349aa92cbe49040837664710209433582caf769e3238fd0da9c5800
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page