Crate dasp_signal

Source
Expand description

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.

You may also find a series of Signal source functions, including:

  • equilibrium for generating “silent” frames.
  • phase for a stepping phase, useful for oscillators.
  • sine for generating a sine waveform.
  • saw for generating a sawtooth waveform.
  • square for generating a square waveform.
  • noise for generating a noise waveform.
  • noise_simplex for generating a 1D simplex noise waveform.
  • gen for generating frames of type F from some Fn() -> F.
  • gen_mut for generating frames of type F from some FnMut() -> F.
  • from_iter for converting an iterator yielding frames to a signal.
  • from_interleaved_samples_iter for converting an iterator yielding interleaved samples to a signal.

Working with Signals allows for easy, readable creation of rich and complex DSP graphs with a simple and familiar API.

§Optional Features

  • The boxed feature (or signal-boxed feature if using dasp) provides a Signal implementation for Box<dyn Signal>.
  • The bus feature (or signal-bus feature if using dasp) provides the SignalBus trait.
  • The envelope feature (or signal-envelope feature if using dasp) provides the SignalEnvelope trait.
  • The rms feature (or signal-rms feature if using dasp) provides the SignalRms trait.
  • The window feature (or signal-window feature if using dasp) provides the window module.

§no_std

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.

Modules§

Structs§

  • An iterator that yields the sum of the frames yielded by both other and self in lock-step.
  • One of the two Branch signals returned by Fork::by_rc.
  • One of the two Branch signals returned by Fork::by_rc.
  • One of the two Branch signals returned by Fork::by_ref.
  • One of the two Branch signals returned by Fork::by_ref.
  • Buffers the signal using the given ring buffer.
  • An iterator that pops elements from the inner bounded ring buffer and yields them.
  • Clips samples in each frame yielded by signal to the given threshhold amplitude.
  • A constant phase step size.
  • Delays the signal by the given number of frames.
  • An iterator that endlessly yields Frames of type F at equilibrium.
  • Represents a forked Signal that has not yet been split into its two branches.
  • An iterator that converts an iterator of Samples to an iterator of Frames.
  • A type that wraps an Iterator and provides a Signal implementation for it.
  • A signal that generates frames using the given function.
  • A signal that generates frames using the given function which may mutate some state.
  • An iterator that yields the step size for a phase.
  • A signal that calls its enclosing function and returns the original value. The signal may mutate state.
  • Converts a Signal to a type that yields the individual interleaved samples.
  • Converts the IntoInterleavedSamples into an Iterator that always returns Some.
  • A signal that maps from one signal to another
  • An iterator that yields the product of the frames yielded by both other and self in lock-step.
  • Multiplies the rate at which frames of self are yielded by the given signal.
  • A noise signal generator.
  • A 1D simplex-noise generator.
  • Provides an iterator that offsets the amplitude of every channel in each frame of the signal by some sample value and yields the resulting frames.
  • An Iterator that scales the amplitude of every Frame in self by the respective amplitudes in each channel of the given amp Frame.
  • An iterator that yields a phase, useful for waveforms like Sine or Saw.
  • The rate at which phrase a Signal is sampled.
  • A saw wave signal generator.
  • An Iterator that scales the amplitude of the sample of each channel in every Frame yielded by self by the given amplitude.
  • An Iterator that scales the amplitude of every Frame in self by the respective amplitudes in each channel of the given amp Frame.
  • A sine wave signal generator.
  • A square wave signal generator.
  • An iterator that yields n number of Frames from the inner signal.
  • Yields frames from the signal until the signal.is_exhausted() returns true.
  • A signal that iterates two signals in parallel and combines them with a function.

Traits§

  • Types that yield Frames of a one-or-more-channel PCM signal.
  • Types that may be used to give a phase step size based on some hz / sample rate.

Functions§

  • Provides an iterator that endlessly yields Frames of type F at equilibrium.
  • Create a new Signal from the given Frame-yielding Iterator.
  • Create a new Signal from the given Frame-yielding Iterator.
  • A signal that generates frames using the given function.
  • A signal that generates frames using the given function which may mutate some state.
  • Consumes the given Iterator, converts it to a Signal, applies the given function to the Signal and returns an Iterator that will become exhausted when the consumed Iterator does.
  • Produces a Signal that yields random values between -1.0..1.0.
  • Produces a 1-dimensional simplex noise Signal.
  • Creates a Phase that continuously steps forward by the given step size yielder.
  • Creates a frame Rate (aka sample rate) representing the rate at which a signal may be sampled.
  • Produces a Signal that yields a saw wave oscillating at the given hz.
  • Produces a Signal that yields a sine wave oscillating at the given hz.
  • Produces a Signal that yields a square wave oscillating at the given hz.