#frequency #source #fetcher #visualization #retrieve #interface

shady-audio

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

16 stable releases (5 major)

new 6.0.0 Mar 11, 2025
5.0.2 Mar 5, 2025
4.0.3 Feb 24, 2025
3.2.1 Feb 21, 2025
0.1.2 Dec 31, 2024

#117 in Audio

Download history 209/week @ 2024-12-29 30/week @ 2025-01-05 2/week @ 2025-01-12 321/week @ 2025-02-09 804/week @ 2025-02-16 322/week @ 2025-02-23 411/week @ 2025-03-02 169/week @ 2025-03-09

1,728 downloads per month
Used in 2 crates

GPL-3.0-or-later

49KB
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–34MB
~521K SLoC