pyampact.symbolic.build_mask_from_nmat_seconds

pyampact.symbolic.build_mask_from_nmat_seconds(nmat, sample_rate, num_harmonics, width, tres, n_freqs)[source]

Build a binary harmonic mask matrix from a note matrix for use in DTW alignment.

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

  • sample_rate (int) – Sample rate in Hz used to determine the Nyquist frequency

  • num_harmonics (int) – Number of harmonic partials (including the fundamental)

  • width (int) – Base half-width in frequency bins around each partial centre.

  • tres (float) – Time resolution in seconds per column of the mask matrix. Should match the hop size used in the corresponding STFT.

  • n_freqs (int) – Number of frequency bins in the mask (i.e. number of rows), matching the frequency axis of the spectrogram it will be compared against.

Returns:

M – The harmonic mask matrix as a float32 array

Return type:

np.ndarray, shape (n_freqs, n_cols)