Skip to main content

Module mock_audio

Module mock_audio 

Source
Expand description

Deterministic mock audio sources (M-MEDIA.4 / AUT-100).

Enables TDD for waveform + histogram rendering without requiring a microphone or GStreamer. Three shapes — sine wave, silence, step pulse — emit timestamped AudioChunks with byte-exact reproducible samples. Every M-MEDIA test that wants “this is what audio looks like” without a live device uses one of these.

§Sources

  • SineWaveSourcesin(2π·f·t). Stable amplitude + frequency are the histogram’s “this RMS should be √2/2” reference.
  • SilenceSource — all zeros. The histogram’s “this should quantize to zero bars” reference.
  • StepPulseSource — a single 1.0 spike at a configurable frame index, otherwise zero. The histogram’s “this bucket should have a detectable peak” reference.

Each source is an iterator-like type with next_chunk(frames). It advances an internal frame counter on each call; timestamps come from MediaTime::from_sample.

Structs§

SilenceSource
Silence source — emits all-zero samples.
SineWaveSource
Sine-wave source. Emits amplitude · sin(2π · frequency · t) on every channel.
StepPulseSource
Step-pulse source. Emits a single-frame 1.0 spike at spike_frame_index; every other frame is 0.0. Useful for histogram-peak assertions that need a known location.

Functions§

frame_idx_to_seconds 🔒