[hts-users:01636] HTS_vocoder.c: float to short conversion
- Subject: [hts-users:01636] HTS_vocoder.c: float to short conversion
- From: "Nicholas Volk" <nvolk@xxxxxxxxxx>
- Date: Sat, 9 Aug 2008 12:54:00 +0300 (EEST)
- Delivered-to: hts-users@xxxxxxxxxxxxxxx
- Importance: Normal
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
- Follow-Ups
-
- [hts-users:01637] harmless bug in HTS_pstream(), Nicholas Volk
- [hts-users:01640] Re: HTS_vocoder.c: float to short conversion, Keiichiro Oura