Filters (libnmfd.dsp.filters)

libnmfd.dsp.filters.alpha_wiener_filter(mixture_X: ndarray, source_A: List[ndarray], alpha: float = 1.2, binarize=False) Tuple[List[ndarray], List[ndarray]][source]

Given a cell-array of spectrogram estimates as input, this function computes the alpha-related soft masks for extracting the sources. Details about this procedure are given in [1], further experimental studies in [2].

References

[1] Antoine Liutkus and Roland Badeau: Generalized Wiener filtering with fractional power spectrograms, ICASPP 2015

[2] Christian Dittmar, Jonathan Driedger, Meinard Müller, and Jouni Paulus An Experimental Approach to Generalized Wiener Filtering in Music Source Separation In Proceedings of the European Signal Processing Conference (EUSIPCO): 1743–1747, 2016.

Parameters:
  • mixture_X (array_like) – The mixture spectrogram (numBins x numFrames) (may be real-or complex-valued)

  • source_A (list) – A list holding the equally sized spectrogram estimates of single sound sources (aka components)

  • alpha (float) – The fractional power in rand [0 … 2]

  • binarize (bool) – If this is set to True, we binarize the masks

Returns:
  • source_X (list) – A list of extracted source spectrograms

  • softMasks (list) – A list with the extracted masks

libnmfd.dsp.filters.nema(A: ndarray, decay: ndarray | float = 0.9) ndarray[source]

This function takes a matrix of row-wise time series and applies a non-linear exponential moving average (NEMA) to each row. This filter introduces exponentially decaying slopes and is defined in eq. (3) from [2].

The difference equation of that filter would be: y(n) = max( x(n), y(n-1)*(decay) + x(n)*(1-decay) )

References

[1] Christian Dittmar, Patricio López-Serrano, and Meinard Müller Unifying Local and Global Methods for Harmonic-Percussive Source Separation In Proceedings of the IEEE International Conference on Acoustics, Speech, and Signal Processing (ICASSP), 2018.

Parameters:
  • A (np.ndarray) – The matrix with time series in its rows

  • decay (np.ndarray or float) – The decay parameter in the range [0 … 1], this can be given as a column-vector with individual decays per row or as a scalar

Returns:

filtered (np.ndarray) – The result after application of the NEMA filter