Crate audioviz

source ·
Expand description

Audioviz is a simple and easy to use library that helps you visualise raw audio-data

It consists of multiple modules:

  • fft Fast Fourier Transform algorithm, which transforms audio-data to a representation in the frequency domain.
  • spectrum high level and easier to use abstraction over fft
  • distributor distributes big buffers into smaller ones. Results in much smoother output of distributor when applied.
  • audio_capture captures system audio using CPAL.

Code Example with spectrum

 use audioviz::io::{Input, Device};
 use audioviz::spectrum::{Frequency, config::{StreamConfig, ProcessorConfig, Interpolation}, stream::Stream};

 // captures audio from system using cpal
 let mut audio_input = Input::new();
 let (channel_count, sampling_rate, input_controller) = audio_input.init(&Device::DefaultInput, None).unwrap();

 // spectrum visualizer stream
 let mut stream: Stream = Stream::new(StreamConfig::default());
 loop {
     if let Some(data) = input_controller.pull_data() {
         stream.push_data(data);
         stream.update();
     }

     let frequencies = stream.get_frequencies();

     break; // otherwise unittest wont return
 }

Modules

  • Fast Fourier Transform algorithm necessary to transform audio-data to a representation in the frequency domain
  • high level and easier to use abstraction over fft
  • general utilities that help to process audio data