zzw922cn / LPC_for_TTS

Linear Prediction Coefficients estimation from mel-spectrogram implemented in Python based on Levinson-Durbin algorithm.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LPC_for_TTS

Linear Prediction Coefficients estimation from mel-spectrogram implemented in Python based on Levinson-Durbin algorithm.

基于Levinson-Durbin归纳法来做线性预测系数的估计。此代码可用于LPC系数的估计,也可用于LPCNet等合成器的特征提取。流程是从音频得到梅尔谱,梅尔谱得到LPC。

from audio import *
import numpy as np
from hparams import Hparams as hparams

input_wav_file = 'test.wav'
sample_rate = 24000
lpc_order = 8

orig_audio, pred_audio, residual, lpcs = lpc_audio(input_wav_file, lpc_order, hparams)

save_wav(pred_audio, 'wavs/pred.wav', hparams)
save_wav(orig_audio, 'wavs/orig.wav', hparams)
save_wav(residual, 'wavs/error.wav', hparams)

Raw audio: image

Predicted audio: image

Prediction error: image

About

Linear Prediction Coefficients estimation from mel-spectrogram implemented in Python based on Levinson-Durbin algorithm.


Languages

Language:Python 100.0%