From 0ddfdfc7c06203a44914f76b27f4a92b66a665c1 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Tue, 27 Nov 2018 12:34:39 -0500 Subject: [PATCH] Add deemphasis --- dnn/lpcnet.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dnn/lpcnet.c b/dnn/lpcnet.c index f75f573c..93c98a78 100644 --- a/dnn/lpcnet.c +++ b/dnn/lpcnet.c @@ -36,7 +36,7 @@ #define NB_TOTAL_FEATURES 55 #define LPC_ORDER 16 - +#define PREEMPH 0.85f #define PITCH_GAIN_FEATURE 37 #define PDF_FLOOR 0.002 @@ -53,6 +53,7 @@ struct LPCNetState { float old_input[FEATURES_DELAY][FEATURE_CONV2_OUT_SIZE]; float old_lpc[FEATURES_DELAY][LPC_ORDER]; int frame_count; + float deemph_mem; }; @@ -178,6 +179,8 @@ void lpcnet_synthesize(LPCNetState *lpcnet, short *output, const float *features RNN_MOVE(&lpcnet->last_sig[1], &lpcnet->last_sig[0], LPC_ORDER-1); lpcnet->last_sig[0] = output[i]; lpcnet->last_exc = exc; + output[i] += PREEMPH*lpcnet->deemph_mem; + lpcnet->deemph_mem = output[i]; } }