nussl/separation/primitive/melodia.py
def _apply_vowel_filter(impulse_train, fs, t1=0.0075, t2=.013,
                     pole_amps=None, pole_freqs=None):
    """
    This model for generating singing vowel sounds from sine tones comes
    from:

    https://simonl02.users.greyc.fr/files/Documents/Teaching/SignalProcessingLabs/lab3.pdf

    The above will be referred to throughout these docstrings as THE DOCUMENT.

    Original author: Fatemeh Pishdadian

    The arguments to the fucntions throughout this text follow the 
    signatures laid out in THE DOCUMENT.

    This is used in Melodia to generate the melody signal to produce a 
    mask.
    
    Args:
        impulse_train (np.ndarray): Numpy array with data to be filtered
        fs (int): Sample rate of audio.
        t1 (float, optional): N1 in Equation 2 in THE DOCUMENT. Defaults to 0.0075.
        t2 (float, optional): N2 in Equation 2 in THE DOCUMENT. Defaults to .013.
        pole_amps (np.ndarray, optional): Pole amplitudes, see Figures 2-4 in THE DOCUMENT. 
          Defaults to None, which maps to E vowel.
        pole_freqs (np.ndarray, optional): Pole frequencies, see Figures 2-4 in THE DOCUMENT. 
          Defaults to None, which maps to E vowel
    
    Returns:
        np.ndarray: Filtered impulse train that should sound sort of like the desired 
          vowel.
    """
    if pole_amps is None:
        pole_amps = np.array([0.99,0.98,0.9,0.9])
    if pole_freqs is None:
        pole_freqs = np.array([800,1200,2800,3600])
        
    vchord_filt = rosenmodel(t1, t2, fs)
    vchord_out = np.convolve(impulse_train, vchord_filt)
        
    denom_coeffs = oral_cavity_filt(pole_amps, pole_freqs, fs)
    oral_out = scipy.signal.lfilter(
        np.array([1]), denom_coeffs, vchord_out)
    lip_out = np.real(scipy.signal.lfilter(
        np.array([1,-1]), np.array([1]), oral_out))
    
    lip_out = lip_out[:impulse_train.shape[0]]
    
    return np.real(lip_out)

    This model for generating singing vowel sounds from sine tones comes
    from:

    https://simonl02.users.greyc.fr/files/Documents/Teaching/SignalProcessingLabs/lab3.pdf

    The above will be referred to throughout these docstrings as THE DOCUMENT.

    Original author: Fatemeh Pishdadian

    The arguments to the fucntions throughout this text follow the 
    signatures laid out in THE DOCUMENT.

    This is used in Melodia to generate the melody signal to produce a 
    mask.
    
    Args:
        impulse_train (np.ndarray): Numpy array with data to be filtered
        fs (int): Sample rate of audio.
        t1 (float, optional): N1 in Equation 2 in THE DOCUMENT. Defaults to 0.0075.
        t2 (float, optional): N2 in Equation 2 in THE DOCUMENT. Defaults to .013.
        pole_amps (np.ndarray, optional): Pole amplitudes, see Figures 2-4 in THE DOCUMENT. 
          Defaults to None, which maps to E vowel.
        pole_freqs (np.ndarray, optional): Pole frequencies, see Figures 2-4 in THE DOCUMENT. 
          Defaults to None, which maps to E vowel
    
    Returns:
        np.ndarray: Filtered impulse train that should sound sort of like the desired 
          vowel.
    
This model for generating singing vowel sounds from sine tones comes
from.



The above will be referred to throughout these docstrings as THE DOCUMENT.

Original author: Fatemeh Pishdadian

The arguments to the fucntions throughout this text follow the
signatures laid out in THE DOCUMENT.

This is used in Melodia to generate the melody signal to produce a
mask.
This model for generating singing vowel sounds from sine tones comes from . The above will be referred to throughout these docstrings as THE DOCUMENT . Original author : Fatemeh Pishdadian The arguments to the fucntions throughout this text follow the signatures laid out in THE DOCUMENT . This is used in Melodia to generate the melody signal to produce a mask .
def _apply_vowel_filter(impulse_train, fs, t1=0.0075, t2=.013,
                     pole_amps=None, pole_freqs=None):
    if pole_amps is None:
        pole_amps = np.array([0.99,0.98,0.9,0.9])
    if pole_freqs is None:
        pole_freqs = np.array([800,1200,2800,3600])
    vchord_filt = rosenmodel(t1, t2, fs)
    vchord_out = np.convolve(impulse_train, vchord_filt)
    denom_coeffs = oral_cavity_filt(pole_amps, pole_freqs, fs)
    oral_out = scipy.signal.lfilter(
        np.array([1]), denom_coeffs, vchord_out)
    lip_out = np.real(scipy.signal.lfilter(
        np.array([1,-1]), np.array([1]), oral_out))
    lip_out = lip_out[:impulse_train.shape[0]]
    return np.real(lip_out)
def _apply_vowel_filter ( impulse_train , fs , t1 = 0.0075 , t2 = .013 , pole_amps = None , pole_freqs = None ) : if pole_amps is None : pole_amps = np . array ( [ 0.99 , 0.98 , 0.9 , 0.9 ] ) if pole_freqs is None : pole_freqs = np . array ( [ 800 , 1200 , 2800 , 3600 ] ) vchord_filt = rosenmodel ( t1 , t2 , fs ) vchord_out = np . convolve ( impulse_train , vchord_filt ) denom_coeffs = oral_cavity_filt ( pole_amps , pole_freqs , fs ) oral_out = scipy . signal . lfilter ( np . array ( [ 1 ] ) , denom_coeffs , vchord_out ) lip_out = np . real ( scipy . signal . lfilter ( np . array ( [ 1 , - 1 ] ) , np . array ( [ 1 ] ) , oral_out ) ) lip_out = lip_out [ : impulse_train . shape [ 0 ] ] return np . real ( lip_out )
This model for generating singing vowel sounds from sine tones comes
from:
This model for generating singing vowel sounds from sine tones comes from :
"""
    This model for generating singing vowel sounds from sine tones comes
    from:

    https://simonl02.users.greyc.fr/files/Documents/Teaching/SignalProcessingLabs/lab3.pdf

    The above will be referred to throughout these docstrings as THE DOCUMENT.

    Original author: Fatemeh Pishdadian

    The arguments to the fucntions throughout this text follow the 
    signatures laid out in THE DOCUMENT.

    This is used in Melodia to generate the melody signal to produce a 
    mask.
    
    Args:
        impulse_train (np.ndarray): Numpy array with data to be filtered
        fs (int): Sample rate of audio.
        t1 (float, optional): N1 in Equation 2 in THE DOCUMENT. Defaults to 0.0075.
        t2 (float, optional): N2 in Equation 2 in THE DOCUMENT. Defaults to .013.
        pole_amps (np.ndarray, optional): Pole amplitudes, see Figures 2-4 in THE DOCUMENT. 
          Defaults to None, which maps to E vowel.
        pole_freqs (np.ndarray, optional): Pole frequencies, see Figures 2-4 in THE DOCUMENT. 
          Defaults to None, which maps to E vowel
    
    Returns:
        np.ndarray: Filtered impulse train that should sound sort of like the desired 
          vowel.
    """
Filtered impulse train that should sound sort of like the desired
vowel.
Filtered impulse train that should sound sort of like the desired vowel .
np.ndarray
impulse_train
Numpy array with data to be filtered
Numpy array with data to be filtered
fs
Sample rate of audio.
Sample rate of audio .
t1
N1 in Equation 2 in THE DOCUMENT.
N1 in Equation 2 in THE DOCUMENT .
0.0075
t2
N2 in Equation 2 in THE DOCUMENT. Defaults to .013.
N2 in Equation 2 in THE DOCUMENT . Defaults to . 013 .
.013
pole_amps
Pole amplitudes, see Figures 2-4 in THE DOCUMENT.
Defaults to None, which maps to E vowel.
Pole amplitudes see Figures 2 - 4 in THE DOCUMENT . Defaults to None which maps to E vowel .
pole_freqs
Pole frequencies, see Figures 2-4 in THE DOCUMENT.
Defaults to None, which maps to E vowel
Pole frequencies see Figures 2 - 4 in THE DOCUMENT . Defaults to None which maps to E vowel