FLAC decode support (pure Kotlin)
- Dominant language
- Kotlin
- Stars
- 37
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
FLAC is a common lossless interchange format. Users pick `.flac` files in the sample app and get `UnsupportedFormat` today.
FLAC is a good fit for commonMain: STREAMINFO, frame headers, constant/verbatim/fixed/LPC subframes, Rice residuals. Prior art: Nayuki's MIT Java FLAC decoder.
## Proposed architecture
Add `io/files/flac/` implementing `AudioFileCodec`:
- `matchesMagic`: `fLaC`
- `readMetadata`: STREAMINFO + VorbisComment into `AudioFileMetadata` / `AudioTags`
- `decode`: FLAC to interleaved little-endian PCM `AudioSource`
- `canEncode = false` initially (encode can be a follow-up)
Register in `AudioFileCodecs.all` and add `AudioFileFormat.Flac`.
Optional later: `AudioEncodingInfo.Compressed.Flac` with bits-per-sample and MD5.
## Acceptance criteria
- [ ] `AudioFileFormat.Flac` and `FlacCodec` registered
- [ ] Decode produces PCM `AudioRecording` via `AudioFileReader` / `fromBytes`
- [ ] VorbisComment mapped into `AudioTags` (+ raw)
- [ ] Tests with real FLAC fixtures (commonTest smoke + jvmTest resources)
- [ ] Docs format table updated
## Out of scope
- FLAC encode
- Exotic channel layouts beyond stereo (unless trivial)
## Related
- Audio codec roadmap umbrella issue
- `AudioFileCodec` registry
Contributor guide
Research direction
Start with the AudioFileCodec registry, AudioFileCodecs.all, AudioFileReader/fromBytes, and the proposed io/files/flac/ package. Implement the listed FLAC metadata and decoding scope, then add commonTest smoke coverage with jvmTest resources and update the docs format table; completion is defined by the acceptance criteria and excludes encoding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- audio-video-rtc
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100