pub struct Audio { /* private fields */ }Expand description
Immutable decoded audio in [frames, channels] tensor order.
Samples are finite F32 or F64 values. Their amplitude is not clamped, so intermediate processing can retain headroom. Zero-frame blocks are valid; channel count and sample rate still describe their intended decoded layout.
Implementations§
Source§impl Audio
impl Audio
Sourcepub fn new(sample_rate: u32, samples: Tensor) -> Result<Self, DataError>
pub fn new(sample_rate: u32, samples: Tensor) -> Result<Self, DataError>
Validates a sample block with 1..=32 channels and a 1..=384000 Hz rate.
§Errors
Rejects unsupported sample types, rank, channel count, or sample rate.
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Frames per second, shared by every channel.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Audio
impl<'de> Deserialize<'de> for Audio
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Audio
Auto Trait Implementations§
impl Freeze for Audio
impl RefUnwindSafe for Audio
impl Send for Audio
impl Sync for Audio
impl Unpin for Audio
impl UnsafeUnpin for Audio
impl UnwindSafe for Audio
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more