[][src]Struct sonogram::spectrograph::Spectrograph

pub struct Spectrograph { /* fields omitted */ }

This contains all the initialised data. This can then produce the spectrogram, and if necessary, save it to the filesystem as a PNG image.

This Spectrograph is created by SpecOptionsBuilder.

Example

let mut spectrograph = SpecOptionsBuilder::new(512, 128) .load_data_from_file(&std::path::Path::new(wav_file)) .build();

spectrograph.compute(2048, 0.8); spectrograph.save_as_png(&std::path::Path::new(png_file), false);

Methods

impl Spectrograph[src]

pub fn omega(&self, p: f32, q: f32) -> Complex<f32>[src]

pub fn compute(&mut self, chunk_len: usize, overlap: f32)[src]

Do the discrete fourier transform to create the spectrogram.

Arguments

  • chunk_len - How long fourier transform window should be.
  • overlap - By how much (of a chunk) the fourier transform windows overlap. It must be value between 0.0 and 1.0.

pub fn save_as_png(&mut self, fname: &Path, log_mode: bool)[src]

Save the calculated spectrogram as a PNG image.

Arguments

  • fname - The path to the PNG to save to the filesystem.
  • log_mode - Apply the log function to the frequency scale.

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.