pytimbre.utilities.audio_filtering.WaveformFilter

class pytimbre.utilities.audio_filtering.WaveformFilter

Bases: object

This class contains a series of functions that operate on a Waveform to alter the internal representation of the data through the use of various digital filters.

__init__()

Methods

__init__()

apply_a_weight(wfm)

This function specifically applies the a-weighting filter to the acoustic data, and returns a new waveform with the filter applied.

apply_bandpass(wfm, low_cutoff, high_cutoff)

This function determines the bandpass Butterworth filter coefficients and sends them and the current waveform into the function that will filter the data with an IIR filter coefficient set

apply_c_weight(wfm)

This function specifically applies the a-weighting filter to the acoustic data, and returns a new waveform with the filter applied.

apply_head_auditory_response_filters(wfm)

To calculate the integrated loudness of the signal, we need to first filter the signal for a specific type of response due to the head and the auditory system.

apply_highpass(wfm, cutoff[, order])

This function applies a Butterworth filter to the samples within this class.

apply_iir_filter(wfm, b, a)

This function will be able to apply a filter to the samples within the file and return a new generic_time_waveform object

apply_lowpass(wfm, cutoff[, order])

This function applies a Butterworth filter to the samples within this class.

apply_window(wfm[, window_method, ...])

This will apply a window with the specific method that is supplied by the window argument and returns a generic_time_waveform with the window applied

static apply_a_weight(wfm: Waveform)

This function specifically applies the a-weighting filter to the acoustic data, and returns a new waveform with the filter applied.

Returns:

generic_time_waveform - the filtered waveform

static apply_bandpass(wfm: Waveform, low_cutoff: float, high_cutoff: float, order: int = 3)

This function determines the bandpass Butterworth filter coefficients and sends them and the current waveform into the function that will filter the data with an IIR filter coefficient set

Parameters:
  • low_cutoff (float - the regular frequency cutoff for the low edge of the band pass filter (Units: Hz))

  • high_cutoff (float - the regular frequency cutoff for the upper edge of the band pass filter (Units: Hz))

  • order (int - default: 3, the order of the filter)

static apply_c_weight(wfm: Waveform)

This function specifically applies the a-weighting filter to the acoustic data, and returns a new waveform with the filter applied.

Returns:

generic_time_waveform - the filtered waveform

static apply_head_auditory_response_filters(wfm: Waveform)

To calculate the integrated loudness of the signal, we need to first filter the signal for a specific type of response due to the head and the auditory system. This originates in the pyloudnorm.meter class where the two filters are defined.

static apply_highpass(wfm: Waveform, cutoff: float, order: int = 4)

This function applies a Butterworth filter to the samples within this class.

Parameters:
  • cutoff – double - the true frequency in Hz

  • order – double (default: 4) - the order of the filter that will be created and applied

Returns:

Waveform - the filtered waveform

static apply_iir_filter(wfm: Waveform, b, a)

This function will be able to apply a filter to the samples within the file and return a new generic_time_waveform object

Parameters:
  • wfm (Waveform) – The audio waveform to filter

  • b – double, array-like - the forward coefficients of the filter definition

  • a – double, array-like - the reverse coefficients of the filter definition

static apply_lowpass(wfm: Waveform, cutoff: float, order: int = 4)

This function applies a Butterworth filter to the samples within this class.

Parameters:
  • wfm

  • cutoff – double - the true frequency in Hz

  • order – double (default: 4) - the order of the filter that will be created and applied

Returns:

generic_time_waveform - the filtered waveform

static apply_window(wfm: Waveform, window_method: WindowingMethods = WindowingMethods.hanning, windowing_parameter=None)

This will apply a window with the specific method that is supplied by the window argument and returns a generic_time_waveform with the window applied

Parameters:
  • wfm – The audio waveform to apply the window to

  • window_method – windowing_methods - the enumeration that identifies what type of window to apply to the

waveform :param windowing_parameter: int or float - an additional parameter that is required for the window :returns: generic_time_waveform - the waveform with the window applied