audiblelight.augmentation.SpeedUp#
- class audiblelight.augmentation.SpeedUp(sample_rate=44100, stretch_factor=None)#
Bases:
EventAugmentationChanges the speed of the audio.
Using a higher stretch_factor will shorten the audio - i.e., a stretch_factor of 2.0 will double the speed of the audio and halve the length of the audio, without changing the pitch of the audio. When the output audio is shorter than the input, it will be right-padded with zeros to maintain the correct dim. When the output audio is longer than the input, it will be truncated to maintain the correct dim.
- Parameters:
sample_rate (custom_types.Numeric) – the sample rate for the effect to use.
stretch_factor (int | float | complex | integer | floating | DistributionLike | None) – the time-stretching factor to apply. Values above 1 will increase the speed of the audio, while values below 1 will decrease the speed. A value of 1 will have no effect. By default, will be sampled from between 0.7 and 1.5.
- __init__(sample_rate=44100, stretch_factor=None)#
- Parameters:
sample_rate (int | float | complex | integer | floating | None)
stretch_factor (int | float | complex | integer | floating | DistributionLike | None)
Methods
__init__([sample_rate, stretch_factor])from_dict(input_dict)Initialise an augmentation from a dictionary.
process(input_array)Apply the effect to the input audio.
sample_value(override, default_dist)Samples a value according to the following method:
to_dict()Returns the parameters used by this augmentation
Attributes
- MAX_SHIFT = 1.5#
- MIN_SHIFT = 0.7#
- process(input_array)#
Apply the effect to the input audio.
- Parameters:
input_array (ndarray)
- Return type:
ndarray