smst.utils.peaks module

smst.utils.peaks.clean_sinusoid_track(track, minTrackLength=3)

Deletes fragments of one single track smaller than minTrackLength.

Parameters:
  • track – array of values
  • minTrackLength – minimum duration of tracks in number of frames
Returns:

cleanTrack: array of clean values

smst.utils.peaks.find_fundamental_twm(pfreq, pmag, ef0max, minf0, maxf0, f0t=0)

Function that wraps the f0 detection function TWM, selecting the possible f0 candidates and calling the function TWM with them.

Parameters:
  • pfreq – peak frequencies
  • pmag – peak magnitudes
  • ef0max – maximum error allowed
  • minf0 – minimum allowed f0
  • maxf0 – maximum allowed f0
  • f0t – f0 of previous frame if stable
Returns:

f0: fundamental frequency in Hz

smst.utils.peaks.find_fundamental_twm_py(pfreq, pmag, f0c)

Two-way mismatch algorithm for f0 detection (by Beauchamp&Maher). Better to use the C version of this function: native_twm().

Parameters:
  • pfreq – peak frequencies in Hz
  • pmag – peak magnitudes
  • f0c – frequencies of f0 candidates
Returns:

f0, f0Error: fundamental frequency detected and its error

smst.utils.peaks.find_peaks(mX, t)

Detects spectral peak locations.

Parameters:
  • mX – magnitude spectrum
  • t – threshold
Returns:

ploc: peak locations

smst.utils.peaks.interpolate_peaks(mX, pX, ploc)

Interpolates peak values using parabolic interpolation.

Parameters:
  • mX – magnitude spectrum
  • pX – phase spectrum
  • ploc – locations of peaks
Returns:

iploc, ipmag, ipphase: interpolated peak location, magnitude and phase values