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)