audiblelight.augmentation.Compressor#
- class audiblelight.augmentation.Compressor(sample_rate=44100, threshold_db=None, ratio=None, attack_ms=None, release_ms=None)#
Bases:
EventAugmentationApplies compression to the audio signal.
A dynamic range compressor, used to reduce the volume of loud sounds and “compress” the loudness of the signal. For a lossy compression algorithm that introduces noise or artifacts, see MP3Compressor or GSMCompressor.
- Parameters:
sample_rate (custom_types.Numeric) – the sample rate for the effect to use.
threshold_db (int | float | complex | integer | floating | DistributionLike | None) – the dB threshold after which the compressor is active. Sampled between -40 and -20 dB if not given
ratio (int | float | complex | integer | floating | DistributionLike | None) – the compressor ratio, i.e. ratio=4 reduces the signal volume by 4 dB for every 1 dB over the threshold. If not provided, sampled from [4, 8, 12, 20] (i.e., the ratio values on the famous UREI 1176 compressor)
attack_ms (int | float | complex | integer | floating | DistributionLike | None) – the time taken for the compressor to kick in after the threshold is exceeded. If not provided, will be sampled between 1 and 100 ms.
release_ms (int | float | complex | integer | floating | DistributionLike | None) – the time taken for the compressor to return to 0 dB after exceeding the threshold. If not provided, will be sampled between 50 and 1100 ms (again, inspired by the UREI 1176).
- __init__(sample_rate=44100, threshold_db=None, ratio=None, attack_ms=None, release_ms=None)#
- Parameters:
sample_rate (int | float | complex | integer | floating | None)
threshold_db (int | float | complex | integer | floating | DistributionLike | None)
ratio (int | float | complex | integer | floating | DistributionLike | None)
attack_ms (int | float | complex | integer | floating | DistributionLike | None)
release_ms (int | float | complex | integer | floating | DistributionLike | None)
Methods
__init__([sample_rate, threshold_db, ratio, ...])from_dict(input_dict)Initialise an augmentation from a dictionary.
process(input_array)Calls the underlying FX (or a list of FX)
sample_value(override, default_dist)Samples a value according to the following method:
to_dict()Returns the parameters used by this augmentation
Attributes
AUGMENTATION_TYPEnameReturns the name of this augmentation
- MAX_ATTACK = 100#
- MAX_RELEASE = 1100#
- MAX_THRESHOLD_DB = -20#
- MIN_ATTACK = 1#
- MIN_RELEASE = 50#
- MIN_THRESHOLD_DB = -40#
- RATIOS = [4, 8, 12, 20]#