Ejemplo n.º 1
0
def energy_envelope(args):
    sig = get_sig(args)
    nfft = unroll_args(args, ['nfft'])
    sig = np.abs(sig)
    hann_window = _cached_get_window('hanning', nfft)
    envelope = np.convolve(sig, hann_window, 'same')
    return envelope.reshape((len(envelope), 1))
Ejemplo n.º 2
0
def lp_coefficients(args):
    sig = get_sig(args)
    nfft, fs, noverlap, win_length, order = unroll_args(
        args, ['nfft', 'fs', 'noverlap', 'win_length', 'order'])
    hann_window = _cached_get_window('hanning', nfft)
    window = unroll_args(args, [('window', hann_window)])

    siglen = len(sig)
    nsegs, segs = split_segments(siglen, win_length, noverlap, incltail=False)

    lp_coeffs = np.zeros((order, nsegs), dtype=np.float32)
    for i in range(nsegs):
        seg_beg, seg_end = segs[i]
        frame = sig[seg_beg:seg_end]

        lp_coeffs[:, i] = lp_coefficients_frame(frame * window, order)
    return lp_coeffs
Ejemplo n.º 3
0
def lpc_spectrum(args):
    sig = get_sig(args)
    nfft, fs, noverlap, win_length, order = unroll_args(
        args, ['nfft', 'fs', 'noverlap', 'win_length', 'order'])
    hann_window = _cached_get_window('hanning', nfft)
    window = unroll_args(args, [('window', hann_window)])

    siglen = len(sig)
    nsegs, segs = split_segments(siglen, win_length, noverlap, incltail=False)

    lpcs = np.zeros((nfft, nsegs), dtype=np.complex64)
    for i in range(nsegs):
        seg_beg, seg_end = segs[i]
        frame = sig[seg_beg:seg_end]

        lpcs[:, i] = lpc_spectrum_frame(frame * window, order, nfft)
    return np.log10(abs(lpcs))