algorithms package

Submodules

algorithms.asa module

This module extracts out a bunch of the Auditory Scene Analysis (ASA) logic, which has grown to be a little unwieldy in the AudioSegment class.

algorithms.asa.visualize(spect, frequencies, title='')
algorithms.asa.visualize_fronts(onsets, offsets, spect, frequencies)
algorithms.asa.visualize_peaks_and_valleys(peaks, valleys, spect, frequencies)
algorithms.asa.visualize_segmentation_mask(segmentation, spect, frequencies, mode='new')
algorithms.asa.visualize_time_domain(seg, title='')

algorithms.eventdetection module

This module contains a bunch of functions that are integral to the auditory event detection algorithm used by AudioSegment. We refactored them to here because they aren’t really useful on their own, and they take up brainspace by being in the AudioSegment class.

algorithms.filters module

Convenience functions for using Numpy/Scipy filters in the audio domain.

algorithms.filters.bandpass_filter(data, low, high, fs, order=5)

Does a bandpass filter over the given data.

Parameters:
  • data – The data (numpy array) to be filtered.
  • low – The low cutoff in Hz.
  • high – The high cutoff in Hz.
  • fs – The sample rate (in Hz) of the data.
  • order – The order of the filter. The higher the order, the tighter the roll-off.
Returns:

Filtered data (numpy array).

algorithms.filters.lowpass_filter(data, cutoff, fs, order=5)

Does a lowpass filter over the given data.

Parameters:
  • data – The data (numpy array) to be filtered.
  • cutoff – The high cutoff in Hz.
  • fs – The sample rate in Hz of the data.
  • order – The order of the filter. The higher the order, the tighter the roll-off.
Returns:

Filtered data (numpy array).

algorithms.util module

Utility module for miscellaneous stuff

algorithms.util.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)

Python 3.4 does not have math.isclose, so we need to steal it and add it here.

Module contents