Realm

Audio

Semantic audio values, stateful sessions, codecs, and signal operations.

Generated from rustdocNative Rust surface32 functions20 types6 enums0 constants & variables
This inventory is generated from public rustdoc declarations. Modules, structs, enums, traits, aliases, signatures, source comments, and source links follow the native Rust API.

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.

Source
10 members
9 members
19 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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method
Source

Enums

Speaker layout carried by an Audio value.

Mono · Stereo · Stereo21 · Surround51 · Surround71 · Unknown

Functions

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.

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.

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.

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.

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.

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 complex STFT coefficients in [channels, frames, frequency_bins, 2] interleaved real/imaginary layout.

Types

27 members

Whole-audio value backed by a planar FP32 [channels, samples] matrix. Clones retain the same matrix storage and semantic audio metadata.

Source
10 members
3 members
4 members
4 members
9 members
19 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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method

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.

method
Source
4 members
4 members
3 members
4 members
4 members
4 members
4 members
4 members
4 members

Enums

Speaker layout carried by an Audio value.

Mono · Stereo · Stereo21 · Surround51 · Surround71 · Unknown

Elementary audio representation produced by AudioEncoder.

PcmS16

Noise distribution used by noise_like.

Uniform · Gaussian

Global level estimator used by normalize.

Peak · Rms

Window function applied before each FFT frame.

Hann · Hamming · Blackman · Rectangular