Skip to content

cvc::ariadne::stream: composable audio source family — tone / gain / mix - #533

Merged
transfix merged 1 commit into
masterfrom
feat/stream-audio-sources
Oct 2, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/stream-audio-sources

Conversation

@transfix

@transfix transfix commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Summary

The pure / composable members of the audio-source family (toward the holy-grail mic/record/playback demo and your directive that an audio source be general, not microphone-specific). All are cvc::ariadne::stream::frame_source producing interleaved f32 PCM, so they feed an audio stream like any other frame_source and compose into an audio graph — no SDL, no device, fully testable.

  • tone_source — a continuous sine (the audio analogue of synthetic_source), phase carried across chunks; the hardware-free reference source.
  • gain_source — a filter member: wraps one source, scales every sample.
  • mix_source — the mix member (an audio multiplexer): sums N sources sample-wise, clamped to [-1,1]; a spent input contributes silence, the mix stops when all inputs are spent.
  • audio_f32_bytes(frames, channels) sizes an audio stream's per-chunk bytes.

In cvc::ariadne::stream, alongside synthetic_source (inc/cvc/ariadne/stream/audio_sources.h + src/cvc/ariadne/stream/audio_sources.cpp).

Tests (stream_test AudioSources.*, fully exercised — no device)

Tone is bounded and seamless (phase carries across chunks; pts advances); gain scales every sample 2× vs a lockstep reference tone; mix sums two reference tones sample-exact. stream_test = 31 green; clang-format clean.

Next toward the holy grail

The device member (SDL mic / any capture device, cvcGL) + the audio-output sink (SDL playback, with record/playback) + the Ariadne video/image widget + the example app. Adversarial review (DSP bounds/composition) running; I'll fold findings before auto-merge.

…mix (f32 PCM)

The pure/virtual members of the generalized audio-source family (docs/STREAMING.md; Joe's directive
that an audio source be general + composable, not microphone-specific). All are
cvc::ariadne::stream::frame_source producing interleaved f32 PCM, so they feed an audio stream like
any other frame_source and compose into an audio graph — no SDL, no device, fully testable.
inc/cvc/ariadne/stream/audio_sources.h + src/cvc/ariadne/stream/audio_sources.cpp (alongside
synthetic_source).

- tone_source: a continuous sine (the audio analogue of synthetic_source) with phase carried across
  chunks; the hardware-free reference source.
- gain_source: a FILTER member — wraps one source, scales every sample.
- mix_source: the MIX member (an audio multiplexer) — sums N sources sample-wise, clamped to
  [-1,1]; a spent input contributes silence, the mix stops when all inputs are spent.
- audio_f32_bytes(frames, channels) sizes an audio stream's per-chunk bytes.

Tests (stream_test AudioSources.*): tone is bounded/seamless (phase carries across chunks); gain
scales every sample 2x vs a lockstep reference tone; mix sums two reference tones sample-exact. 31
stream_test tests green.

The DEVICE member (SDL mic / any capture device) + the audio-OUTPUT sink (SDL playback) + the
Ariadne video/image widget + the example app follow, toward the holy-grail demo.
@transfix
transfix force-pushed the feat/stream-audio-sources branch from aca1905 to 2590c0d Compare October 2, 2026 06:07
@transfix
transfix enabled auto-merge October 2, 2026 06:07
@transfix
transfix merged commit 1385c00 into master Oct 2, 2026
12 of 13 checks passed
@transfix
transfix deleted the feat/stream-audio-sources branch October 29, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant