pub struct Analyzer { /* private fields */ }Expand description
Incremental PCM analyzer. Push decoded audio in any block size, then finish.
Each channel is high-passed at 80 Hz for detection only, the channel powers are averaged, and every hop produces one frame level in dBFS over a window centered on that hop. Only the frame levels and digital-zero flags are kept, about 1.8 MB per hour at the default 10 ms hop. Samples that are not finite (NaN or infinite) are read as zero.
Implementations§
Source§impl Analyzer
impl Analyzer
Sourcepub fn new(layout: Layout, config: &AnalyzeConfig) -> Result<Self, ConfigError>
pub fn new(layout: Layout, config: &AnalyzeConfig) -> Result<Self, ConfigError>
An analyzer for audio with layout.
§Errors
ConfigError::ZeroSampleRate, ConfigError::ZeroChannels,
ConfigError::SampleRateTooLow if the rate is at or below 160 Hz,
ConfigError::HopTooShort if the hop rounds to zero samples, or
ConfigError::InvalidFrames if the hop exceeds u32::MAX samples.
Sourcepub fn push_interleaved<S: Sample>(&mut self, pcm: &[S])
pub fn push_interleaved<S: Sample>(&mut self, pcm: &[S])
Pushes interleaved samples. A trailing partial frame is kept until the next push.
Sourcepub fn push_planar<S: Sample>(&mut self, pcm: &[&[S]])
pub fn push_planar<S: Sample>(&mut self, pcm: &[&[S]])
Pushes one slice per channel.
§Panics
If the number of slices differs from the channel count, the slices differ in length, or a
partial interleaved frame from push_interleaved is pending.