preprocess.py
def cal_mcep(wav_ori, fs=SAMPLE_RATE, ispad=False, frame_period=0.005, dim=FEATURE_DIM, fft_size=FFTSIZE):
    '''cal mcep given wav singnal
        the frame_period used only for pad_wav_to_get_fixed_frames
    '''
    if ispad:
        wav, pad_length = pad_wav_to_get_fixed_frames(
            wav_ori, frames=FRAMES, frame_period=frame_period, sr=fs)
    else:
        wav = wav_ori
    # Harvest F0 extraction algorithm.
    f0, timeaxis = pyworld.harvest(wav, fs)

    # CheapTrick harmonic spectral envelope estimation algorithm.
    sp = pyworld.cheaptrick(wav, f0, timeaxis, fs, fft_size=fft_size)

    # D4C aperiodicity estimation algorithm.
    ap = pyworld.d4c(wav, f0, timeaxis, fs, fft_size=fft_size)
    # feature reduction nxdim
    coded_sp = pyworld.code_spectral_envelope(sp, fs, dim)
    # log
    coded_sp = coded_sp.T  # dim x n

    res = {
        'f0': f0,  # n
        'ap': ap,  # n*fftsize//2+1
        'sp': sp,  # n*fftsize//2+1
        'coded_sp': coded_sp,  # dim * n
    }
    return res
cal mcep given wav singnal
        the frame_period used only for pad_wav_to_get_fixed_frames
    
cal mcep given wav singnal
the frame_period used only for pad_wav_to_get_fixed_frames
cal mcep given wav singnal the frame_period used only for pad_wav_to_get_fixed_frames
def cal_mcep(wav_ori, fs=SAMPLE_RATE, ispad=False, frame_period=0.005, dim=FEATURE_DIM, fft_size=FFTSIZE):
    if ispad:
        wav, pad_length = pad_wav_to_get_fixed_frames(
            wav_ori, frames=FRAMES, frame_period=frame_period, sr=fs)
    else:
        wav = wav_ori
    f0, timeaxis = pyworld.harvest(wav, fs)
    sp = pyworld.cheaptrick(wav, f0, timeaxis, fs, fft_size=fft_size)
    ap = pyworld.d4c(wav, f0, timeaxis, fs, fft_size=fft_size)
    coded_sp = pyworld.code_spectral_envelope(sp, fs, dim)
    coded_sp = coded_sp.T  
    res = {
        'f0': f0,  
        'ap': ap,  *fftsize//2+1
        'sp': sp,  *fftsize//2+1
        'coded_sp': coded_sp,  
    }
    return res
def cal_mcep ( wav_ori , fs = SAMPLE_RATE , ispad = False , frame_period = 0.005 , dim = FEATURE_DIM , fft_size = FFTSIZE ) : if ispad : wav , pad_length = pad_wav_to_get_fixed_frames ( wav_ori , frames = FRAMES , frame_period = frame_period , sr = fs ) else : wav = wav_ori f0 , timeaxis = pyworld . harvest ( wav , fs ) sp = pyworld . cheaptrick ( wav , f0 , timeaxis , fs , fft_size = fft_size ) ap = pyworld . d4c ( wav , f0 , timeaxis , fs , fft_size = fft_size ) coded_sp = pyworld . code_spectral_envelope ( sp , fs , dim ) coded_sp = coded_sp . T res = { 'f0' : f0 , 'ap' : ap , 'sp' : sp , 'coded_sp' : coded_sp , } return res
cal mcep given wav singnal
the frame_period used only for pad_wav_to_get_fixed_frames
cal mcep given wav singnal the frame_period used only for pad_wav_to_get_fixed_frames
'''cal mcep given wav singnal
        the frame_period used only for pad_wav_to_get_fixed_frames
    ''' # Harvest F0 extraction algorithm. # CheapTrick harmonic spectral envelope estimation algorithm. # D4C aperiodicity estimation algorithm. # feature reduction nxdim # log # dim x n # n # n*fftsize//2+1 # n*fftsize//2+1 # dim * n
wav_ori
fs
ispad
frame_period
dim
fft_size