#waveform #spectrum #audio-samples #visualizer

bin+lib audio-visualizer

Smple 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.

13 releases

0.4.0 Sep 21, 2023
0.3.1 Nov 15, 2021
0.2.4 Sep 14, 2021
0.2.2 Mar 28, 2021
0.1.4 Mar 11, 2021

#399 in Audio

Download history 56/week @ 2024-07-21 26/week @ 2024-07-28 12/week @ 2024-08-04 17/week @ 2024-08-11 18/week @ 2024-08-18 17/week @ 2024-08-25 14/week @ 2024-09-01 26/week @ 2024-09-08 24/week @ 2024-09-15 45/week @ 2024-09-22 41/week @ 2024-09-29 3/week @ 2024-10-06 34/week @ 2024-10-13 17/week @ 2024-10-20 8/week @ 2024-10-27 30/week @ 2024-11-03

89 downloads per month
Used in 2 crates

MIT license

76KB
1K SLoC

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

Dependencies

~5–35MB
~525K SLoC