iracema.util.dsp

Functions that are commonly used in digital signal processing.

iracema.util.dsp.local_peaks(array)[source]

Find the local peaks of the array.

Parameters

array (numpy array) – Input array.

Returns

  • values (numpy array) – Values for the local maxima.

  • ix (numpy array) – Indexes of the local maxima in the input array.

iracema.util.dsp.n_highest_peaks(array, n)[source]

Find the n highest peaks in the given array.

Parameters
  • array (numpy array) – Input array.

  • n (int) – Number of peaks to search.

iracema.util.dsp.hwr(array)[source]

Half-wave rectifier

iracema.util.dsp.decimate_mean(array, f)[source]

Decimate array by grouping each f samples and taking their mean. The array will be padded with zeros at the end if its length is not divisible by f.

iracema.util.dsp.but_filter(audio_data, fs, critical_frequency, filter_type='lowpass', filter_order=4)[source]

Filters the input data using a butterworth digital filter. This is a wrapper over scipy.signal.butter.

Parameters
  • audio_data (numpy array) – Numpy array containing the data of a time series.

  • fs (float) – Sampling frequency.

  • critical_frequency (float) – The critical frequency of frequencies.

  • filter_type ([‘lowpass’, ‘highpass’, ‘bandpass’, ‘bandstop’]) – The type of filter. filter_order: The order of the filter.