audio-visualizer

Crates.ioaudio-visualizer
lib.rsaudio-visualizer
version0.4.0
sourcesrc
created_at2021-03-10 23:15:58.783482
updated_at2023-09-21 19:14:12.782045
descriptionSmple 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.
homepagehttps://github.com/phip1611/audio-visualizer
repositoryhttps://github.com/phip1611/audio-visualizer
max_upload_size
id367002
size189,387
Philipp Schuster (phip1611)

documentation

https://docs.rs/audio-visualizer/

README

Rust library: audio-visualizer

So far this library is rather basic and 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/as expected.

Covered Functionality

  • dynamic real-time audio

    • functionality to record audio and connect it with a GUI window
    • side-by-side (top/btm) view of original waveform and custom view (e.g. spectrum or lowpass filter)
    • cross-platform (Windows with WASAPI, Linux with ALSA, MacOS with coreaudio)
  • static waveform

  • static spectrum

    • very basic PNG output with the option to highlight specific frequencies (definitely needs more work, code contributions are welcome)
    • PNG output with basic axes/labels using https://crates.io/crates/plotters (definitely needs more work, code contributions are welcome)
    • TODO fancy static output (code contributions are welcome)

(Code) Examples

There are several examples in the examples/ directory. Below, you can see some visualization examples.

Real-time audio + lowpass filter (6.9MB GIF)

Example visualization of real-time audio + lowpass filter
On the top you see the original waveform of the song Holiday by Green Day. On the bottom you see the data after a lowpass filter was applied. The beats are visible.

Real-time audio + frequency spectrum (5.4MB GIF)

Example visualization of real-time audio + spectrum analysis
On the top you see the original waveform of the song Holiday by Green Day. On the bottom you see the frequency spectrum of the latest 46ms of audio. Frequencies <2000Hz are clearly present.

Example of a static waveform

Example visualization of a waveform

Example of a static spectrum

Example visualization of a spectrum (0-140hz)

MSRV

The MSRV is 1.63.0 stable.

Troubleshooting

Linux

  • make sure to have these required packages installed: sudo apt install libasound2-dev libxkbcommon-dev
Commit count: 55

cargo fmt