SPKitCompressor


User's Guide

SPKitCompressor is a signal amplitude compressor class. It scales the amplitude of its input signal by a user-definable compression ratio. SPKitCompressor compares the input signal amplitude with the threshold level and scales the amplitude, if input signal level exceeds the threshold.

SPKitCompressor implements a setRatio(SPKitFloat value) to set the compression ratio to 1:value. With a value greater than one SPKitCompressor will compress the amplitude. A value less than one will make SPKitCompressor a signal expander. SPKitCompressor inherits a setInputAndEstimationTime() initialization function and a setThreshold() function from its base class, SPKitDynamicsProcessor.


Programmer's Reference

Defined in <spkit/compress.h>
Inherits from SPKitDynamicsProcessor

SPKitCompressor implements a setRatio() function for setting the compression ratio and a scaleBuffer() function for scaling the amplitude of the input signal.

Public Members

void setRatio(SPKitFloat value)
set ratio to value. value must be greater than 0.

Protected Members

void scaleBuffer()
scale the amplitude of sampleBuffer to match the threshold level.

SPKitLimiter uses linear interpolation to scale the amplitude between two consecutive time windows. If the absolute maximum amplitude values of both windows are less than threshold, scaleBuffer() leaves the sampleBuffer unaffected.

SPKitFloat ratio
The actual compession ratio is 1:ratio. A value greater than 1.0 will compress amplitude of the input signal, a value less than 1.0 expand the amplitude.

Return to SPKit home

Kai Lassfolk / University of Helsinki / kpl@elisir.helsinki.fi