dsp::Bias< FloatType > Class Template Reference
juce_dsp » processors

Adds a DC offset (voltage bias) to the audio samples. More...

## Public Member Functions

| Bias () noexcept=default
void | setBias (FloatType newBias) noexcept
| Sets the DC bias. More...
FloatType | getBias () const noexcept
| Returns the DC bias. More...
void | setRampDurationSeconds (double newDurationSeconds) noexcept
| Sets the length of the ramp used for smoothing gain changes. More...
double | getRampDurationSeconds () const noexcept
void | prepare (const ProcessSpec &spec) noexcept
| Called before processing starts. More...
void | reset () noexcept
template<typename SampleType >
SampleType | processSample (SampleType inputSample) const noexcept
| Returns the result of processing a single sample. More...
template<typename ProcessContext >
void | process (const ProcessContext &context) noexcept
| Processes the input and output buffers supplied in the processing context. More...

## Detailed Description

### template<typename FloatType>
class dsp::Bias< FloatType >

Adds a DC offset (voltage bias) to the audio samples.

This is a useful preprocessor for asymmetric waveshaping when a waveshaper is bookended by a bias on input and a DC-offset removing high pass filter on output.

This is an extremely simple bias implementation that simply adds a value to a signal. More complicated bias behaviours exist in real circuits - for your homework ;).

## Constructor & Destructor Documentation

## Bias()

template<typename FloatType >

dsp::Bias< FloatType >::Bias | ( |  | ) |

default noexcept

## Member Function Documentation

## setBias()

template<typename FloatType >

void dsp::Bias< FloatType >::setBias | ( | FloatType | newBias | ) |

noexcept

Sets the DC bias.

Parameters

  newBias | DC offset in range [-1, 1]

References jassert, and SmoothedValue< FloatType, SmoothingType >::setTargetValue().

## getBias()

template<typename FloatType >

FloatType dsp::Bias< FloatType >::getBias | ( |  | ) | const

noexcept

Returns the DC bias.

Returns
  DC bias, which should be in the range [-1, 1]

References SmoothedValueBase< SmoothedValueType >::getTargetValue().

## setRampDurationSeconds()

template<typename FloatType >

void dsp::Bias< FloatType >::setRampDurationSeconds | ( | double | newDurationSeconds | ) |

noexcept

Sets the length of the ramp used for smoothing gain changes.

## getRampDurationSeconds()

template<typename FloatType >

double dsp::Bias< FloatType >::getRampDurationSeconds | ( |  | ) | const

noexcept

## prepare()

template<typename FloatType >

void dsp::Bias< FloatType >::prepare | ( | const ProcessSpec & | spec | ) |

noexcept

Called before processing starts.

## reset()

template<typename FloatType >

void dsp::Bias< FloatType >::reset | ( |  | ) |

noexcept

References SmoothedValue< FloatType, SmoothingType >::reset().

## processSample()

template<typename FloatType >
template<typename SampleType >

SampleType dsp::Bias< FloatType >::processSample | ( | SampleType | inputSample | ) | const

noexcept

Returns the result of processing a single sample.

References SmoothedValue< FloatType, SmoothingType >::getNextValue().

## process()

template<typename FloatType >
template<typename ProcessContext >

void dsp::Bias< FloatType >::process | ( | const ProcessContext & | context | ) |

noexcept

Processes the input and output buffers supplied in the processing context.

References FloatVectorOperations::add(), SmoothedValue< FloatType, SmoothingType >::getNextValue(), jassert, and SmoothedValue< FloatType, SmoothingType >::skip().

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

- juce_Bias.h