audiblelight.augmentation.Fade#
- class audiblelight.augmentation.Fade(sample_rate=44100, fade_in_len=None, fade_out_len=None, fade_in_shape=None, fade_out_shape=None)#
Bases:
EventAugmentationAdd a fade-in and/or fade-out to audio.
- The shape of the fade can be specified as one of:
“linear”
“exponential”
“logarithmic”
“quarter_sine”
“half_sine”
“none”, equivalent to no fade
Different shapes can be specified for both the fade-in and fade-out. The length of the fade-in and fade-out time must be specified in seconds.
- For more information:
https://docs.pytorch.org/audio/main/generated/torchaudio.transforms.Fade.html
- Parameters:
sample_rate (custom_types.Numeric) – the sample rate for the effect to use.
fade_in_len (int | float | complex | integer | floating | DistributionLike | None) – the length of time for the fade in (seconds), sampled between 0 and 1 if not given.
fade_out_len (int | float | complex | integer | floating | DistributionLike | None) – the length of time for the fade out (seconds), sampled between 0 and 1 if not given.
fade_in_shape (str | None) – the shape of the fade in, sampled randomly from an available option (see above) if not given
fade_out_shape (str | None) – the shape of the fade out, sampled randomly from an available option (see above) if not given
- __init__(sample_rate=44100, fade_in_len=None, fade_out_len=None, fade_in_shape=None, fade_out_shape=None)#
- Parameters:
sample_rate (int | float | complex | integer | floating | None)
fade_in_len (int | float | complex | integer | floating | DistributionLike | None)
fade_out_len (int | float | complex | integer | floating | DistributionLike | None)
fade_in_shape (str | None)
fade_out_shape (str | None)
Methods
__init__([sample_rate, fade_in_len, ...])from_dict(input_dict)Initialise an augmentation from a dictionary.
process(input_array)Calls the underlying FX (or a list of FX)
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
- FADE_SHAPES = ['linear', 'exponential', 'logarithmic', 'quarter_sine', 'half_sine', 'none']#
- MAX_FADE = 1.0#
- MIN_FADE = 0.0#