- Pure Go implementation with no external dependencies
- Supports AAC-LC (Low Complexity) profile
- ADTS (Audio Data Transport Stream) format parsing
- Decodes AAC frames to PCM audio
- Full implementation of AAC decoding pipeline including:
- Huffman decoding
- Inverse quantization
- Temporal Noise Shaping (TNS)
- Mid/Side stereo
- Intensity stereo
- Channel coupling
- Modified Discrete Cosine Transform (MDCT)
- Filterbank processing
go get github.com/skrashevich/go-aacThe repository includes a command-line tool for converting AAC files to WAV or raw PCM:
go install github.com/skrashevich/go-aac/cmd/aac2pcm@latest# Convert AAC to WAV
aac2pcm input.aac output.wav
# Output raw PCM to stdout
aac2pcm --raw input.aac > output.pcm
# Verbose mode with details
aac2pcm -v input.aac output.wavSee cmd/aac2pcm/main.go for a complete example of how to use the library.
The library provides a simple API for decoding AAC audio. See the aac2pcm implementation for a practical example demonstrating:
- Probing ADTS data with
adts.Probe() - Creating a decoder with
decoder.New() - Reading ADTS headers with
adts.ReadHeaderFromBytes() - Decoding frames with
decoder.DecodeFrame() - Converting float32 samples to int16 PCM
- Writing WAV files
The decoder is organized into the following packages:
- decoder: High-level AAC decoder interface
- adts: ADTS header parsing and validation
- ics: Individual Channel Stream processing
- cpe: Channel Pair Element (stereo channels)
- cce: Coupling Channel Element
- huffman: Huffman decoding with spectral tables
- filterbank: IMDCT filterbank processing
- mdct: Modified Discrete Cosine Transform
- fft: Fast Fourier Transform
- tns: Temporal Noise Shaping
- tables: Lookup tables for AAC decoding
- AAC Main (partially)
- AAC-LC (Low Complexity) - recommended
- AAC-LTP (Long Term Prediction) (partially)
- SBR (Spectral Band Replication) / HE-AAC is not supported
- AAC Main and LTP prediction features are not fully implemented
- PCE (Program Config Element) is not implemented
- Gain control is not implemented
This project is licensed under the LGPL v3 license, matching the original AAC.js implementation.
- Author: Sergei Krashevich
- Based on AAC.js by Devon Govett and the Audiocogs team
Contributions are welcome! Please feel free to submit issues or pull requests.