feat: add AudioSource/AudioSink traits + G.711 codec#21
Merged
Conversation
Two upstream-shaped additions for the WaveKat audio ecosystem:
- `audio_io::{AudioSource, AudioSink}` — the producer/consumer seam the
whole audio pipeline is drawn against. Frames keyed on `AudioFrame`
so the trait doesn't have to know about the codec.
- `codec::g711` — PCMU / PCMA encode/decode + `G711Codec` enum.
Codecs are consumer-layer (`wavekat-sip` stays codec-agnostic) but
benefit from a shared home so future consumers (wavekat-asr,
wavekat-voice, an eventual `wavekat-agent`) don't each reimplement.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- audio_io: source-drain ordering, sink backpressure pattern, per-frame sample-rate preservation, compile-time Send check. - g711: per-codeword decode fixed-point sweep, full-codeword-space no-panic, distinctness sanity, PCMU vs PCMA cross-check, slice encode/decode buffer-append behavior, sine-wave round-trip with a mean-error bound, RFC 3551 payload-type pinning. Also document the new modules under "What Belongs Here" and the repo-structure tree in CLAUDE.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Replace seg_for's loop with leading_zeros bit-math so it can't fall through, and remove the unreachable seg >= 8 arms in linear_to_ulaw and linear_to_alaw. Inputs are already bounded to [0, 0x7FFF], so the guards never fired and showed up as missing patch coverage. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
wavekat-eason
pushed a commit
that referenced
this pull request
May 14, 2026
## 🤖 New release * `wavekat-core`: 0.0.8 -> 0.0.9 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.0.9](v0.0.8...v0.0.9) - 2026-05-14 ### Added - add AudioSource/AudioSink traits + G.711 codec ([#21](#21)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two upstream-shaped additions for the WaveKat audio ecosystem:
audio_io::{AudioSource, AudioSink}— the producer/consumer seam any audio pipeline composes against.Send-bounded traits withSend-bounded future returns, keyed on `AudioFrame`. Concrete impls live in their consuming crates (cpal mic in `wavekat-voice`, a future agent-backed impl in `wavekat-agent`) so the trait stays neutral.CLAUDE.md updated to document the new modules under "What Belongs Here" and the repo-structure tree.
Why this lives here
Originally drafted inside `wavekat-voice` as part of the M1 audio scaffolding (doc 12's "one architectural seam worth drawing now"). Moved upstream so that:
The `wavekat-sip` port-plan explicitly excludes codecs from that crate, so they don't go there.
Test plan
39 unit tests in the lib + 3 doctests. Coverage:
🤖 Generated with Claude Code