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 forBox<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§
- bus
- An extension to the Signal trait that enables multiple signal outputs.
- envelope
- An extension to the Signal trait that enables envelope detection.
- interpolate
- The Converter type for interpolating the rate of a signal.
- rms
- An extension to the Signal trait that monitors the RMS of a signal.
- window
- Items to ease the application of windowing functions to signals.
Structs§
- AddAmp
- An iterator that yields the sum of the frames yielded by both
otherandselfin lock-step. - Branch
RcA - One of the two
Branchsignals returned byFork::by_rc. - Branch
RcB - One of the two
Branchsignals returned byFork::by_rc. - Branch
RefA - One of the two
Branchsignals returned byFork::by_ref. - Branch
RefB - One of the two
Branchsignals returned byFork::by_ref. - Buffered
- Buffers the signal using the given ring buffer.
- Buffered
Frames - An iterator that pops elements from the inner bounded ring buffer and yields them.
- ClipAmp
- Clips samples in each frame yielded by
signalto the given threshhold amplitude. - ConstHz
- A constant phase step size.
- Delay
- Delays the
signalby the given number of frames. - Equilibrium
- An iterator that endlessly yields
Frames of typeFat equilibrium. - Fork
- Represents a forked
Signalthat has not yet been split into its two branches. - From
Interleaved Samples Iterator - An iterator that converts an iterator of
Samples to an iterator ofFrames. - From
Iterator - A type that wraps an Iterator and provides a
Signalimplementation for it. - Gen
- A signal that generates frames using the given function.
- GenMut
- A signal that generates frames using the given function which may mutate some state.
- Hz
- An iterator that yields the step size for a phase.
- Inspect
- A signal that calls its enclosing function and returns the original value. The signal may mutate state.
- Into
Interleaved Samples - Converts a
Signalto a type that yields the individual interleaved samples. - Into
Interleaved Samples Iterator - Converts the
IntoInterleavedSamplesinto anIteratorthat always returnsSome. - Map
- A signal that maps from one signal to another
- MulAmp
- An iterator that yields the product of the frames yielded by both
otherandselfin lock-step. - MulHz
- Multiplies the rate at which frames of
selfare yielded by the givensignal. - Noise
- A noise signal generator.
- Noise
Simplex - A 1D simplex-noise generator.
- Offset
Amp - 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.
- Offset
AmpPer Channel - An
Iteratorthat scales the amplitude of everyFrameinselfby the respective amplitudes in each channel of the givenampFrame. - Phase
- An iterator that yields a phase, useful for waveforms like Sine or Saw.
- Rate
- The rate at which phrase a Signal is sampled.
- Saw
- A saw wave signal generator.
- Scale
Amp - An
Iteratorthat scales the amplitude of the sample of each channel in everyFrameyielded byselfby the given amplitude. - Scale
AmpPer Channel - An
Iteratorthat scales the amplitude of everyFrameinselfby the respective amplitudes in each channel of the givenampFrame. - Sine
- A sine wave signal generator.
- Square
- A square wave signal generator.
- Take
- An iterator that yields
nnumber ofFrames from the innersignal. - Until
Exhausted - Yields frames from the signal until the
signal.is_exhausted()returnstrue. - ZipMap
- A signal that iterates two signals in parallel and combines them with a function.
Traits§
- Signal
- Types that yield
Frames of a one-or-more-channel PCM signal. - Step
- Types that may be used to give a phase step size based on some
hz / sample rate.
Functions§
- equilibrium
- Provides an iterator that endlessly yields
Frames of typeFat equilibrium. - from_
interleaved_ samples_ iter - Create a new
Signalfrom the givenFrame-yieldingIterator. - from_
iter - Create a new
Signalfrom the givenFrame-yieldingIterator. - gen
- A signal that generates frames using the given function.
- gen_mut
- A signal that generates frames using the given function which may mutate some state.
- lift
- Consumes the given
Iterator, converts it to aSignal, applies the given function to theSignaland returns anIteratorthat will become exhausted when the consumedIteratordoes. - noise
- Produces a
Signalthat yields random values between -1.0..1.0. - noise_
simplex - Produces a 1-dimensional simplex noise
Signal. - phase
- Creates a
Phasethat continuously steps forward by the givenstepsize yielder. - rate
- Creates a frame
Rate(aka sample rate) representing the rate at which a signal may be sampled. - saw
- Produces a
Signalthat yields a saw wave oscillating at the given hz. - sine
- Produces a
Signalthat yields a sine wave oscillating at the given hz. - square
- Produces a
Signalthat yields a square wave oscillating at the given hz.