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::DcBlock Class Reference

A one-pole high-pass with its zero at DC. More...

Detailed Description

A one-pole high-pass with its zero at DC.

H(z) = (1 - z^-1) / (1 - r z^-1). The pole r sets the corner; the default, 0.995, puts the -3 dB point at DEFAULT_CORNER, 38.1 Hz at 48 kHz. Below the signal transport: the pole is its natural-unit input, set by the component or app that owns it. It declares no ports; the buffer call takes none, and PARAMETERS names the pole so a tool can run it alone.

Definition at line 23 of file dc_block.hpp.

#include <dc_block.hpp>

Public Member Functions

void set_pole (float r)
 Set the pole; closer to 1 is a lower corner.
 
float process (float x)
 One frame.
 
void process (const float *in, float *out, uint16_t frames)
 A buffer of frames. In place is fine: out may be in.
 
void reset ()
 Clear the state.
 
float pole () const
 The pole.
 

Static Public Attributes

static constexpr float DEFAULT_POLE = 0.995f
 
static constexpr float DEFAULT_CORNER = 7.9375e-4f
 
static constexpr transport::Parameter< DcBlock > PARAMETERS []
 The parameters, for tools.
 

Member Function Documentation

◆ set_pole()

void sbl::dsp::DcBlock::set_pole ( float  r)
inline

Set the pole; closer to 1 is a lower corner.

Parameters
rPole, clamped to [0, 1); a NaN is not caught
Context
Same thread as process(); real-time safe.

Definition at line 35 of file dc_block.hpp.

◆ process() [1/2]

float sbl::dsp::DcBlock::process ( float  x)
inline

One frame.

Parameters
xInput sample
Returns
Output sample
Context
Audio thread; real-time safe.

Definition at line 44 of file dc_block.hpp.

Referenced by process().

◆ process() [2/2]

void sbl::dsp::DcBlock::process ( const float *  in,
float *  out,
uint16_t  frames 
)
inline

A buffer of frames. In place is fine: out may be in.

Parameters
inInput buffer, frames long
[out]outOutput buffer, frames long
framesFrame count
Context
Audio thread; real-time safe.

Definition at line 64 of file dc_block.hpp.

References process().

◆ reset()

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

Clear the state.

Definition at line 71 of file dc_block.hpp.

◆ pole()

float sbl::dsp::DcBlock::pole ( ) const
inline

The pole.

Definition at line 77 of file dc_block.hpp.

Member Data Documentation

◆ DEFAULT_POLE

constexpr float sbl::dsp::DcBlock::DEFAULT_POLE = 0.995f
staticconstexpr

The pole until set_pole() is called

Definition at line 25 of file dc_block.hpp.

◆ DEFAULT_CORNER

constexpr float sbl::dsp::DcBlock::DEFAULT_CORNER = 7.9375e-4f
staticconstexpr

The default pole's -3 dB point, in cycles per frame: 38.1 Hz at 48 kHz. A test holds the two together.

Definition at line 27 of file dc_block.hpp.

◆ PARAMETERS

constexpr transport::Parameter<DcBlock> sbl::dsp::DcBlock::PARAMETERS[]
staticconstexpr
Initial value:
= {
}
void set_pole(float r)
Set the pole; closer to 1 is a lower corner.
Definition dc_block.hpp:35

The parameters, for tools.

Definition at line 52 of file dc_block.hpp.


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