Skip to main content

Module audio_format

Module audio_format 

Source
Expand description

Audio format conversion and resampling utilities.

Provides sample rate conversion, format conversion, and audio processing. Resampling uses the rubato crate (feature-gated behind “resample”).

Structs§

AudioFormat
Audio format specification

Functions§

concat_audio
Concatenate multiple audio chunks with optional crossfade.
f32_to_i16
Convert f32 samples to i16 (with clamping)
fade_in
Apply a simple fade-in effect (linear amplitude ramp).
fade_out
Apply a simple fade-out effect (linear amplitude ramp).
i16_to_f32
Convert i16 samples to f32 (-1.0 to 1.0)
mono_to_stereo
Convert mono to stereo (duplicate channel)
normalize_peak
Normalize audio to a target peak level (in dB, e.g., -1.0 dB).
resample_linear
Resample audio from one sample rate to another. Uses linear interpolation (always available, no external deps).
rms_db
Compute RMS level in dB.
stereo_to_mono
Convert stereo to mono (average channels)
trim_silence
Trim silence from the beginning and end of audio.