pub struct Spectrogram { /* private fields */ }Expand description
Implementations§
Source§impl Spectrogram
impl Spectrogram
pub fn raw_magnitude(&self) -> Array3<f64>
pub fn raw_magnitude_db(&self, floor_db: f64) -> Array3<f64>
pub fn amplitude_spectrum(&self) -> Array3<f64>
pub fn amplitude_spectrum_db(&self, floor_db: f64) -> Array3<f64>
pub fn power_spectrum(&self) -> Array3<f64>
pub fn power_spectrum_db(&self, floor_db: f64) -> Array3<f64>
pub fn power_spectral_density(&self) -> Array3<f64>
pub fn power_spectral_density_db(&self, floor_db: f64) -> Array3<f64>
Source§impl Spectrogram
impl Spectrogram
Sourcepub fn new(
data: Array3<Complex64>,
sample_rate: f64,
window_size: usize,
hop_size: usize,
window_fn: WindowFn,
) -> Result<Self, SignalError>
pub fn new( data: Array3<Complex64>, sample_rate: f64, window_size: usize, hop_size: usize, window_fn: WindowFn, ) -> Result<Self, SignalError>
Wrap STFT data, shape (num_channels, num_frames, num_freq_bins).
Frame f is centred at (f * hop_size + window_size / 2) / sample_rate
seconds and bin k sits at k * sample_rate / window_size Hz. The data
must have window_size / 2 + 1 bins, as a real FFT of that size gives.
The calibration gains are computed from window_fn, the periodic window
the frames were tapered with.
pub fn channel_label(&self, channel: usize) -> Option<&str>
pub fn set_channel_label(&mut self, channel: usize, label: Option<&str>)
pub fn num_channels(&self) -> usize
pub fn num_frames(&self) -> usize
pub fn num_freq_bins(&self) -> usize
pub fn sample_rate(&self) -> f64
pub fn window_size(&self) -> usize
pub fn hop_size(&self) -> usize
Sourcepub fn window_fn(&self) -> WindowFn
pub fn window_fn(&self) -> WindowFn
The window the frames were tapered with (its periodic form).
Sourcepub fn normalization(&self) -> SpectrogramNormalization
pub fn normalization(&self) -> SpectrogramNormalization
Calibration gains of window_fn at
window_size samples.
Sourcepub fn frame_times(&self) -> CowArray<'_, f64, Ix1>
pub fn frame_times(&self) -> CowArray<'_, f64, Ix1>
Center time of each STFT frame in seconds. Computed on each call; use
frame_axis for single values.
Sourcepub fn frame_axis(&self) -> &XAxis
pub fn frame_axis(&self) -> &XAxis
Frame time axis in seconds, without allocating.
Sourcepub fn freq_bins(&self) -> CowArray<'_, f64, Ix1>
pub fn freq_bins(&self) -> CowArray<'_, f64, Ix1>
Frequency bin centers in Hz. Computed on each call; use
freq_axis for single values.
Sourcepub fn data(&self) -> ArrayView3<'_, Complex64>
pub fn data(&self) -> ArrayView3<'_, Complex64>
Raw complex STFT data, shape (num_channels, num_frames, num_freq_bins).
Sourcepub fn channel(&self, ch: usize) -> ArrayView2<'_, Complex64>
pub fn channel(&self, ch: usize) -> ArrayView2<'_, Complex64>
Complex STFT data for a single channel, shape (num_frames, num_freq_bins).
Sourcepub fn frame(&self, t: usize) -> ArrayView2<'_, Complex64>
pub fn frame(&self, t: usize) -> ArrayView2<'_, Complex64>
Complex STFT data for a single frame, shape (num_channels, num_freq_bins).
Trait Implementations§
Source§impl Clone for Spectrogram
impl Clone for Spectrogram
Source§impl Debug for Spectrogram
impl Debug for Spectrogram
Source§impl<'de> Deserialize<'de> for Spectrogram
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Spectrogram
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for Spectrogram
impl Display for Spectrogram
Source§impl PartialEq for Spectrogram
impl PartialEq for Spectrogram
Source§impl Serialize for Spectrogram
Available on crate feature serde only.Stored form: the data plus what cannot be derived from it. Frame times,
frequency bins and calibration gains are rebuilt when reading, through
Spectrogram::new.
impl Serialize for Spectrogram
serde only.Stored form: the data plus what cannot be derived from it. Frame times,
frequency bins and calibration gains are rebuilt when reading, through
Spectrogram::new.
impl StructuralPartialEq for Spectrogram
Auto Trait Implementations§
impl Freeze for Spectrogram
impl RefUnwindSafe for Spectrogram
impl Send for Spectrogram
impl Sync for Spectrogram
impl Unpin for Spectrogram
impl UnsafeUnpin for Spectrogram
impl UnwindSafe for Spectrogram
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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> ⓘ
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