Sonogram
Create a sonogram* from an wave form, or importing a .wav
file.
The spectrogram can be saved as a .png
file, a .csv
file, or
stored in memory. An example command line application is included
that converts .wav
files to .png
spectrograms.
Example output .png
:
*Note: sonogram, spectrograph, spectrogram, or power spectral density plots are common names of similar things.
Build and run the command line appplication
Saving to a .png
file
let waveform: = vec!;
// Build the model
let spectrograph = new
.load_data_from_memory
.build.unwrap;
// Compute the spectrogram giving the number of bins and the window overlap.
spectrograph.compute;
// Specify a colour gradient to use (note you can create custom ones)
let mut gradient = create;
// Save the spectrogram to PNG.
let png_file = new;
spectrograph.to_png.unwrap;
Customise the colour gradient
For .png
images you can customise the colour gradient:
let mut gradient = new;
gradient.add_colour; // Black
gradient.add_colour; // Purple
gradient.add_colour; // Blue
gradient.add_colour; // Cyan
gradient.add_colour; // Green
spec_builder.set_gradient;
Or use a built-in colour gradient theme:
let mut gradient = rainbow_theme;
spec_builder.set_gradient;
License
This source is released under the GPLv3 license. Read the LICENSE file for legal information.