pub struct DecodedAudio {
pub samples: Vec<f32>,
pub sample_rate: u32,
pub channels: u8,
pub bit_depth: u16,
pub duration_sec: f64,
}Expand description
Decoded audio data with normalized samples and metadata.
All samples are normalized to the range [-1.0, 1.0] regardless of the source bit depth. This normalization enables consistent processing across different audio formats and bit depths.
Fields§
§samples: Vec<f32>Normalized audio samples in the range [-1.0, 1.0]. For stereo audio, samples are interleaved (L, R, L, R, …).
sample_rate: u32Sample rate in Hz (e.g., 44100, 48000).
channels: u8Number of audio channels (1 = mono, 2 = stereo).
bit_depth: u16Bit depth of the source PCM data (e.g., 16, 24).
duration_sec: f64Total duration in seconds, calculated from sample count and rate.
Implementations§
Source§impl DecodedAudio
impl DecodedAudio
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Total number of audio frames (samples per channel).
For stereo audio with 1000 total samples, this returns 500 frames.
Sourcepub fn is_normalized(&self) -> bool
pub fn is_normalized(&self) -> bool
Verify all samples are within normalized bounds [-1.0, 1.0].
Returns true if all samples are properly normalized.
Trait Implementations§
Source§impl Clone for DecodedAudio
impl Clone for DecodedAudio
Source§fn clone(&self) -> DecodedAudio
fn clone(&self) -> DecodedAudio
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more