#audio #points #fetcher #non-zero-usize #wgpu #shader #shady-audio #shady-audio-config #shaderlabs

shady-audio

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

26 releases (12 major breaking)

13.0.0 Apr 7, 2025
12.0.0 Apr 6, 2025
11.0.0 Apr 6, 2025
10.0.0 Apr 3, 2025
0.1.2 Dec 31, 2024

#105 in Graphics APIs

Download history 170/week @ 2025-01-01 8/week @ 2025-01-08 211/week @ 2025-02-05 147/week @ 2025-02-12 1040/week @ 2025-02-19 107/week @ 2025-02-26 468/week @ 2025-03-05 79/week @ 2025-03-12 4/week @ 2025-03-19 123/week @ 2025-03-26 884/week @ 2025-04-02 94/week @ 2025-04-09 26/week @ 2025-04-16

1,128 downloads per month
Used in 2 crates

GPL-3.0-or-later

52KB
1K 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::NonZeroUsize;

use shady_audio::{ShadyAudio, fetcher::DummyFetcher, config::ShadyAudioConfig};

let mut audio = {
    // A fetcher feeds new samples to `ShadyAudio` which processes it
    let fetcher = DummyFetcher::new();

    // configure the behaviour of `ShadyAudio`
    let config = ShadyAudioConfig {
        amount_bars: NonZeroUsize::new(10).unwrap(),
        ..Default::default()
    };

    ShadyAudio::new(fetcher, config).unwrap()
};

// just retrieve the bars.
// ShadyAudio takes care of the rest:
//   - fetching new samples from the fetcher
//   - normalize the values within the range [0, 1]
//   - etc.
assert_eq!(audio.get_bars().len(), 10);

// change the amount of bars you'd like to have
audio.set_bars(NonZeroUsize::new(20).unwrap());
assert_eq!(audio.get_bars().len(), 20);

Dependencies

~7–38MB
~513K SLoC