Algorithms (libnmfd.dsp.algorithms)¶
- libnmfd.dsp.algorithms.griffin_lim(X: numpy.ndarray, num_iter: int = 50, block_size: int = 2048, hop_size: int = 512, win: Optional[numpy.ndarray] = None, append_frames: bool = True, analytic_sig: bool = False, **kwargs) → Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]¶
Performs one iteration of the phase reconstruction algorithm as described in [2].
References
[1] Daniel W. Griffin and Jae S. Lim Signal estimation from modified short-time fourier transform IEEE Transactions on Acoustics, Speech and Signal Processing, vol. 32, no. 2, pp. 236-243, Apr 1984.
The operation performs an iSTFT (LSEE-MSTFT) followed by STFT on the resynthesized signal.
- Parameters
X (np.ndarray) – The STFT spectrogram to iterate upon
num_iter (int) – Number of iterations
block_size (int) – The block size to use during analysis
hop_size (int) – The used hop size (denoted as S in [1])
win (np.ndarray) – Window function
append_frames (bool) – If this is enabled, safety spaces have to be removed after the iSTFT
analytic_sig (bool) – If this is set to True, we want the analytic signal
- Returns
Xout (np.ndarray) – The spectrogram after iSTFT->STFT processing
Pout (np.ndarray) – The phase spectrogram after iSTFT->STFT processing
res (np.ndarray) – Reconstructed time-domain signal obtained via iSTFT
- libnmfd.dsp.algorithms.hpss_kam_fitzgerald(X: numpy.ndarray, num_iter: int = 1, kern_dim: int = 17, use_median: bool = False, alpha_param: float = 1.0) → Tuple[List[numpy.ndarray], numpy.ndarray, int][source]¶
This re-implements the KAM-based HPSS-algorithm described in [1]. This is a generalization of the median-filter based algorithm first presented in [2]. Our own variant of this algorithm [3] is also supported.
References
[1] Derry FitzGerald, Antoine Liutkus, Zafar Rafii, Bryan Pardo, and Laurent Daudet Harmonic/Percussive Separation using Kernel Additive Modelling Irish Signals and Systems Conference (IET), Limerick, Ireland, 2014, pp. 35�40.
[2] Derry FitzGerald Harmonic/Percussive Separation using Median Filtering In Proceedings of the International Conference on Digital Audio Effects (DAFx), Graz, Austria, 2010, pp. 246-253.
[3] 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
X (np.ndarray) – Input mixture magnitude spectrogram
num_iter (int) – The number of iterations
kern_dim (int) – The kernel dimensions
use_median (bool) – If True, reverts to FitzGerald’s old method
alpha_param (float) – The alpha-Wiener filter exponent
- Returns
kam_X (list) – List containing the percussive and harmonic estimate
kern (np.ndarray) – The kernels used for enhancing percussive and harmonic part
kern_ord (int) – The order of the kernels