audiblelight.augmentation.MultibandEqualizer#

class audiblelight.augmentation.MultibandEqualizer(sample_rate=44100, n_bands=None, gain_db=None, cutoff_frequency_hz=None, q=None)#

Bases: EventAugmentation

Applies equalization to the audio.

The Equalizer applies N peak filter objects to the audio. The gain, frequency, and Q of each filter can be set independently, or randomised from within an acceptable range. By default, between 1 and 8 individual peak filters are applied, with randomly selected gain, frequency, and Q of each filter.

Using this class, it is possible to create a multiband equalizer similar to the “parametric EQ” plugins often featured in digital audio workstations. For additional flexibility, consider combining with both HighpassFilter and LowpassFilter.

Parameters:
  • sample_rate (custom_types.Numeric) – the sample rate for the effect to use.

  • n_bands (int | float | complex | integer | floating | DistributionLike | None) – the number of peak filters to use in the equalizer. Defaults to a random integer between 1 and 8.

  • gain_db (list[int | float | complex | integer | floating] | int | float | complex | integer | floating | DistributionLike | None) – the gain values for each peak. Can be either a single value, a list of N values, or a distribution. If a single value, will be repeated N times. If a distribution, will be sampled from N times.

  • cutoff_frequency_hz (list[int | float | complex | integer | floating] | int | float | complex | integer | floating | DistributionLike | None) – the frequency for each peak filter. Same rules as gain_db apply.

  • q (list[int | float | complex | integer | floating] | int | float | complex | integer | floating | DistributionLike | None) – the “sharpness” of each filter. Same rules as gain_db apply.

__init__(sample_rate=44100, n_bands=None, gain_db=None, cutoff_frequency_hz=None, q=None)#
Parameters:
  • sample_rate (int | float | complex | integer | floating | None)

  • n_bands (int | float | complex | integer | floating | DistributionLike | None)

  • gain_db (list[int | float | complex | integer | floating] | int | float | complex | integer | floating | DistributionLike | None)

  • cutoff_frequency_hz (list[int | float | complex | integer | floating] | int | float | complex | integer | floating | DistributionLike | None)

  • q (list[int | float | complex | integer | floating] | int | float | complex | integer | floating | DistributionLike | None)

Methods

__init__([sample_rate, n_bands, gain_db, ...])

create_filters()

Creates multiple PeakFilter effects with given gain, frequency and q values

from_dict(input_dict)

Initialise an augmentation from a dictionary.

process(input_array)

Calls the underlying FX (or a list of FX)

sample_peak_filter_params(override, default_dist)

Samples all values (e.g., all Q values, all frequencies) for all N peak filters.

sample_value(override, default_dist)

Samples a value according to the following method:

to_dict()

Returns the parameters used by this augmentation

Attributes

AUGMENTATION_TYPE

MAX_BANDS

MAX_FREQ

MAX_GAIN

MAX_Q

MIN_BANDS

MIN_FREQ

MIN_GAIN

MIN_Q

name

Returns the name of this augmentation

MAX_BANDS = 8#
MAX_FREQ = 22050#
MAX_GAIN = 10#
MAX_Q = 1.0#
MIN_BANDS = 1#
MIN_FREQ = 1024#
MIN_GAIN = -20#
MIN_Q = 0.1#
create_filters()#

Creates multiple PeakFilter effects with given gain, frequency and q values

Return type:

list[Callable]

sample_peak_filter_params(override, default_dist)#

Samples all values (e.g., all Q values, all frequencies) for all N peak filters.

Uses the following method:
  • If override not provided, sample from default_dist N times

  • If override provided and is a list or iterable, use this

  • If override provided and is numeric, use this N times (repeated)

  • If override provided and is a distribution, sample from this N times

  • Otherwise, raise an error

Parameters:
  • override (int | float | complex | integer | floating | list[int | float | complex | integer | floating] | DistributionLike)

  • default_dist (DistributionLike)

Return type:

list[int | float | complex | integer | floating]