Overview
Symphonia provides a complete pure Rust implementation of the Free Lossless Audio Codec (FLAC), including both decoder and demuxer. FLAC is a popular lossless audio compression format that typically achieves 40-50% compression ratio.Feature Flag
To enable FLAC support, add theflac feature to your Cargo.toml:
Status
Status: Excellent- Decoding: Fully supported
- Gapless Playback: Yes
- Native FLAC files: Yes
- OGG-FLAC: Yes (requires
oggfeature)
Codec Type
Decoder
The FLAC decoder is implemented by theFlacDecoder struct:
Format Reader
For native FLAC files, use theFlacReader:
Supported Features
Bit Depths
- 8-bit
- 16-bit
- 24-bit
- 32-bit (experimental)
Sample Rates
All sample rates from 1 Hz to 655,350 Hz, including:- 8 kHz, 11.025 kHz, 12 kHz
- 16 kHz, 22.05 kHz, 24 kHz
- 32 kHz, 44.1 kHz, 48 kHz
- 88.2 kHz, 96 kHz
- 176.4 kHz, 192 kHz
Channels
- Mono (1.0)
- Stereo (2.0)
- 3.0 through 8.0 configurations
- Channel counts up to 8
Prediction Methods
- Constant
- Verbatim
- Fixed Linear Prediction (orders 0-4)
- Linear Prediction Coding (LPC, orders 1-32)
Block Sizes
Variable block sizes from 16 to 65,535 samplesMetadata Support
FLAC supports extensive metadata through Vorbis Comments:- STREAMINFO (required)
- VORBIS_COMMENT (tags)
- PICTURE (embedded artwork)
- CUESHEET
- SEEKTABLE
- APPLICATION
Usage Example
Seeking Support
FLAC supports efficient seeking:Performance
- Pure Rust implementation with no unsafe code
- Highly optimized predictor implementations
- SIMD optimizations available with feature flags:
opt-simd-sse- SSE optimizationsopt-simd-avx- AVX optimizationsopt-simd-neon- ARM NEON optimizations
Limitations
- None known for standard FLAC files
- Full compliance with FLAC 1.3.x specification