data_juicer.ops.mapper.audio_add_gaussian_noise_mapper module¶
- class data_juicer.ops.mapper.audio_add_gaussian_noise_mapper.AudioAddGaussianNoiseMapper(min_amplitude: float = 0.001, max_amplitude: float = 0.015, p: float = 0.5, save_dir: str = None, *args, **kwargs)[source]¶
Bases:
Mapper
Mapper to add Gaussian noise to audio samples.
This operator adds Gaussian noise to audio data with a specified probability. The amplitude of the noise is randomly chosen between min_amplitude and max_amplitude. If save_dir is provided, the modified audio files are saved in that directory; otherwise, they are saved in the same directory as the input files. The p parameter controls the probability of applying this transformation to each sample. If no audio is present in the sample, it is returned unchanged.
- __init__(min_amplitude: float = 0.001, max_amplitude: float = 0.015, p: float = 0.5, save_dir: str = None, *args, **kwargs)[source]¶
Initialization method.
- Parameters:
min_amplitude – float unit: linear amplitude. Default: 0.001. Minimum noise amplification factor.
max_amplitude – float unit: linear amplitude. Default: 0.015. Maximum noise amplification factor.
p – float range: [0.0, 1.0]. Default: 0.5. The probability of applying this transform.
save_dir – str. Default: None. The directory where generated audio files will be stored. If not specified, outputs will be saved in the same directory as their corresponding input files. This path can alternatively be defined by setting the DJ_PRODUCED_DATA_DIR environment variable.