[Subject Prev][Subject Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hts-users:01877] Re: bug fix in HGen.c in Calc_WUM_and_WUW


Matt Shannon wrote:

There's a small bug in HGen.c.  It should make no difference for
standard use, e.g. for the HTS demo.

In Calc_WUM_and_WUW, the range checking of each window is inconsistent
with the actual use of the window coefficients.  Specifically,
'win.width[d][WLEFT]' and 'win.width[d][WRIGHT]' should be the left and
right ends of window 'd', while the window coefficient is accessed via
'win.coef[d][-j]' rather than 'win.coef[d][j]'.  This could lead to
undefined behaviour if we access outside the bounds of the array.

Thankfully, the left and right sizes of the windows are typically the
same.  The procedure which reads in the windows from file always assigns
the same length to them for odd-length windows (the norm).  And HTS demo
can only ever use odd-length windows.  Thus under typical use the bug
will not be visible.

I noticed this while using code where the left and right window sizes
aren't the same, so I can confirm that this is the only place this
problem seems to occur.

If the window coefficients is

2 -1.0 1.0

it is unable to determine which it means,

 delta c_t = c_t - c_{t-1},


 delta c_t = c_{t+1} - c_t.

I needed to choose one of them, so I chose the first one. It is done in HGen.c:InitWindow() as

      /* Set pointer */
      pst->win.coef[i] += winlen/2;
      pst->win.width[i][WLEFT]  = -winlen/2;
      pst->win.width[i][WRIGHT] =  winlen/2;
      if (winlen%2 == 0)

As you can see, if the length of window coefficients is an even number, HTS decrements pst->win.width[i][WRIGHT] rather than pst->win.width[i][WLEFT].

If you want to use even number length window coefficients, I recommend you to fill 0 as

3 0.0 -1.0 1.0


3 -1.0 1.0 0.0

to avoid ambiguity.

HTS-demo/data/window.pl stops if the length of given window file is not an odd number as

   if ($size % 2 != 1) {
      die "Size of window must be 2*n + 1 and float";

Best regards,

Heiga ZEN (Byung Ha CHUN)

Heiga ZEN (Byung Ha CHUN)
Speech Technology Group
Cambridge Research Lab
Toshiba Research Europe
phone: +44 1223 436975

This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
[hts-users:01876] bug fix in HGen.c in Calc_WUM_and_WUW, Matt Shannon