pub struct Spectrum<T: Float> {
pub num_frames: usize,
pub freq_bins: usize,
pub data: Vec<T>,
}Fields§
§num_frames: usize§freq_bins: usize§data: Vec<T>Implementations§
Source§impl<T: Float> Spectrum<T>
impl<T: Float> Spectrum<T>
pub fn new(num_frames: usize, freq_bins: usize) -> Self
pub fn real(&self, frame: usize, bin: usize) -> T
pub fn imag(&self, frame: usize, bin: usize) -> T
pub fn get_complex(&self, frame: usize, bin: usize) -> Complex<T>
pub fn frames(&self) -> impl Iterator<Item = SpectrumFrame<T>> + '_
Sourcepub fn set_complex(&mut self, frame: usize, bin: usize, value: Complex<T>)
pub fn set_complex(&mut self, frame: usize, bin: usize, value: Complex<T>)
Set a bin from a complex value
Sourcepub fn set_magnitude_phase(
&mut self,
frame: usize,
bin: usize,
magnitude: T,
phase: T,
)
pub fn set_magnitude_phase( &mut self, frame: usize, bin: usize, magnitude: T, phase: T, )
Set a frequency bin from magnitude and phase
Sourcepub fn frame_magnitudes(&self, frame: usize) -> Vec<T>
pub fn frame_magnitudes(&self, frame: usize) -> Vec<T>
Get all magnitudes for a frame
Sourcepub fn frame_phases(&self, frame: usize) -> Vec<T>
pub fn frame_phases(&self, frame: usize) -> Vec<T>
Get all phases for a frame
Sourcepub fn apply_gain(&mut self, bin_range: Range<usize>, gain: T)
pub fn apply_gain(&mut self, bin_range: Range<usize>, gain: T)
Apply a gain to a range of bins across all frames
Trait Implementations§
impl<T: Float> StructuralPartialEq for Spectrum<T>
Auto Trait Implementations§
impl<T> Freeze for Spectrum<T>
impl<T> RefUnwindSafe for Spectrum<T>where
T: RefUnwindSafe,
impl<T> Send for Spectrum<T>where
T: Send,
impl<T> Sync for Spectrum<T>where
T: Sync,
impl<T> Unpin for Spectrum<T>where
T: Unpin,
impl<T> UnwindSafe for Spectrum<T>where
T: UnwindSafe,
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