Fix flooring of the pitch period

Without the 0.1 bias, the rounding error could cause an offset of -1
This commit is contained in:
Jean-Marc Valin 2018-12-10 11:23:31 -05:00
parent d533e4024d
commit b9e0ea23e0
3 changed files with 4 additions and 4 deletions

View file

@ -154,7 +154,7 @@ void lpcnet_synthesize(LPCNetState *lpcnet, short *output, const float *features
/* 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. */
pitch = (int)floor(50*features[36]+100);
pitch = (int)floor(.1 + 50*features[36]+100);
/* FIXME: get the pitch gain from 2 frames in the past. */
pitch_gain = features[PITCH_GAIN_FEATURE];
run_frame_network(lpcnet, condition, gru_a_condition, features, pitch);