auglib.transformΒΆ

auglib.transform comes with a number of transforms, that can augment an audio signal.

import auglib
import numpy as np

sampling_rate = 8000
signal = np.ones((1, 4))
transform = auglib.transform.GainStage(-10)
transform(signal, sampling_rate)
array([[0.31622776, 0.31622776, 0.31622776, 0.31622776]], dtype=float32)

Transforms can be combined using auglib.transform.Compose.

transform = auglib.transform.Compose(
    [
        auglib.transform.HighPass(cutoff=3000),
        auglib.transform.Clip(),
        auglib.transform.NormalizeByPeak(peak_db=-3),
    ]
)

You can add your own Python based transform using auglib.transform.Function.

def repeat(signal, sampling_rate, repeats):
    import numpy as np
    return np.tile(signal, repeats)

transform = auglib.transform.Function(repeat, {'repeats': 3})

Base

Base class for transforms applied to a signal.

AMRNB

Encode-decode signal using AMRNB codec.

Append

Append an auxiliary signal.

AppendValue

Expand signal with a constant value.

BabbleNoise

Adds Babble Noise.

BandPass

Run signal through a band-pass filter.

BandStop

Run signal through a band-stop filter.

Clip

Hard/soft-clip the signal.

ClipByRatio

Hard/soft-clip a certain fraction of the signal.

Compose

Compose several transforms together.

CompressDynamicRange

Compress the dynamic range.

Fade

Fade-in and fade-out of signal.

FFTConvolve

Convolve signal with another signal.

Function

Apply a custom function to the signal.

GainStage

Scale signal by linear factor.

HighPass

Run audio signal through a high-pass filter.

LowPass

Run audio signal through a low-pass filter.

Mask

Masked transformation.

Mix

Mix two audio signals.

NormalizeByPeak

Peak-normalize the signal to a desired level.

PinkNoise

Adds pink noise.

Prepend

Prepend an auxiliary signal.

PrependValue

Prepend signal with a constant value.

Resample

Resample signal to another sampling rate.

Select

Randomly select from a pool of transforms.

Shift

Shift signal without changing its duration.

Tone

Adds basic waveform.

Trim

Trim, zero pad, and/or repeat signal.

WhiteNoiseGaussian

Adds Gaussian white noise.

WhiteNoiseUniform

Adds uniform white noise.