pub struct SpectrogramConfig {
pub n_mels: usize,
pub n_fft: usize,
pub hop_length: usize,
pub sample_rate: u32,
pub f_min: f32,
pub f_max: f32,
pub log_scale: bool,
pub ref_db: f32,
pub min_value: f32,
}Expand description
Configuration for spectrogram computation.
Fields§
§n_mels: usizeNumber of mel frequency bands.
n_fft: usizeFFT window size in samples.
hop_length: usizeHop size between frames in samples.
sample_rate: u32Sample rate of the input audio.
f_min: f32Minimum frequency for mel filterbank (Hz).
f_max: f32Maximum frequency for mel filterbank (Hz).
log_scale: boolWhether to apply log scaling.
ref_db: f32Reference value for dB conversion.
min_value: f32Minimum value for log scaling (avoids log(0)).
Implementations§
Source§impl SpectrogramConfig
impl SpectrogramConfig
Sourcepub fn for_5s_segment() -> Self
pub fn for_5s_segment() -> Self
Creates a config optimized for 5-second segments producing 500 frames.
For 32kHz audio:
- 5s = 160,000 samples
- hop_length = 320 gives ~500 frames
Sourcepub fn with_target_frames(
target_frames: usize,
duration_ms: u64,
sample_rate: u32,
) -> Self
pub fn with_target_frames( target_frames: usize, duration_ms: u64, sample_rate: u32, ) -> Self
Creates a config for variable-length audio.
Trait Implementations§
Source§impl Clone for SpectrogramConfig
impl Clone for SpectrogramConfig
Source§fn clone(&self) -> SpectrogramConfig
fn clone(&self) -> SpectrogramConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SpectrogramConfig
impl Debug for SpectrogramConfig
Auto Trait Implementations§
impl Freeze for SpectrogramConfig
impl RefUnwindSafe for SpectrogramConfig
impl Send for SpectrogramConfig
impl Sync for SpectrogramConfig
impl Unpin for SpectrogramConfig
impl UnwindSafe for SpectrogramConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more