From 2bc20e65c715300f813c71df272f095275a04e3a Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jmvalin@jmvalin.ca> Date: Wed, 20 Mar 2019 03:21:03 -0400 Subject: [PATCH] Remove hack to match Python code --- dnn/lpcnet.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dnn/lpcnet.c b/dnn/lpcnet.c index fa5d2f598..8b1c696e2 100644 --- a/dnn/lpcnet.c +++ b/dnn/lpcnet.c @@ -128,9 +128,7 @@ LPCNET_EXPORT void lpcnet_synthesize(LPCNetState *lpcnet, short *output, const f float gru_a_condition[3*GRU_A_STATE_SIZE]; int pitch; float pitch_gain; - /* FIXME: Remove this -- it's just a temporary hack to match the Python code. */ - static int start = LPC_ORDER+1; - /* FIXME: Do proper rounding once the Python code rounds properly. */ + /* Matches the Python code -- the 0.1 avoids rounding issues. */ pitch = (int)floor(.1 + 50*features[36]+100); pitch_gain = lpcnet->old_gain[FEATURES_DELAY-1]; memmove(&lpcnet->old_gain[1], &lpcnet->old_gain[0], (FEATURES_DELAY-1)*sizeof(lpcnet->old_gain[0])); @@ -144,7 +142,7 @@ LPCNET_EXPORT void lpcnet_synthesize(LPCNetState *lpcnet, short *output, const f RNN_CLEAR(output, N); return; } - for (i=start;i<N;i++) + for (i=0;i<N;i++) { int j; float pcm; @@ -167,7 +165,6 @@ LPCNET_EXPORT void lpcnet_synthesize(LPCNetState *lpcnet, short *output, const f if (pcm>32767) pcm = 32767; output[i] = (int)floor(.5 + pcm); } - start = 0; } -- GitLab