nussl/separation/primitive/melodia.py
def create_harmonic_mask(self, melody_signal):
        """
        Creates a harmonic mask from the melody signal. The mask is smoothed to reduce 
        the effects of discontinuities in the melody synthesizer.
        """
        stft = np.abs(melody_signal.stft())

        # Need to threshold the melody stft since the synthesized
        # F0 sequence overtones are at different weights.
        stft = stft ** self.compression
        stft /= np.maximum(np.max(stft, axis=1, keepdims=True), 1e-7)

        mask = np.empty(self.stft.shape)

        # Smoothing the mask row-wise using a low-pass filter to
        # get rid of discontuinities in the mask.
        kernel = np.full((1, self.smooth_length), 1 / self.smooth_length)
        for ch in range(self.audio_signal.num_channels):
            mask[..., ch] = convolve(stft[..., ch], kernel)
        return mask

        Creates a harmonic mask from the melody signal. The mask is smoothed to reduce 
        the effects of discontinuities in the melody synthesizer.
        
Creates a harmonic mask from the melody signal. The mask is smoothed to reduce
the effects of discontinuities in the melody synthesizer.
Creates a harmonic mask from the melody signal . The mask is smoothed to reduce the effects of discontinuities in the melody synthesizer .
def create_harmonic_mask(self, melody_signal):
        stft = np.abs(melody_signal.stft())
        stft = stft ** self.compression
        stft /= np.maximum(np.max(stft, axis=1, keepdims=True), 1e-7)
        mask = np.empty(self.stft.shape)
        kernel = np.full((1, self.smooth_length), 1 / self.smooth_length)
        for ch in range(self.audio_signal.num_channels):
            mask[..., ch] = convolve(stft[..., ch], kernel)
        return mask
def create_harmonic_mask ( self , melody_signal ) : stft = np . abs ( melody_signal . stft ( ) ) stft = stft ** self . compression stft /= np . maximum ( np . max ( stft , axis = 1 , keepdims = True ) , 1e-7 ) mask = np . empty ( self . stft . shape ) kernel = np . full ( ( 1 , self . smooth_length ) , 1 / self . smooth_length ) for ch in range ( self . audio_signal . num_channels ) : mask [ ... , ch ] = convolve ( stft [ ... , ch ] , kernel ) return mask
Creates a harmonic mask from the melody signal.
Creates a harmonic mask from the melody signal .
"""
        Creates a harmonic mask from the melody signal. The mask is smoothed to reduce 
        the effects of discontinuities in the melody synthesizer.
        """ # Need to threshold the melody stft since the synthesized # F0 sequence overtones are at different weights. # Smoothing the mask row-wise using a low-pass filter to # get rid of discontuinities in the mask.
self
melody_signal