pyampact.alignmentUtils.trim_silences

pyampact.alignmentUtils.trim_silences(nmat_dict, y, sr, rms_thresh_db=-40.0, pad=0.25)[source]

Remove or clamp note events in a note matrix that fall outside the active audio region, as determined by an RMS energy threshold.

Parameters:
  • nmat_dict (pd.DataFrame) – Note matrix dictionary keyed by part name.

  • y (np.ndarray) – Audio time series at sample rate sr.

  • sr (int) – Sample rate of y in Hz.

  • rms_thresh_db (float, optional) – RMS energy threshold in dBFS below which frames are considered silent. Default is -40.0.

  • pad (float, optional) – Reserved for future use. Currently unused. Default is 0.25.

Returns:

nmat_dict – The input dictionary with each part’s DataFrame trimmed in-place to the active audio window.

Return type:

pd.DataFrame