#audio-samples #source #visualization #fetcher #cpal #shady

shady-audio

A high level library build upon cpal to retrieve audio for visualisation

31 releases (16 major breaking)

17.0.1 Aug 12, 2025
16.0.0 May 26, 2025
15.0.0 May 24, 2025
14.0.0 May 9, 2025
0.1.2 Dec 31, 2024

#464 in Audio

Download history 33/week @ 2025-08-05 191/week @ 2025-08-12 14/week @ 2025-08-19 1/week @ 2025-08-26 1/week @ 2025-09-02 1/week @ 2025-09-09 1/week @ 2025-09-23 6/week @ 2025-09-30

1,570 downloads per month
Used in 2 crates

GPL-3.0-or-later

60KB
1.5K SLoC

shady-audio is the audio backend for the other shady tools. Its interface let's you easily fetch the frequency presence of the given audio source by selecting an audio source which implemented the Fetcher trait.

Example

use std::num::NonZero;
use shady_audio::{SampleProcessor, BarProcessor, BarProcessorConfig, fetcher::DummyFetcher};

let mut sample_processor = SampleProcessor::new(DummyFetcher::new());

let mut bar_processor = BarProcessor::new(
    &sample_processor,
    BarProcessorConfig {
        amount_bars: NonZero::new(20).unwrap(),
        ..Default::default()
    }
);
let mut bar_processor2 = BarProcessor::new(
    &sample_processor,
    BarProcessorConfig {
        amount_bars: NonZero::new(10).unwrap(),
        ..Default::default()
    }
);

loop {
    // the sample processor needs to compute the new samples only once
    // for both bar processors (to reduce computation)
    sample_processor.process_next_samples();

    let bars = bar_processor.process_bars(&sample_processor);
    let bars2 = bar_processor2.process_bars(&sample_processor);

    assert_eq!(bars.len(), 20);
    assert_eq!(bars2.len(), 10);

    break;
}

Dependencies

~7–38MB
~520K SLoC