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 class for transforms applied to a signal. |
|
Encode-decode signal using AMRNB codec. |
|
Append an auxiliary signal. |
|
Expand signal with a constant value. |
|
Adds Babble Noise. |
|
Run signal through a band-pass filter. |
|
Run signal through a band-stop filter. |
|
Hard/soft-clip the signal. |
|
Hard/soft-clip a certain fraction of the signal. |
|
Compose several transforms together. |
|
Compress the dynamic range. |
|
Fade-in and fade-out of signal. |
|
Convolve signal with another signal. |
|
Apply a custom function to the signal. |
|
Scale signal by linear factor. |
|
Run audio signal through a high-pass filter. |
|
Run audio signal through a low-pass filter. |
|
Masked transformation. |
|
Mix two audio signals. |
|
Peak-normalize the signal to a desired level. |
|
Adds pink noise. |
|
Prepend an auxiliary signal. |
|
Prepend signal with a constant value. |
|
Resample signal to another sampling rate. |
|
Randomly select from a pool of transforms. |
|
Shift signal without changing its duration. |
|
Adds basic waveform. |
|
Trim, zero pad, and/or repeat signal. |
|
Adds Gaussian white noise. |
|
Adds uniform white noise. |