AudioFlow
A typed stream of raw PCM audio: an AudioFormat paired with a Flow of ByteArray chunks.
Every emitted chunk is PCM in format: same sample rate, channel count, and sample encoding. Chunk boundaries are arbitrary; consumers must treat the stream as one continuous byte sequence.
The wrapped Flow may be cold or hot. A cold flow re-emits its full sequence on each collector (typical for replayable recordings). A hot flow shares live emissions among concurrent collectors (typical while recording). format always describes the PCM layout of every chunk, regardless of cold or hot behavior.
Finite vs unbounded
When knownByteCount is non-null, the stream is a known-finite recording of exactly that many PCM bytes and is safe to materialize for buffer-backed seek. When null (live monitors, infinite/long streams, unknown size), playback must stream chunks without draining the whole flow; seek should return SeekResult.Unsupported.
Properties
PCM layout shared by every chunk in the wrapped flow.
true when knownByteCount is set and buffer-backed seek is allowed.
Total PCM byte length when this flow is a known-finite recording. null means unbounded, live, or unknown; never fully collect for seek.
Functions
Collects this flow and returns an in-memory buffer containing the encoded file bytes for format (WAV, AIFF, or AU).
Collects every chunk from this flow into one contiguous PCM buffer wrapped as an AudioSource with this flow's AudioFlow.format.
Collects every chunk into a single ByteArray.
Convert an AudioFlow to a different AudioFormat. Pipeline: bytes -> normalized samples -> resample -> channel convert -> bytes
Collects this flow and writes the PCM data to a file at path.