Struct sonogram::SpecOptionsBuilder
source ·
[−]pub struct SpecOptionsBuilder { /* private fields */ }
Expand description
A builder struct that will output a spectrogram creator when complete.
This builder will require the height and width of the final spectrogram,
at a minimum. However you can load data from a .wav file, or directly
from a Vec
Example
let mut spectrograph = SpecOptionsBuilder::new(512, 128)
.set_window_fn(utility::blackman_harris)
.load_data_from_file(&std::path::Path::new("test.wav"))?
.build();
Implementations
Create a new SpecOptionsBuilder. The final height and width of
the spectrogram must be supplied. Before the build
function
can be called a load_data_from_*
function needs to be called.
Arguments
width
- The final width of the spectrogram.height
- The final height of the spectrogram.
A window function describes the type of window to use during the DFT (discrete fourier transform). See (here)[https://en.wikipedia.org/wiki/Window_function] for more details.
Arguments
window
- The window function to be used.
Load data directly from memory - i16 version.
Arguments
data
- The raw wavform data that will be converted to a spectrogram.sample_rate
- The sample rate, in Hz, of the data.
Load data directly from memory - f32 version.
Arguments
data
- The raw wavform data that will be converted to a spectrogram.sample_rate
- The sample rate, in Hz, of the data.
Down sample the data by the given divisor. This is a cheap way of improving the performance of the FFT.
Arguments
divisor
- How much to reduce the data by.
Last method to be called. This will calculate the colour gradients and
generate an instance of Spectrograph
.