Audio
Semantic audio values, stateful sessions, codecs, and signal operations.
Examples
oa
Types
27 members
Whole-audio value backed by a planar FP32 [channels, samples] matrix. Clones retain the same matrix storage and semantic audio metadata.
10 members
9 members
Stateful deterministic PCM-S16 audio encoder. Input is interleaved FP32. Complete configured packets are emitted by encode; flush emits a final partial packet. close deliberately discards an unflushed partial packet, matching the donor lifecycle contract. Dropping the encoder only releases host state and never flushes implicitly.
Source19 members
Incremental decoded PCM playback through the default output device.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Enums
Speaker layout carried by an Audio value.
Mono · Stereo · Stereo21 · Surround51 · Surround71 · Unknown
Functions
Convert absolute amplitude to finite decibels with a silence floor.
Apply one stable zero-state biquad independently to every channel.
Clamp every sample to an inclusive finite interval.
Crop input to its first samples samples per channel. Errors Returns an error when samples is zero or exceeds the input length; use pad_to to extend instead.
Decode one supported file and upload planar FP32 samples. This includes WAV/PCM, FLAC, MP3, and supported AAC-LC or Vorbis container tracks. This is a synchronous CPU codec boundary followed by device upload. It does not introduce a decoder session or a hidden execution backend. Errors Returns an error for an empty path, file I/O failure, unsupported or malformed media, changing stream parameters, empty decoded audio, checked-size overflow, or device allocation/upload failure. This variant decodes on this thread’s default runtime. An runtime initialization failure is returned before decoding starts.
Decode one supported file and upload planar FP32 samples on a particular runtime. This is the decode_file contract evaluated on runtime instead of this thread’s default runtime. Errors Returns the same errors as decode_file.
Decode one supported in-memory media stream and upload planar FP32 samples on this thread’s default runtime. Errors Returns an error when the default runtime cannot be initialized or for empty, unsupported, malformed, or parameter-changing media, empty decoded audio, checked-size overflow, or device allocation/upload failure.
Decode one supported in-memory media stream and upload planar FP32 samples on a particular runtime. Errors Returns an error for empty, unsupported, malformed, or parameter-changing media, empty decoded audio, checked-size overflow, or device allocation/upload failure.
Encode non-empty interleaved FP32 frames as lossless IEEE-float WAV bytes. Errors Returns an error for a zero sample rate or channel count, incomplete frames, or values that exceed the RIFF/WAV 32-bit header limits.
Read planar device samples and encode lossless IEEE-float WAV bytes. This is an explicit blocking host-observation boundary. Errors Returns an error when readback fails or the resulting WAV exceeds checked allocation or RIFF header limits.
Apply linear fade-in and fade-out envelopes measured in samples.
Apply scalar gain in decibels.
Invert a complex STFT matrix in [channels, frames, frequency_bins, 2] layout into planar audio using the inverse FFT and windowed overlap-add.
Build a per-row 0/1 length mask matching reference’s channel count and sample width: mask[r, n] = 1 when n < lengths[r]. Pair with stack: one length entry per output row marks each clip’s true sample count so masked losses and reductions can ignore padding. The mask is deterministic metadata and is uploaded like the mel filterbank. Errors Returns an error when lengths does not have one entry per channel or any entry exceeds the reference’s sample count.
Compute HTK triangular-filter mel features in [channels, mels, frames] layout.
Compute orthonormal DCT-II coefficients in [channels, coefficients, frames] layout.
Compute a weighted sum of matching Audio values.
Mix noise into signal at snr_db decibels signal-to-noise ratio. noise is scaled so its RMS sits snr_db below signal’s RMS before the two are summed. A 1e-8 floor on the noise RMS keeps zero-valued noise inputs finite. Both inputs must share channel count, sample count, sample rate, and layout. Errors Returns an error when snr_db is non-finite, the inputs’ audio contract differs, or an intermediate operation fails.
Generate deterministic Philox noise matching input’s shape, rate, and layout. The same (seed, distribution, amplitude) triple always produces the same samples, which keeps augmentation recipes replayable across runs and languages. Errors Returns an error when amplitude is negative or non-finite, or noise generation/allocation fails.
Normalize global peak or RMS level to the configured decibel target.
Right-pad input with silence to exactly samples per channel. Errors Returns an error when samples is smaller than the input length; use crop_to to shorten instead. Allocation or dispatch failures propagate.
Apply y[n] = x[n] - alpha*x[n-1] independently per channel.
Resample planar audio using the donor windowed-sinc gather kernel.
Render a finite zero-state Schroeder reverberation tail.
Apply tanh soft clipping with a dry/wet mix.
Encode and write one lossless IEEE-float WAV file. This is an explicit blocking host-observation and filesystem boundary. Errors Returns an error for an empty path, failed readback or encoding, or a host filesystem write failure.
Apply one to 64 stable biquad sections as a zero-state cascade.
Stack clips as consecutive channel rows, producing one batched [total_channels, samples] audio. All inputs must share sample rate, sample count, and channel layout; use pad_to or crop_to first for variable-length sources. Item i’s channels occupy the contiguous rows following items 0..i, which keeps per-item channel grouping recoverable from the layouts. Errors Returns an error for an empty input list, mismatched metadata, or a failing concatenate dispatch.
Compute magnitude STFT features in [channels, frames, frequency_bins] layout.
Compute complex STFT coefficients in [channels, frames, frequency_bins, 2] interleaved real/imaginary layout.
Average all channels into one mono channel.
Reduce multichannel audio to [bins, 2] minimum/maximum pairs.
Types
27 members
Whole-audio value backed by a planar FP32 [channels, samples] matrix. Clones retain the same matrix storage and semantic audio metadata.
10 members
3 members
One contiguous run of captured interleaved FP32 frames.
Source9 members
Stateful deterministic PCM-S16 audio encoder. Input is interleaved FP32. Complete configured packets are emitted by encode; flush emits a final partial packet. close deliberately discards an unflushed partial packet, matching the donor lifecycle contract. Dropping the encoder only releases host state and never flushes implicitly.
Source19 members
Incremental decoded PCM playback through the default output device.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
Open the source and default output device with decoding initially paused. Errors Returns an error for an empty URI, a ring outside 40–5000 ms, or when the selected audio track and output device cannot be opened.
4 members
Real, a0-normalized coefficients for one stable biquad section.
Source4 members
Inverse STFT configuration; sample_rate labels the reconstructed audio.
SourceEnums
Speaker layout carried by an Audio value.
Mono · Stereo · Stereo21 · Surround51 · Surround71 · Unknown