Struct sonogram::Spectrogram
source · [−]pub struct Spectrogram { /* private fields */ }
Implementations
sourceimpl Spectrogram
impl Spectrogram
sourcepub fn to_png(
&mut self,
fname: &Path,
freq_scale: FrequencyScale,
gradient: &mut ColourGradient,
w_img: usize,
h_img: usize
) -> Result<(), Error>
pub fn to_png(
&mut self,
fname: &Path,
freq_scale: FrequencyScale,
gradient: &mut ColourGradient,
w_img: usize,
h_img: usize
) -> Result<(), Error>
Save the calculated spectrogram as a PNG image.
Arguments
fname
- The path to the PNG to save to the filesystem.freq_scale
- The type of frequency scale to use for the spectrogram.gradient
- The colour gradient to use for the spectrogram.w_img
- The output image width.h_img
- The output image height.
sourcepub fn to_png_in_memory(
&mut self,
freq_scale: FrequencyScale,
gradient: &mut ColourGradient,
w_img: usize,
h_img: usize
) -> Result<Vec<u8>, Error>
pub fn to_png_in_memory(
&mut self,
freq_scale: FrequencyScale,
gradient: &mut ColourGradient,
w_img: usize,
h_img: usize
) -> Result<Vec<u8>, Error>
Create the spectrogram in memory as a PNG.
Arguments
freq_scale
- The type of frequency scale to use for the spectrogram.gradient
- The colour gradient to use for the spectrogram.w_img
- The output image width.h_img
- The output image height.
sourcepub fn to_rgba_in_memory(
&mut self,
freq_scale: FrequencyScale,
gradient: &mut ColourGradient,
w_img: usize,
h_img: usize
) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn to_rgba_in_memory(
&mut self,
freq_scale: FrequencyScale,
gradient: &mut ColourGradient,
w_img: usize,
h_img: usize
) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Create the spectrogram in memory as raw RGBA format.
Arguments
freq_scale
- The type of frequency scale to use for the spectrogram.gradient
- The colour gradient to use for the spectrogram.w_img
- The output image width.h_img
- The output image height.
sourcepub fn to_csv(
&mut self,
fname: &Path,
freq_scale: FrequencyScale,
cols: usize,
rows: usize
) -> Result<(), Error>
pub fn to_csv(
&mut self,
fname: &Path,
freq_scale: FrequencyScale,
cols: usize,
rows: usize
) -> Result<(), Error>
Save the calculated spectrogram as a CSV file.
Arguments
fname
- The path to the CSV to save to the filesystem.freq_scale
- The type of frequency scale to use for the spectrogram.cols
- The number of columns.rows
- The number of rows.
sourcepub fn to_buffer(
&self,
freq_scale: FrequencyScale,
img_width: usize,
img_height: usize
) -> Vec<f32>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn to_buffer(
&self,
freq_scale: FrequencyScale,
img_width: usize,
img_height: usize
) -> Vec<f32>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Map the spectrogram to the output buffer. Essentially scales the frequency to map to the vertical axis (y-axis) of the output and scale the x-axis to match the output. It will also convert the spectrogram to dB.
Arguments
freq_scale
- The type of frequency scale to use for the spectrogram.img_width
- The output image width.img_height
- The output image height.
Auto Trait Implementations
impl RefUnwindSafe for Spectrogram
impl Send for Spectrogram
impl Sync for Spectrogram
impl Unpin for Spectrogram
impl UnwindSafe for Spectrogram
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more