class RemiAudio::DSP::SoftClipper
- RemiAudio::DSP::SoftClipper
- Reference
- Object
Overview
The SoftClipper
class implements a type of limiter with a type of
distortion that tends to be more pleasant to the ears than straight
clipping. This will round off the peaks of the audio signal that pass above
the maximum amplitude rather than cut them off flat.
A simplified diagram can be found here.
Defined in:
remiaudio/dsp/softclipping.crConstructors
-
.new(*, oversampling : UInt16 = 1_u16, channels : Int32 = 2)
Creates a new
SoftClipper
instance that will work with the givven number of channels, and with the given amount of oversampling.
Class Method Summary
-
.process(maxAmplitude : Float32 | Float64, sample : Float64) : Float64
Applies soft clipping to a single sample.
-
.process(maxAmplitude : Float32 | Float64, sample : Float32) : Float32
Applies soft clipping to a single sample.
-
.process(maxAmplitude : Float32 | Float64, samples : Array(Float64) | Slice(Float64)) : Nil
Applies soft clipping to a buffer of audio.
-
.process(maxAmplitude : Float32 | Float64, samples : Array(Float32) | Slice(Float32)) : Nil
Applies soft clipping to a buffer of audio.
Instance Method Summary
-
#oversampling=(oversampling : UInt16) : UInt16
Sets a new oversampling amount.
-
#process(maxAmplitude : Float32 | Float64, block : Array(Float64) | Slice(Float64)) : Nil
Applies soft clipping to a block of audio.
-
#process(maxAmplitude : Float32 | Float64, block : Array(Float32) | Slice(Float32)) : Nil
Applies soft clipping to a block of audio.
Constructor Detail
Creates a new SoftClipper
instance that will work with the givven number
of channels, and with the given amount of oversampling. The oversampling
amount cannot be zero.
When oversampling is 1
, then no oversampling is performed. This is the
default to match the behavior of older versions of RemiAudio.
Class Method Detail
Applies soft clipping to a single sample. No oversampling is performed.
Applies soft clipping to a single sample. No oversampling is performed.
Applies soft clipping to a buffer of audio. No oversampling is performed.
Applies soft clipping to a buffer of audio. No oversampling is performed.
Instance Method Detail
Sets a new oversampling amount. This cannot be zero.
Applies soft clipping to a block of audio.
Applies soft clipping to a block of audio.