Proof of concept lossy audio codec written in Rust that preserves gapless playback.
Please note that this is currently a somewhat buggy implementation. It does achieve gapless playback and lossy compression, but at the cost of mangling the amplitude as much as 25% in a few outlier samples. Why this happens is still under investigation.
Basic usage
glc <file1.wav> [file2.wav] [file3.flac] ...- WAV files (
.wav) - FLAC files (
.flac)
- Each input file is encoded to a
.glcfile with the same base name - Example:
song.wav→song.glc - Multiple files can be processed in one command
- If any file fails, the program continues with remaining files but exits with code 1
glc audio.wav
# Creates audio.glcglc song1.wav song2.wav song3.flac
# Creates song1.glc, song2.glc, song3.glcglc missing.wav # Error: File not found
glc song.mp3 # Error: Unsupported file typeFor each successfully encoded file, the program displays:
- Input filename
- Sample rate, channel count, and sample count
- Output filename, size, and compression ratio
Example output:
Loading: "test.wav"
Encoding: 44100 Hz, 2 channels, 88200 samples
Saved: "test.glc" (7014 bytes, 4.0% of original)
Decode a file and save output (FLAC by default)
glc -d file.glcCreates file.flac with default compression level 5
Decode with specific FLAC compression level (0-8)
glc -d --flac-level 8 file.glcDecode to WAV format instead
glc -d --wav file.glcDecode a file and play it back using a pure Rust implementation
(requires playback or ui feature to be enabled):
glc -p file.glcDecode a file and play it back using ffplay (may not work currently):
glc -p file.glc --ffplayNo features are enabled by default for a minimal command-line build. You can enable specific features as needed.
cargo build --releaseProduces a minimal binary with encoding/decoding capabilities only.
cargo build --release --features uiIncludes GUI support. May require system libraries for GUI (glib-2.0) and audio playback (alsa on Linux).
cargo build --release --features playbackEnables audio playback through the command line using rodio.
FLAC encoding and decoding is now implemented in pure Rust, requiring no external libraries. The encoder supports compression levels 0-8, with level 5 as the default. This implementation follows RFC 9639 and produces standard-compliant FLAC files.