#audio #visualizer #waveform #spectrum


Super basic and simple audio visualization library which is especially useful for developers to visually check audio samples, e.g. by waveform or spectrum. (So far) this library is not capable of doing nice visualizations for end users.

10 releases

new 0.2.4 Sep 14, 2021
0.2.3 Sep 14, 2021
0.2.2 Mar 28, 2021
0.1.4 Mar 11, 2021

#40 in Audio

49 downloads per month
Used in 2 crates

MIT license

554 lines

Rust library: audio-visualizer

So far this library is really simple and mainly targets developers that develop audio algorithms. With this library you can easily display your current audio data/waveform/spectrum and check if everything looks good. Functionality is really limited and follow the KISS (keep it simple, stupid) principle. Code contributions are very welcome!

Example of a waveform

Example visualization of a waveform

Example of a spectrum

Example visualization of a spectrum (0-140hz)

Covered Functionality

  • waveform

    • dynamic: live visualization to audio input stream
      • TODO: code contributions are welcome
    • static: visualization of a single, static sample
  • spectrum

    • dynamic: visualization of a single, static sample
      • TODO: code contributions are welcome
    • static: visualization of a single, static sample
      • very basic PNG output with the option to highlight specific frequencies
      • PNG output with basic axes/labels using https://crates.io/crates/plotters
      • TODO fancy static output

Example code

use minimp3::{Decoder as Mp3Decoder, Frame as Mp3Frame, Error as Mp3Error};
use audio_visualizer::ChannelInterleavement;
use audio_visualizer::Channels;
use audio_visualizer::waveform::staticc::png_file::visualize;
use std::path::PathBuf;
use std::fs::File;

/// Example that reads MP3 audio data and prints the waveform to a PNG file.
fn main() {
    let mut path = PathBuf::new();
    let mut decoder = Mp3Decoder::new(File::open(path).unwrap());

    let mut lrlr_mp3_samples = vec![];
    loop {
        match decoder.next_frame() {
            Ok(Mp3Frame { data: samples_of_frame, .. }) => {
                for sample in samples_of_frame {
            Err(Mp3Error::Eof) => break,
            Err(e) => panic!("{:?}", e),

    // library function


~91K SLoC