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

[hts-users:01640] Re: HTS_vocoder.c: float to short conversion


Hi, Nicholas

Thank you for your cooperation.
I'll release a next version of hts_engine API with these replacement and bug fix.

Regards,
Keiichiro Oura

Nicholas Volk wrote:
Hi,

Some minor corrections/suggestions...

The conversion of sample from float to short x in HTS_vocoder.c is
currently done as follows:

      /* output */
      xs = (short) x;

However, if x exceeds the minimum or maximum value of short, the
signedness may go wrong (you can see the difference in alice01.wav when
using LSP (Cygwin/gcc)). A simple fix should do:

      /* output */
      if ( x > 32767 ) { x = 32767; }
      else if ( x < -32768 ) { x = -32768; }
      xs = (short) x;


Also in the same file, I think it would be much more simpler to replace
v->pade with:

static const double pade[21] = {
  1.00000000000,
  1.00000000000, 0.00000000000,
  1.00000000000, 0.00000000000, 0.00000000000,
  1.00000000000, 0.00000000000, 0.00000000000, 0.00000000000,
  1.00000000000, 0.49992730000, 0.10670050000, 0.01170221000, 0.00056562790,
  1.00000000000, 0.49993910000, 0.11070980000, 0.01369984000, 0.00095648530,
  0.00003041721
};

(Less code, no memory allocations etc required...)

br,
  Nicholas

Nicholas Volk wrote:
> HTS_PStreamSet_create() has a minor bug:
>
>                         if (not_bound || k == 0)
>                            pst->sm.ivar[msd_frame][m] =
>                                HTS_finv(HTS_SStreamSet_get_vari
>                                         (sss, i, state, m));
>                         else
>                            pst->sm.ivar[msd_frame][k] = 0.0;
>
> The last line should be
>
>                            pst->sm.ivar[msd_frame][m] = 0.0;
>
>
> In HTS_demo-SLT m == k, so the bug is harmless there, but it might
> theoretically affect other implementations.
>
> br,
>   Nicholas

References
[hts-users:01636] HTS_vocoder.c: float to short conversion, Nicholas Volk