audiblelight.augmentation.PitchShift#
- class audiblelight.augmentation.PitchShift(sample_rate=44100, semitones=None)#
Bases:
EventAugmentationApplies pitch-shifting to the audio.
Internally, this function uses the time_shift function in pedalboard, specifying the pitch_shift as an array with the same dims as input_audio. From our initial testing, we found this algorithm to be significantly faster than many other existing pitch shifting algorithms, including librosa and pyrubberband.
- Parameters:
sample_rate (custom_types.Numeric) – the sample rate for the effect to use.
semitones (int | float | complex | integer | floating | DistributionLike | None) – the number of semitones to shift the audio by. By default, will be sampled from between +/- 3 semitones (i.e., up or down a minor third).
- __init__(sample_rate=44100, semitones=None)#
- Parameters:
sample_rate (int | float | complex | integer | floating | None)
semitones (int | float | complex | integer | floating | DistributionLike | None)
Methods
__init__([sample_rate, semitones])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
AUGMENTATION_TYPEnameReturns the name of this augmentation
- MAX_SEMITONES = 3#
- MIN_SEMITONES = -3#
- process(input_array)#
Apply the effect to the input audio.
- Parameters:
input_array (ndarray)
- Return type:
ndarray