[][src]Crate dasp

dasp (formerly known as sample) is a suite of crates providing the fundamentals for working with pulse-code modulation digital audio signal processing. In other words, dasp provides a suite of low-level, high-performance tools including types, traits and functions for working with digital audio signals.

Each of the dasp crates are re-exported under their respective modules.


The following are some of the more interesting items within the dasp collection:

Optional Features

By default, only the sample and frame modules and their respective traits are included within this crate. You may pick and choose between the following features for additional functionality.

  • The all feature enables all of the following features.
  • The std feature enables the std library. This is enabled by default.
  • The all-no-std feature enables all of the following features (without std).

The following features map to each of the sub-crates and their respective features.

  • The envelope feature enables the dasp_envelope crate via the envelope module.
    • The envelope-peak feature enables peak envelope detection.
    • The envelope-rms feature enables RMS envelope detection.
  • The interpolate feature enables the dasp_interpolate crate via the interpolate module.
    • The interpolate-floor feature enables a floor interpolation implementation.
    • The interpolate-linear feature enables a linear interpolation implementation.
    • The interpolate-sinc feature enables a sinc interpolation implementation.
  • The peak feature enables the dasp_peak crate via the peak module.
  • The ring_buffer feature enables the dasp_ring_buffer crate via the ring_buffer module.
  • The rms feature enables the dasp_rms crate via the rms module.
  • The signal feature enables the dasp_signal crate via the signal module.
    • The signal-boxed feature enables an implementation of Signal for Box<dyn Signal>.
    • The signal-bus feature enables the SignalBus trait.
    • The signal-envelope feature enables the SignalEnvelope trait.
    • The signal-rms feature enables the SignalRms trait.
    • The signal-window feature enables the signal::window module.
    • The signal-window-hanning enables the signal::window::hanning window constructor.
    • The signal-window-rectangle enables the signal::window::rectangle window constructor.
  • The slice feature enables the dasp_slice crate via the slice module.
    • The slice-boxed feature enables boxed slice conversion traits and functions.
  • The window feature enables the dasp_window crate via the window module.
    • The window-hanning feature enables the Hanning window implementation.
    • The window-rectangle feature enables the Rectangle window implementation.

You can also enable all of the above features with the --all-features flag.


If working in a no_std context, you can disable the default std feature with --no-default-features.

To enable all of the above features in a no_std context, enable the all-no-std feature.



An abstraction supporting different kinds of envelope detection.


Use the Frame trait to remain generic over the number of channels at a single discrete moment in time.


An abstraction for sample/frame rate interpolation.


Peak envelope detection over a signal.


Items related to the implementation of ring buffers.


Root mean square calculation over a signal.


Use the Sample trait to remain generic over sample types, easily access sample type conversions, apply basic audio operations and more.


Use the Signal trait to abstract over infinite-iterator-like types that yield Frames. The Signal trait provides methods for adding, scaling, offsetting, multiplying, clipping, generating frame iterators and more.


For working with slices of PCM audio data.


Module for windowing over a batch of Frames. Includes default Hanning and Rectangle window types.



Represents one sample from each channel at a single discrete instance in time within a PCM signal.


A trait for working generically across different Sample format types.


Types that yield Frames of a one-or-more-channel PCM signal.