Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::dsp::DryWet Class Reference

A dry/wet mix of two signals, the mix a port. More...

Detailed Description

A dry/wet mix of two signals, the mix a port.

out = dry + mix (wet - dry): the dry signal at 0, the wet at 1, a linear blend between. With a filter's or an effect's output as the wet signal it is the stage's depth. On the transport the wet signal is the input, and the dry signal and the mix are ports:

  • dry, a block: the signal before the stage.
  • mix, in [0, 1], a block or a scalar. A scalar moves to its value over RAMP_FRAMES, the first one at once; left off, it holds. A value that is not a number counts as 0.

At a mix of exactly 0 the output is the dry signal, bit for bit, and at 1 the wet. Memoryless apart from the mix's ramp. In place is fine: out may be the wet buffer or the dry one.

allpass.process(dry, wet, frames, cutoff, q);
depth.process(wet, out, frames, dry, mass);

Definition at line 39 of file dry_wet.hpp.

#include <dry_wet.hpp>

Public Member Functions

 DryWet ()
 A mix of 1, the wet signal, until a mix is given; a scalar mix ramps over RAMP_FRAMES.
 
template<class... Ports>
void process (const float *wet, float *out, uint16_t frames, Ports... ports)
 The mix over a buffer: the wet signal is the input, dry and mix are ports.
 
void reset ()
 The mix at its target.
 

Static Public Member Functions

static float mix (float dry, float wet, float mix)
 One frame: dry at a mix of 0, wet at 1. The mix is used as given.
 

Static Public Attributes

static constexpr uint16_t RAMP_FRAMES = 64
 
static constexpr transport::Port PORTS []
 The ports of the buffer form, in the order it takes them.
 

Constructor & Destructor Documentation

◆ DryWet()

sbl::dsp::DryWet::DryWet ( )
inline

A mix of 1, the wet signal, until a mix is given; a scalar mix ramps over RAMP_FRAMES.

Definition at line 44 of file dry_wet.hpp.

References RAMP_FRAMES, and sbl::dsp::Ramp::set_length().

Member Function Documentation

◆ mix()

static float sbl::dsp::DryWet::mix ( float  dry,
float  wet,
float  mix 
)
inlinestatic

One frame: dry at a mix of 0, wet at 1. The mix is used as given.

Parameters
dryThe dry sample
wetThe wet sample
mixThe mix; exactly 0 returns dry and exactly 1 returns wet, bit for bit
Returns
dry + mix (wet - dry)

Definition at line 54 of file dry_wet.hpp.

References mix().

Referenced by mix(), and process().

◆ process()

template<class... Ports>
void sbl::dsp::DryWet::process ( const float *  wet,
float *  out,
uint16_t  frames,
Ports...  ports 
)
inline

The mix over a buffer: the wet signal is the input, dry and mix are ports.

In place is fine: out may be the wet buffer or the dry one.

Template Parameters
PortsThe dry block, then optionally the mix as a block or an arithmetic scalar
Parameters
wetThe wet buffer, frames long
[out]outOutput buffer, frames long
framesFrame count
portsdry, a block frames long; then mix in [0, 1], clamped, a NaN counting as 0, or left off to hold
Context
Audio thread; real-time safe.

Definition at line 83 of file dry_wet.hpp.

References sbl::math::clamp01(), sbl::dsp::Ramp::head(), sbl::dsp::Ramp::jump(), mix(), and sbl::dsp::Ramp::step().

◆ reset()

void sbl::dsp::DryWet::reset ( )
inline

The mix at its target.

Definition at line 108 of file dry_wet.hpp.

References sbl::dsp::Ramp::jump(), and sbl::dsp::Ramp::target().

Member Data Documentation

◆ RAMP_FRAMES

constexpr uint16_t sbl::dsp::DryWet::RAMP_FRAMES = 64
staticconstexpr

a scalar mix arrives after this many frames

Definition at line 41 of file dry_wet.hpp.

Referenced by DryWet().

◆ PORTS

constexpr transport::Port sbl::dsp::DryWet::PORTS[]
staticconstexpr
Initial value:

The ports of the buffer form, in the order it takes them.

Definition at line 65 of file dry_wet.hpp.


The documentation for this class was generated from the following file: