@cache(level=<NUM_LIT:10>)<EOL>def mel(sr, n_fft, n_mels=<NUM_LIT>, fmin=<NUM_LIT:0.0>, fmax=None, htk=False,<EOL>norm=<NUM_LIT:1>, dtype=np.float32):
if fmax is None:<EOL><INDENT>fmax = float(sr) / <NUM_LIT:2><EOL><DEDENT>if norm is not None and norm != <NUM_LIT:1> and norm != np.inf:<EOL><INDENT>raise ParameterError('<STR_LIT>'.format(repr(norm)))<EOL><DEDENT>n_mels = int(n_mels)<EOL>weights = np.zeros((n_mels, int(<NUM_LIT:1> + n_fft // <NUM_LIT:2>)), dtype=dtype)<EOL>fftfreqs = fft_frequencies(sr=sr, n_fft=n_fft)<EOL>mel_f = mel_frequencies(n_mels + <NUM_LIT:2>, fmin=fmin, fmax=fmax, htk=htk)<EOL>fdiff = np.diff(mel_f)<EOL>ramps = np.subtract.outer(mel_f, fftfreqs)<EOL>for i in range(n_mels):<EOL><INDENT>lower = -ramps[i] / fdiff[i]<EOL>upper = ramps[i+<NUM_LIT:2>] / fdiff[i+<NUM_LIT:1>]<EOL>weights[i] = np.maximum(<NUM_LIT:0>, np.minimum(lower, upper))<EOL><DEDENT>if norm == <NUM_LIT:1>:<EOL><INDENT>enorm = <NUM_LIT> / (mel_f[<NUM_LIT:2>:n_mels+<NUM_LIT:2>] - mel_f[:n_mels])<EOL>weights *= enorm[:, np.newaxis]<EOL><DEDENT>if not np.all((mel_f[:-<NUM_LIT:2>] == <NUM_LIT:0>) | (weights.max(axis=<NUM_LIT:1>) > <NUM_LIT:0>)):<EOL><INDENT>warnings.warn('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>return weights<EOL>
Create a Filterbank matrix to combine FFT bins into Mel-frequency bins

    Parameters
    ----------
    sr        : number > 0 [scalar]
        sampling rate of the incoming signal

    n_fft     : int > 0 [scalar]
        number of FFT components

    n_mels    : int > 0 [scalar]
        number of Mel bands to generate

    fmin      : float >= 0 [scalar]
        lowest frequency (in Hz)

    fmax      : float >= 0 [scalar]
        highest frequency (in Hz).
        If `None`, use `fmax = sr / 2.0`

    htk       : bool [scalar]
        use HTK formula instead of Slaney

    norm : {None, 1, np.inf} [scalar]
        if 1, divide the triangular mel weights by the width of the mel band
        (area normalization).  Otherwise, leave all the triangles aiming for
        a peak value of 1.0

    dtype : np.dtype
        The data type of the output basis.
        By default, uses 32-bit (single-precision) floating point.

    Returns
    -------
    M         : np.ndarray [shape=(n_mels, 1 + n_fft/2)]
        Mel transform matrix

    Notes
    -----
    This function caches at level 10.

    Examples
    --------
    >>> melfb = librosa.filters.mel(22050, 2048)
    >>> melfb
    array([[ 0.   ,  0.016, ...,  0.   ,  0.   ],
           [ 0.   ,  0.   , ...,  0.   ,  0.   ],
           ...,
           [ 0.   ,  0.   , ...,  0.   ,  0.   ],
           [ 0.   ,  0.   , ...,  0.   ,  0.   ]])


    Clip the maximum frequency to 8KHz

    >>> librosa.filters.mel(22050, 2048, fmax=8000)
    array([[ 0.  ,  0.02, ...,  0.  ,  0.  ],
           [ 0.  ,  0.  , ...,  0.  ,  0.  ],
           ...,
           [ 0.  ,  0.  , ...,  0.  ,  0.  ],
           [ 0.  ,  0.  , ...,  0.  ,  0.  ]])


    >>> import matplotlib.pyplot as plt
    >>> plt.figure()
    >>> librosa.display.specshow(melfb, x_axis='linear')
    >>> plt.ylabel('Mel filter')
    >>> plt.title('Mel filter bank')
    >>> plt.colorbar()
    >>> plt.tight_layout()