API Reference¶
Quick Import Guide¶
Import all transforms directly from the main package:
from soundmentations import *
All Available Transforms¶
Compose multiple audio transforms into a sequential pipeline. |
|
Apply one transform from a list of transforms, chosen at random. |
|
Trim audio to keep only the portion between start_time and end_time. |
|
Randomly trim audio by selecting a random segment of specified duration. |
|
Trim audio to keep only the portion starting from start_time to the end. |
|
Trim audio to keep only the portion from the start to end_time. |
|
Trim audio to keep only the center portion of specified duration. |
|
Pad audio to minimum length by adding zeros at the end. |
|
Pad audio to minimum length by adding zeros symmetrically on both sides. |
|
Pad audio to minimum length by adding zeros at the beginning. |
|
Pad or trim audio to exact target length using end operations. |
|
Pad or trim audio to exact target length using center operations. |
|
Pad audio to make its length a multiple of the specified value. |
|
Mask a random contiguous segment of audio data with zeros. |
|
Apply a fixed gain (in dB) to audio samples. |
|
Apply a random gain to audio samples within a specified range. |
|
Apply a different random gain to each audio sample in a batch. |
|
Apply a smoothly varying random gain envelope to audio samples. |
|
Apply hard limiting to audio samples to prevent clipping. |
|
Fade-in effect for audio samples. |
|
Apply a fade-out effect to the end of audio samples. |
|
Apply dynamic range compression to the audio sample. |
|
Shift the pitch of audio by a specified number of semitones. |
|
Randomly shift the pitch within a specified semitone range. |
Transforms by Category¶
Composition¶
Time Transforms¶
Trim Transforms¶
|
Trim audio to keep only the portion between start_time and end_time. |
|
Randomly trim audio by selecting a random segment of specified duration. |
|
Trim audio to keep only the portion starting from start_time to the end. |
|
Trim audio to keep only the portion from the start to end_time. |
|
Trim audio to keep only the center portion of specified duration. |
Pad Transforms¶
|
Pad audio to minimum length by adding zeros at the end. |
|
Pad audio to minimum length by adding zeros symmetrically on both sides. |
|
Pad audio to minimum length by adding zeros at the beginning. |
|
Pad or trim audio to exact target length using end operations. |
|
Pad or trim audio to exact target length using center operations. |
|
Pad audio to make its length a multiple of the specified value. |
Mask Transforms¶
|
Mask a random contiguous segment of audio data with zeros. |
Amplitude Transforms¶
Gain Transforms¶
|
Apply a fixed gain (in dB) to audio samples. |
|
Apply a random gain to audio samples within a specified range. |
|
Apply a different random gain to each audio sample in a batch. |
|
Apply a smoothly varying random gain envelope to audio samples. |
Limiter Transforms¶
|
Apply hard limiting to audio samples to prevent clipping. |
Fade Transforms¶
Compressor Transforms¶
|
Apply dynamic range compression to the audio sample. |
Frequency Transforms¶
Pitch Transforms¶
|
Shift the pitch of audio by a specified number of semitones. |
|
Randomly shift the pitch within a specified semitone range. |