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

[debian-devel:18166] open-jtalk, htsengine 更新



こんにちは、あかべです。
いつもお世話になっています。

Open JTalk と HTS Engine の新しいバージョンがリリースされたので、パッケージを更新して mentors にアップロードしました。

http://mentors.debian.net/debian/pool/main/h/htsengine/htsengine_1.06-1.dsc
http://mentors.debian.net/debian/pool/main/o/open-jtalk/open-jtalk_1.05-1.dsc

open-jtalkパッケージの説明を若干変更しました。

Open JTalk is a Japanese text-to-speech system based on HTS engine. This
program uses Mecab and its dictionary which is optimized for Open JTalk
to analyse texts and gets pronunciation.

debbdiffの内容を添付しましたが、EUC-JPとUTF-8が混在していたため一部をUTF-8に変更した上でdebdiffしました。

アップロードしていただけませんか。
よろしくおねがいします。

-- 
Koichi Akabe
 vbkaisetsu at {gmail.com, debian.or.jp}
diff -Nru htsengine-1.05/AUTHORS htsengine-1.06/AUTHORS
--- htsengine-1.05/AUTHORS	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/AUTHORS	2011-12-20 23:43:28.000000000 +0900
@@ -1,7 +1,7 @@
 The hts_engine API is software to synthesize speech waveform from HMMs trained
 by the HMM-based speech synthesis system (HTS). This software is released
-under the New and Simplified BSD license. See the COPYING file in the same
-directory as this file for the license.
+under the Modified BSD license. See the COPYING file in the same directory as
+this file for the license.
 
 The hts_engine_API has been developed by several members of HTS working group
 and some graduate students in Nagoya Institute of Technology:
diff -Nru htsengine-1.05/ChangeLog htsengine-1.06/ChangeLog
--- htsengine-1.05/ChangeLog	2011-07-07 08:05:47.000000000 +0900
+++ htsengine-1.06/ChangeLog	2011-12-20 23:47:01.000000000 +0900
@@ -1,3 +1,52 @@
+2011-12-20 23:46  uratec
+
+	* AUTHORS, ChangeLog, README: Fix documents.
+
+2011-12-20 13:18  uratec
+
+	* ChangeLog, include/HTS_engine.h: Fix macro
+
+2011-12-20 11:24  uratec
+
+	* ChangeLog, NEWS, README, configure.ac, include/HTS_engine.h:
+	  Update documents to version 1.06
+
+2011-12-20 11:21  uratec
+
+	* lib/HTS_misc.c: Fix a tiny bug of file loading
+
+2011-12-12 13:02  uratec
+
+	* ChangeLog, include/HTS_engine.h, lib/HTS_engine.c,
+	  lib/HTS_gstream.c, lib/HTS_hidden.h, lib/HTS_label.c,
+	  lib/HTS_misc.c, lib/HTS_model.c, lib/HTS_pstream.c,
+	  lib/HTS_sstream.c, lib/HTS_vocoder.c: Change many function from
+	  void to boolean.
+
+2011-12-12 11:21  uratec
+
+	* ChangeLog, bin/hts_engine.c, include/HTS_engine.h,
+	  lib/HTS_audio.c, lib/HTS_engine.c, lib/HTS_gstream.c,
+	  lib/HTS_hidden.h, lib/HTS_label.c, lib/HTS_misc.c,
+	  lib/HTS_model.c, lib/HTS_pstream.c, lib/HTS_sstream.c,
+	  lib/HTS_vocoder.c: Change source format.
+
+2011-12-12 11:15  uratec
+
+	* ChangeLog, bin/hts_engine.c, include/HTS_engine.h,
+	  lib/HTS_engine.c, lib/HTS_hidden.h, lib/HTS_label.c,
+	  lib/HTS_misc.c, lib/HTS_model.c, lib/HTS_sstream.c: Add FILE
+	  wrapper. Modify state duration calculation.
+
+2011-08-10 21:16  uratec
+
+	* ChangeLog, configure.ac, lib/HTS_label.c: fix a small bug in
+	  label loader.
+
+2011-08-10 21:14  uratec
+
+	* lib/HTS_audio.c: remove warning message of PortAudio.
+
 2011-07-07 08:05  uratec
 
 	* ChangeLog, NEWS, README, configure.ac, include/HTS_engine.h,
diff -Nru htsengine-1.05/NEWS htsengine-1.06/NEWS
--- htsengine-1.05/NEWS	2011-07-07 07:59:29.000000000 +0900
+++ htsengine-1.06/NEWS	2011-12-20 11:16:00.000000000 +0900
@@ -1,3 +1,9 @@
+Version 1.06:
+ * modify state duration calculation algorithm.
+ * change many function from void to boolean.
+ * change source format.
+ * bug fixes.
+
 Version 1.05:
  * support PortAudio for audio output.
 
diff -Nru htsengine-1.05/README htsengine-1.06/README
--- htsengine-1.05/README	2011-07-07 07:59:29.000000000 +0900
+++ htsengine-1.06/README	2011-12-20 23:42:44.000000000 +0900
@@ -1,6 +1,6 @@
 ===============================================================================
-      The HMM-Based Speech Synthesis Engine "hts_engine API" version 1.05
-                             release July 7, 2011
+      The HMM-Based Speech Synthesis Engine "hts_engine API" version 1.06
+                           release December 25, 2011
 
 
 The hts_engine API is an API version of hts_engine which has been released
@@ -12,7 +12,7 @@
                                     Copying
 *******************************************************************************
 
-The hts_engine API is released under the New and Simplified BSD license (see
+The hts_engine API is released under the Modified BSD license (see
 http://www.opensource.org/). Using and distributing this software is free
 (without restriction including without limitation the rights to use, copy,
 modify, merge, publish, distribute, sublicense, and/or sell copies of this
diff -Nru htsengine-1.05/bin/hts_engine.c htsengine-1.06/bin/hts_engine.c
--- htsengine-1.05/bin/hts_engine.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/bin/hts_engine.c	2011-12-20 11:11:29.000000000 +0900
@@ -67,102 +67,57 @@
 {
    HTS_show_copyright(stderr);
    fprintf(stderr, "\n");
-   fprintf(stderr,
-           "hts_engine - The HMM-based speech synthesis engine \"hts_engine API\"\n");
+   fprintf(stderr, "hts_engine - The HMM-based speech synthesis engine \"hts_engine API\"\n");
    fprintf(stderr, "\n");
    fprintf(stderr, "  usage:\n");
    fprintf(stderr, "       hts_engine [ options ] [ infile ] \n");
-   fprintf(stderr,
-           "  options:                                                                   [  def][ min--max]\n");
-   fprintf(stderr,
-           "    -td tree       : decision tree files for state duration                  [  N/A]\n");
-   fprintf(stderr,
-           "    -tm tree       : decision tree files for spectrum                        [  N/A]\n");
-   fprintf(stderr,
-           "    -tf tree       : decision tree files for Log F0                          [  N/A]\n");
-   fprintf(stderr,
-           "    -tl tree       : decision tree files for low-pass filter                 [  N/A]\n");
-   fprintf(stderr,
-           "    -md pdf        : model files for state duration                          [  N/A]\n");
-   fprintf(stderr,
-           "    -mm pdf        : model files for spectrum                                [  N/A]\n");
-   fprintf(stderr,
-           "    -mf pdf        : model files for Log F0                                  [  N/A]\n");
-   fprintf(stderr,
-           "    -ml pdf        : model files for low-pass filter                         [  N/A]\n");
-   fprintf(stderr,
-           "    -dm win        : window files for calculation delta of spectrum          [  N/A]\n");
-   fprintf(stderr,
-           "    -df win        : window files for calculation delta of Log F0            [  N/A]\n");
-   fprintf(stderr,
-           "    -dl win        : window files for calculation delta of low-pass filter   [  N/A]\n");
-   fprintf(stderr,
-           "    -od s          : filename of output label with duration                  [  N/A]\n");
-   fprintf(stderr,
-           "    -om s          : filename of output spectrum                             [  N/A]\n");
-   fprintf(stderr,
-           "    -of s          : filename of output Log F0                               [  N/A]\n");
-   fprintf(stderr,
-           "    -ol s          : filename of output low-pass filter                      [  N/A]\n");
-   fprintf(stderr,
-           "    -or s          : filename of output raw audio (generated speech)         [  N/A]\n");
-   fprintf(stderr,
-           "    -ow s          : filename of output wav audio (generated speech)         [  N/A]\n");
-   fprintf(stderr,
-           "    -ot s          : filename of output trace information                    [  N/A]\n");
-   fprintf(stderr,
-           "    -vp            : use phoneme alignment for duration                      [  N/A]\n");
-   fprintf(stderr,
-           "    -i  i f1 .. fi : enable interpolation & specify number(i),coefficient(f) [    1][   1-- ]\n");
-   fprintf(stderr,
-           "    -s  i          : sampling frequency                                      [16000][   1--48000]\n");
-   fprintf(stderr,
-           "    -p  i          : frame period (point)                                    [   80][   1--]\n");
-   fprintf(stderr,
-           "    -a  f          : all-pass constant                                       [ 0.42][ 0.0--1.0]\n");
-   fprintf(stderr,
-           "    -g  i          : gamma = -1 / i (if i=0 then gamma=0)                    [    0][   0-- ]\n");
-   fprintf(stderr,
-           "    -b  f          : postfiltering coefficient                               [  0.0][-0.8--0.8]\n");
-   fprintf(stderr,
-           "    -l             : regard input as log gain and output linear one (LSP)    [  N/A]\n");
-   fprintf(stderr,
-           "    -r  f          : speech speed rate                                       [  1.0][ 0.0--10.0]\n");
-   fprintf(stderr,
-           "    -fm f          : add half-tone                                           [  0.0][-24.0--24.0]\n");
-   fprintf(stderr,
-           "    -u  f          : voiced/unvoiced threshold                               [  0.5][ 0.0--1.0]\n");
-   fprintf(stderr,
-           "    -em tree       : decision tree files for GV of spectrum                  [  N/A]\n");
-   fprintf(stderr,
-           "    -ef tree       : decision tree files for GV of Log F0                    [  N/A]\n");
-   fprintf(stderr,
-           "    -el tree       : decision tree files for GV of low-pass filter           [  N/A]\n");
-   fprintf(stderr,
-           "    -cm pdf        : filenames of GV for spectrum                            [  N/A]\n");
-   fprintf(stderr,
-           "    -cf pdf        : filenames of GV for Log F0                              [  N/A]\n");
-   fprintf(stderr,
-           "    -cl pdf        : filenames of GV for low-pass filter                     [  N/A]\n");
-   fprintf(stderr,
-           "    -jm f          : weight of GV for spectrum                               [  1.0][ 0.0--2.0]\n");
-   fprintf(stderr,
-           "    -jf f          : weight of GV for Log F0                                 [  1.0][ 0.0--2.0]\n");
-   fprintf(stderr,
-           "    -jl f          : weight of GV for low-pass filter                        [  1.0][ 0.0--2.0]\n");
-   fprintf(stderr,
-           "    -k  tree       : GV switch                                               [  N/A]\n");
-   fprintf(stderr,
-           "    -z  i          : audio buffer size                                       [ 1600][   0--48000]\n");
+   fprintf(stderr, "  options:                                                                   [  def][ min--max]\n");
+   fprintf(stderr, "    -td tree       : decision tree files for state duration                  [  N/A]\n");
+   fprintf(stderr, "    -tm tree       : decision tree files for spectrum                        [  N/A]\n");
+   fprintf(stderr, "    -tf tree       : decision tree files for Log F0                          [  N/A]\n");
+   fprintf(stderr, "    -tl tree       : decision tree files for low-pass filter                 [  N/A]\n");
+   fprintf(stderr, "    -md pdf        : model files for state duration                          [  N/A]\n");
+   fprintf(stderr, "    -mm pdf        : model files for spectrum                                [  N/A]\n");
+   fprintf(stderr, "    -mf pdf        : model files for Log F0                                  [  N/A]\n");
+   fprintf(stderr, "    -ml pdf        : model files for low-pass filter                         [  N/A]\n");
+   fprintf(stderr, "    -dm win        : window files for calculation delta of spectrum          [  N/A]\n");
+   fprintf(stderr, "    -df win        : window files for calculation delta of Log F0            [  N/A]\n");
+   fprintf(stderr, "    -dl win        : window files for calculation delta of low-pass filter   [  N/A]\n");
+   fprintf(stderr, "    -od s          : filename of output label with duration                  [  N/A]\n");
+   fprintf(stderr, "    -om s          : filename of output spectrum                             [  N/A]\n");
+   fprintf(stderr, "    -of s          : filename of output Log F0                               [  N/A]\n");
+   fprintf(stderr, "    -ol s          : filename of output low-pass filter                      [  N/A]\n");
+   fprintf(stderr, "    -or s          : filename of output raw audio (generated speech)         [  N/A]\n");
+   fprintf(stderr, "    -ow s          : filename of output wav audio (generated speech)         [  N/A]\n");
+   fprintf(stderr, "    -ot s          : filename of output trace information                    [  N/A]\n");
+   fprintf(stderr, "    -vp            : use phoneme alignment for duration                      [  N/A]\n");
+   fprintf(stderr, "    -i  i f1 .. fi : enable interpolation & specify number(i),coefficient(f) [    1][   1-- ]\n");
+   fprintf(stderr, "    -s  i          : sampling frequency                                      [16000][   1--48000]\n");
+   fprintf(stderr, "    -p  i          : frame period (point)                                    [   80][   1--]\n");
+   fprintf(stderr, "    -a  f          : all-pass constant                                       [ 0.42][ 0.0--1.0]\n");
+   fprintf(stderr, "    -g  i          : gamma = -1 / i (if i=0 then gamma=0)                    [    0][   0-- ]\n");
+   fprintf(stderr, "    -b  f          : postfiltering coefficient                               [  0.0][-0.8--0.8]\n");
+   fprintf(stderr, "    -l             : regard input as log gain and output linear one (LSP)    [  N/A]\n");
+   fprintf(stderr, "    -r  f          : speech speed rate                                       [  1.0][ 0.0--10.0]\n");
+   fprintf(stderr, "    -fm f          : add half-tone                                           [  0.0][-24.0--24.0]\n");
+   fprintf(stderr, "    -u  f          : voiced/unvoiced threshold                               [  0.5][ 0.0--1.0]\n");
+   fprintf(stderr, "    -em tree       : decision tree files for GV of spectrum                  [  N/A]\n");
+   fprintf(stderr, "    -ef tree       : decision tree files for GV of Log F0                    [  N/A]\n");
+   fprintf(stderr, "    -el tree       : decision tree files for GV of low-pass filter           [  N/A]\n");
+   fprintf(stderr, "    -cm pdf        : filenames of GV for spectrum                            [  N/A]\n");
+   fprintf(stderr, "    -cf pdf        : filenames of GV for Log F0                              [  N/A]\n");
+   fprintf(stderr, "    -cl pdf        : filenames of GV for low-pass filter                     [  N/A]\n");
+   fprintf(stderr, "    -jm f          : weight of GV for spectrum                               [  1.0][ 0.0--2.0]\n");
+   fprintf(stderr, "    -jf f          : weight of GV for Log F0                                 [  1.0][ 0.0--2.0]\n");
+   fprintf(stderr, "    -jl f          : weight of GV for low-pass filter                        [  1.0][ 0.0--2.0]\n");
+   fprintf(stderr, "    -k  tree       : GV switch                                               [  N/A]\n");
+   fprintf(stderr, "    -z  i          : audio buffer size                                       [ 1600][   0--48000]\n");
    fprintf(stderr, "  infile:\n");
    fprintf(stderr, "    label file\n");
    fprintf(stderr, "  note:\n");
-   fprintf(stderr,
-           "    option '-d' may be repeated to use multiple delta parameters.\n");
-   fprintf(stderr,
-           "    generated spectrum, log F0, and low-pass filter coefficient\n");
-   fprintf(stderr,
-           "    sequences are saved in natural endian, binary (float) format.\n");
+   fprintf(stderr, "    option '-d' may be repeated to use multiple delta parameters.\n");
+   fprintf(stderr, "    generated spectrum, log F0, and low-pass filter coefficient\n");
+   fprintf(stderr, "    sequences are saved in natural endian, binary (float) format.\n");
    fprintf(stderr, "\n");
 
    exit(0);
@@ -191,17 +146,6 @@
       exit(error);
 }
 
-/* Getfp: wrapper for fopen */
-FILE *Getfp(const char *name, const char *opt)
-{
-   FILE *fp = fopen(name, opt);
-
-   if (fp == NULL)
-      Error(2, "Getfp: Cannot open %s.\n", name);
-
-   return (fp);
-}
-
 /* GetNumInterp: get number of speakers for interpolation from argv */
 int GetNumInterp(int argc, char **argv_search)
 {
@@ -225,8 +169,8 @@
    int i;
    double f;
    char *labfn = NULL;
-   FILE *durfp = NULL, *mgcfp = NULL, *lf0fp = NULL, *lpffp = NULL;
-   FILE *wavfp = NULL, *rawfp = NULL, *tracefp = NULL;
+   HTS_File *durfp = NULL, *mgcfp = NULL, *lf0fp = NULL, *lpffp = NULL;
+   HTS_File *wavfp = NULL, *rawfp = NULL, *tracefp = NULL;
 
    /* number of speakers for interpolation */
    int num_interp = 0;
@@ -394,26 +338,26 @@
          case 'o':
             switch (*(*argv + 2)) {
             case 'w':
-               wavfp = Getfp(*++argv, "wb");
+               wavfp = HTS_fopen(*++argv, "wb");
                break;
             case 'r':
-               rawfp = Getfp(*++argv, "wb");
+               rawfp = HTS_fopen(*++argv, "wb");
                break;
             case 'd':
-               durfp = Getfp(*++argv, "wt");
+               durfp = HTS_fopen(*++argv, "wt");
                break;
             case 'm':
-               mgcfp = Getfp(*++argv, "wb");
+               mgcfp = HTS_fopen(*++argv, "wb");
                break;
             case 'f':
             case 'p':
-               lf0fp = Getfp(*++argv, "wb");
+               lf0fp = HTS_fopen(*++argv, "wb");
                break;
             case 'l':
-               lpffp = Getfp(*++argv, "wb");
+               lpffp = HTS_fopen(*++argv, "wb");
                break;
             case 't':
-               tracefp = Getfp(*++argv, "wt");
+               tracefp = HTS_fopen(*++argv, "wt");
                break;
             default:
                Error(1, "hts_engine: Invalid option '-o%c'.\n", *(*argv + 2));
@@ -544,16 +488,12 @@
       }
    }
    /* number of models,trees check */
-   if (num_interp != num_ts_dur || num_interp != num_ts_mgc ||
-       num_interp != num_ts_lf0 || num_interp != num_ms_dur ||
-       num_interp != num_ms_mgc || num_interp != num_ms_lf0) {
-      Error(1, "hts_engine: specify %d models(trees) for each parameter.\n",
-            num_interp);
+   if (num_interp != num_ts_dur || num_interp != num_ts_mgc || num_interp != num_ts_lf0 || num_interp != num_ms_dur || num_interp != num_ms_mgc || num_interp != num_ms_lf0) {
+      Error(1, "hts_engine: specify %d models(trees) for each parameter.\n", num_interp);
    }
    if (num_ms_lpf > 0 || num_ts_lpf > 0) {
       if (num_interp != num_ms_lpf || num_interp != num_ts_lpf) {
-         Error(1, "hts_engine: specify %d models(trees) for each parameter.\n",
-               num_interp);
+         Error(1, "hts_engine: specify %d models(trees) for each parameter.\n", num_interp);
       }
    }
 
@@ -567,37 +507,30 @@
    /* load duration model */
    HTS_Engine_load_duration_from_fn(&engine, fn_ms_dur, fn_ts_dur, num_interp);
    /* load stream[0] (spectrum model) */
-   HTS_Engine_load_parameter_from_fn(&engine, fn_ms_mgc, fn_ts_mgc, fn_ws_mgc,
-                                     0, FALSE, num_ws_mgc, num_interp);
+   HTS_Engine_load_parameter_from_fn(&engine, fn_ms_mgc, fn_ts_mgc, fn_ws_mgc, 0, FALSE, num_ws_mgc, num_interp);
    /* load stream[1] (lf0 model) */
-   HTS_Engine_load_parameter_from_fn(&engine, fn_ms_lf0, fn_ts_lf0, fn_ws_lf0,
-                                     1, TRUE, num_ws_lf0, num_interp);
+   HTS_Engine_load_parameter_from_fn(&engine, fn_ms_lf0, fn_ts_lf0, fn_ws_lf0, 1, TRUE, num_ws_lf0, num_interp);
    /* load stream[2] (low-pass filter model) */
    if (num_ms_lpf > 0 || num_ts_lpf > 0)
-      HTS_Engine_load_parameter_from_fn(&engine, fn_ms_lpf, fn_ts_lpf,
-                                        fn_ws_lpf, 2, FALSE, num_ws_lpf,
-                                        num_interp);
+      HTS_Engine_load_parameter_from_fn(&engine, fn_ms_lpf, fn_ts_lpf, fn_ws_lpf, 2, FALSE, num_ws_lpf, num_interp);
    /* load gv[0] (GV for spectrum) */
    if (num_interp == num_ms_gvm) {
       if (num_ms_gvm == num_ts_gvm)
-         HTS_Engine_load_gv_from_fn(&engine, fn_ms_gvm, fn_ts_gvm, 0,
-                                    num_interp);
+         HTS_Engine_load_gv_from_fn(&engine, fn_ms_gvm, fn_ts_gvm, 0, num_interp);
       else
          HTS_Engine_load_gv_from_fn(&engine, fn_ms_gvm, NULL, 0, num_interp);
    }
    /* load gv[1] (GV for lf0) */
    if (num_interp == num_ms_gvl) {
       if (num_ms_gvl == num_ts_gvl)
-         HTS_Engine_load_gv_from_fn(&engine, fn_ms_gvl, fn_ts_gvl, 1,
-                                    num_interp);
+         HTS_Engine_load_gv_from_fn(&engine, fn_ms_gvl, fn_ts_gvl, 1, num_interp);
       else
          HTS_Engine_load_gv_from_fn(&engine, fn_ms_gvl, NULL, 1, num_interp);
    }
    /* load gv[2] (GV for low-pass filter) */
    if (num_interp == num_ms_gvf && (num_ms_lpf > 0 || num_ts_lpf > 0)) {
       if (num_ms_gvf == num_ts_gvf)
-         HTS_Engine_load_gv_from_fn(&engine, fn_ms_gvf, fn_ts_gvf, 0,
-                                    num_interp);
+         HTS_Engine_load_gv_from_fn(&engine, fn_ms_gvf, fn_ts_gvf, 0, num_interp);
       else
          HTS_Engine_load_gv_from_fn(&engine, fn_ms_gvf, NULL, 2, num_interp);
    }
@@ -620,13 +553,10 @@
       HTS_Engine_set_gv_weight(&engine, 2, gv_weight_lpf);
    for (i = 0; i < num_interp; i++) {
       HTS_Engine_set_duration_interpolation_weight(&engine, i, rate_interp[i]);
-      HTS_Engine_set_parameter_interpolation_weight(&engine, 0, i,
-                                                    rate_interp[i]);
-      HTS_Engine_set_parameter_interpolation_weight(&engine, 1, i,
-                                                    rate_interp[i]);
+      HTS_Engine_set_parameter_interpolation_weight(&engine, 0, i, rate_interp[i]);
+      HTS_Engine_set_parameter_interpolation_weight(&engine, 1, i, rate_interp[i]);
       if (num_ms_lpf > 0 || num_ts_lpf > 0)
-         HTS_Engine_set_parameter_interpolation_weight(&engine, 2, i,
-                                                       rate_interp[i]);
+         HTS_Engine_set_parameter_interpolation_weight(&engine, 2, i, rate_interp[i]);
    }
    if (num_interp == num_ms_gvm)
       for (i = 0; i < num_interp; i++)
@@ -699,19 +629,19 @@
 
    /* close files */
    if (durfp != NULL)
-      fclose(durfp);
+      HTS_fclose(durfp);
    if (mgcfp != NULL)
-      fclose(mgcfp);
+      HTS_fclose(mgcfp);
    if (lf0fp != NULL)
-      fclose(lf0fp);
+      HTS_fclose(lf0fp);
    if (lpffp != NULL)
-      fclose(lpffp);
+      HTS_fclose(lpffp);
    if (wavfp != NULL)
-      fclose(wavfp);
+      HTS_fclose(wavfp);
    if (rawfp != NULL)
-      fclose(rawfp);
+      HTS_fclose(rawfp);
    if (tracefp != NULL)
-      fclose(tracefp);
+      HTS_fclose(tracefp);
 
    return 0;
 }
diff -Nru htsengine-1.05/configure htsengine-1.06/configure
--- htsengine-1.05/configure	2011-07-07 08:00:42.000000000 +0900
+++ htsengine-1.06/configure	2011-12-20 23:56:41.000000000 +0900
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for hts_engine_API 1.05.
+# Generated by GNU Autoconf 2.63 for hts_engine_API 1.06.
 #
 # Report bugs to <hts-engine-users@xxxxxxxxxxxxxxxxxxxxx>.
 #
@@ -600,8 +600,8 @@
 # Identity of this package.
 PACKAGE_NAME='hts_engine_API'
 PACKAGE_TARNAME='hts_engine_api'
-PACKAGE_VERSION='1.05'
-PACKAGE_STRING='hts_engine_API 1.05'
+PACKAGE_VERSION='1.06'
+PACKAGE_STRING='hts_engine_API 1.06'
 PACKAGE_BUGREPORT='hts-engine-users@xxxxxxxxxxxxxxxxxxxxx'
 
 # Factoring default headers for most tests.
@@ -1299,7 +1299,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures hts_engine_API 1.05 to adapt to many kinds of systems.
+\`configure' configures hts_engine_API 1.06 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1369,7 +1369,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of hts_engine_API 1.05:";;
+     short | recursive ) echo "Configuration of hts_engine_API 1.06:";;
    esac
   cat <<\_ACEOF
 
@@ -1458,7 +1458,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-hts_engine_API configure 1.05
+hts_engine_API configure 1.06
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1476,7 +1476,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by hts_engine_API $as_me 1.05, which was
+It was created by hts_engine_API $as_me 1.06, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -2194,7 +2194,7 @@
 
 # Define the identity of the package.
  PACKAGE=hts_engine_API
- VERSION=1.05
+ VERSION=1.06
 
 
 # Some tools Automake needs.
@@ -6310,7 +6310,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by hts_engine_API $as_me 1.05, which was
+This file was extended by hts_engine_API $as_me 1.06, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6364,7 +6364,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-hts_engine_API config.status 1.05
+hts_engine_API config.status 1.06
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff -Nru htsengine-1.05/configure.ac htsengine-1.06/configure.ac
--- htsengine-1.05/configure.ac	2011-07-07 07:59:29.000000000 +0900
+++ htsengine-1.06/configure.ac	2011-12-20 11:11:29.000000000 +0900
@@ -2,11 +2,11 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT(hts_engine_API, 1.05, hts-engine-users@xxxxxxxxxxxxxxxxxxxxx)
+AC_INIT(hts_engine_API, 1.06, hts-engine-users@xxxxxxxxxxxxxxxxxxxxx)
 AC_CONFIG_AUX_DIR([config])
 AC_COPYRIGHT(Copyright 2001-2011 Nagoya Institute of Technology)
 AC_COPYRIGHT(Copyright 2001-2008 Tokyo Institute of Technology)
-AM_INIT_AUTOMAKE(hts_engine_API, 1.05, nostdinc no-installinfo no-installman)
+AM_INIT_AUTOMAKE(hts_engine_API, 1.06, nostdinc no-installinfo no-installman)
 
 # Checks for C compiler
 AC_PROG_CC
@@ -36,7 +36,7 @@
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([sqrt strchr strrchr strstr])
 
-       
+
 # Checks for embedded device compile
 AC_ARG_ENABLE(embedded, [  --enable-embedded   turn on compiling for embedded devices (default=no)],,enable_embedded=no)
 AC_MSG_CHECKING(whether to enable compiling for embedded devices)
diff -Nru htsengine-1.05/debian/changelog htsengine-1.06/debian/changelog
--- htsengine-1.05/debian/changelog	2011-12-10 12:16:12.000000000 +0900
+++ htsengine-1.06/debian/changelog	2011-12-25 10:10:40.000000000 +0900
@@ -1,3 +1,13 @@
+htsengine (1.06-1) unstable; urgency=low
+
+  * New upstream release
+    - modify state duration calculation algorithm.
+    - change many function from void to boolean.
+    - change source format.
+    - bug fixes.
+
+ -- Koichi Akabe <vbkaisetsu@xxxxxxxxx>  Sun, 25 Dec 2011 09:25:10 +0900
+
 htsengine (1.05-2) unstable; urgency=low
 
   * debian/control
diff -Nru htsengine-1.05/debian/patches/10_build_shared_lib.patch htsengine-1.06/debian/patches/10_build_shared_lib.patch
--- htsengine-1.05/debian/patches/10_build_shared_lib.patch	2011-12-01 23:25:24.000000000 +0900
+++ htsengine-1.06/debian/patches/10_build_shared_lib.patch	2011-12-25 10:13:52.000000000 +0900
@@ -2,13 +2,11 @@
  The upstream version provides only static library and Open JTalk
  uses it. This patch changes to build a shared library.
 Author: Koichi Akabe <vbkaisetsu@xxxxxxxxx>
-Last-Update: 2011-11-30
+Last-Update: 2011-12-25
 
---- htsengine-1.05.orig/configure.ac
-+++ htsengine-1.05/configure.ac
-@@ -8,9 +8,13 @@
- AC_COPYRIGHT(Copyright 2001-2008 Tokyo Institute of Technology)
- AM_INIT_AUTOMAKE(hts_engine_API, 1.05, nostdinc no-installinfo no-installman)
+--- htsengine-1.06.orig/configure.ac
++++ htsengine-1.06/configure.ac
+@@ -10,7 +10,11 @@
  
 +LTVERSION="1:0:0"
 +AC_SUBST(LTVERSION)
diff -Nru htsengine-1.05/include/HTS_engine.h htsengine-1.06/include/HTS_engine.h
--- htsengine-1.05/include/HTS_engine.h	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/include/HTS_engine.h	2011-12-20 13:16:05.000000000 +0900
@@ -44,6 +44,7 @@
 
 #ifndef HTS_ENGINE_H
 #define HTS_ENGINE_H
+
 #ifdef __cplusplus
 #define HTS_ENGINE_H_START extern "C" {
 #define HTS_ENGINE_H_END   }
@@ -51,28 +52,11 @@
 #define HTS_ENGINE_H_START
 #define HTS_ENGINE_H_END
 #endif                          /* __CPLUSPLUS */
+
 HTS_ENGINE_H_START;
 
 #include <stdio.h>
 
-/*  ------------------------ copyright ----------------------------  */
-
-#ifdef PACKAGE_VERSION
-#define HTS_VERSION   PACKAGE_VERSION
-#else
-#define HTS_VERSION   "1.05"
-#endif
-#define HTS_URL       "http://hts-engine.sourceforge.net/";
-#define HTS_COPYRIGHT "2001-2011  Nagoya Institute of Technology", \
-                      "2001-2008  Tokyo Institute of Technology"
-#define HTS_NCOPYRIGHT 2
-
-/* HTS_show_copyright: write copyright to file pointer */
-void HTS_show_copyright(FILE * fp);
-
-/* HTS_get_copyright: write copyright to string */
-void HTS_get_copyright(char *str);
-
 /*  -------------------------- common -----------------------------  */
 
 typedef int HTS_Boolean;
@@ -87,6 +71,28 @@
 #define LZERO (-1.0e+10)        /* ~log(0) */
 #define LTPI  1.83787706640935  /* log(2*PI) */
 
+typedef FILE HTS_File;
+
+/* HTS_fopen: wrapper for fopen */
+HTS_File *HTS_fopen(const char *name, const char *opt);
+
+/* HTS_fclose: wrapper for fclose */
+void HTS_fclose(HTS_File * fp);
+
+/*  ------------------------ copyright ----------------------------  */
+
+#define HTS_VERSION   "1.06"
+#define HTS_URL       "http://hts-engine.sourceforge.net/";
+#define HTS_COPYRIGHT "2001-2011  Nagoya Institute of Technology", \
+                      "2001-2008  Tokyo Institute of Technology"
+#define HTS_NCOPYRIGHT 2
+
+/* HTS_show_copyright: write copyright to file pointer */
+void HTS_show_copyright(HTS_File * fp);
+
+/* HTS_get_copyright: write copyright to string */
+void HTS_get_copyright(char *str);
+
 /*  -------------------------- audio ------------------------------  */
 
 #if !defined(AUDIO_PLAY_WINCE) && !defined(AUDIO_PLAY_WIN32) && !defined(AUDIO_PLAY_PORTAUDIO) && !defined(AUDIO_PLAY_NONE)
@@ -142,12 +148,10 @@
 /*  ------------------------ audio method -------------------------  */
 
 /* HTS_Audio_initialize: initialize audio */
-void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate,
-                          int max_buff_size);
+void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate, int max_buff_size);
 
 /* HTS_Audio_set_parameter: set parameters for audio */
-void HTS_Audio_set_parameter(HTS_Audio * audio, int sampling_rate,
-                             int max_buff_size);
+void HTS_Audio_set_parameter(HTS_Audio * audio, int sampling_rate, int max_buff_size);
 
 /* HTS_Audio_write: send data to audio */
 void HTS_Audio_write(HTS_Audio * audio, short data);
@@ -235,24 +239,19 @@
 void HTS_ModelSet_initialize(HTS_ModelSet * ms, int nstream);
 
 /* HTS_ModelSet_load_duration: load duration model and number of state */
-void HTS_ModelSet_load_duration(HTS_ModelSet * ms, FILE ** pdf_fp,
-                                FILE ** tree_fp, int interpolation_size);
+HTS_Boolean HTS_ModelSet_load_duration(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, int interpolation_size);
 
 /* HTS_ModelSet_load_parameter: load parameter model */
-void HTS_ModelSet_load_parameter(HTS_ModelSet * ms, FILE ** pdf_fp,
-                                 FILE ** tree_fp, FILE ** win_fp,
-                                 int stream_index, HTS_Boolean msd_flag,
-                                 int window_size, int interpolation_size);
+HTS_Boolean HTS_ModelSet_load_parameter(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, HTS_File ** win_fp, int stream_index, HTS_Boolean msd_flag, int window_size, int interpolation_size);
 
 /* HTS_ModelSet_load_gv: load GV model */
-void HTS_ModelSet_load_gv(HTS_ModelSet * ms, FILE ** pdf_fp, FILE ** tree_fp,
-                          int stream_index, int interpolation_size);
+HTS_Boolean HTS_ModelSet_load_gv(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, int stream_index, int interpolation_size);
 
 /* HTS_ModelSet_have_gv_tree: if context-dependent GV is used, return true */
 HTS_Boolean HTS_ModelSet_have_gv_tree(HTS_ModelSet * ms, int stream_index);
 
 /* HTS_ModelSet_load_gv_switch: load GV switch */
-void HTS_ModelSet_load_gv_switch(HTS_ModelSet * ms, FILE * fp);
+HTS_Boolean HTS_ModelSet_load_gv_switch(HTS_ModelSet * ms, HTS_File * fp);
 
 /* HTS_ModelSet_have_gv_switch: if GV switch is used, return true */
 HTS_Boolean HTS_ModelSet_have_gv_switch(HTS_ModelSet * ms);
@@ -273,17 +272,13 @@
 int HTS_ModelSet_get_window_size(HTS_ModelSet * ms, int stream_index);
 
 /* HTS_ModelSet_get_window_left_width: get left width of dynamic window */
-int HTS_ModelSet_get_window_left_width(HTS_ModelSet * ms, int stream_index,
-                                       int window_index);
+int HTS_ModelSet_get_window_left_width(HTS_ModelSet * ms, int stream_index, int window_index);
 
 /* HTS_ModelSet_get_window_right_width: get right width of dynamic window */
-int HTS_ModelSet_get_window_right_width(HTS_ModelSet * ms, int stream_index,
-                                        int window_index);
+int HTS_ModelSet_get_window_right_width(HTS_ModelSet * ms, int stream_index, int window_index);
 
 /* HTS_ModelSet_get_window_coefficient: get coefficient of dynamic window */
-double HTS_ModelSet_get_window_coefficient(HTS_ModelSet * ms, int stream_index,
-                                           int window_index,
-                                           int coefficient_index);
+double HTS_ModelSet_get_window_coefficient(HTS_ModelSet * ms, int stream_index, int window_index, int coefficient_index);
 
 /* HTS_ModelSet_get_window_max_width: get max width of dynamic window */
 int HTS_ModelSet_get_window_max_width(HTS_ModelSet * ms, int stream_index);
@@ -292,8 +287,7 @@
 int HTS_ModelSet_get_duration_interpolation_size(HTS_ModelSet * ms);
 
 /* HTS_ModelSet_get_parameter_interpolation_size: get interpolation size (parameter model) */
-int HTS_ModelSet_get_parameter_interpolation_size(HTS_ModelSet * ms,
-                                                  int stream_index);
+int HTS_ModelSet_get_parameter_interpolation_size(HTS_ModelSet * ms, int stream_index);
 
 /* HTS_ModelSet_get_gv_interpolation_size: get interpolation size (GV model) */
 int HTS_ModelSet_get_gv_interpolation_size(HTS_ModelSet * ms, int stream_index);
@@ -302,28 +296,19 @@
 HTS_Boolean HTS_ModelSet_use_gv(HTS_ModelSet * ms, int index);
 
 /* HTS_ModelSet_get_duration_index: get index of duration tree and PDF */
-void HTS_ModelSet_get_duration_index(HTS_ModelSet * ms, char *string,
-                                     int *tree_index, int *pdf_index,
-                                     int interpolation_index);
+void HTS_ModelSet_get_duration_index(HTS_ModelSet * ms, char *string, int *tree_index, int *pdf_index, int interpolation_index);
 
 /* HTS_ModelSet_get_duration: get duration using interpolation weight */
-void HTS_ModelSet_get_duration(HTS_ModelSet * ms, char *string, double *mean,
-                               double *vari, double *iw);
+void HTS_ModelSet_get_duration(HTS_ModelSet * ms, char *string, double *mean, double *vari, double *iw);
 
 /* HTS_ModelSet_get_parameter_index: get index of parameter tree and PDF */
-void HTS_ModelSet_get_parameter_index(HTS_ModelSet * ms, char *string,
-                                      int *tree_index, int *pdf_index,
-                                      int stream_index, int state_index,
-                                      int interpolation_index);
+void HTS_ModelSet_get_parameter_index(HTS_ModelSet * ms, char *string, int *tree_index, int *pdf_index, int stream_index, int state_index, int interpolation_index);
 
 /* HTS_ModelSet_get_parameter: get parameter using interpolation weight */
-void HTS_ModelSet_get_parameter(HTS_ModelSet * ms, char *string, double *mean,
-                                double *vari, double *msd, int stream_index,
-                                int state_index, double *iw);
+void HTS_ModelSet_get_parameter(HTS_ModelSet * ms, char *string, double *mean, double *vari, double *msd, int stream_index, int state_index, double *iw);
 
 /* HTS_ModelSet_get_gv: get GV using interpolation weight */
-void HTS_ModelSet_get_gv(HTS_ModelSet * ms, char *string, double *mean,
-                         double *vari, int stream_index, double *iw);
+void HTS_ModelSet_get_gv(HTS_ModelSet * ms, char *string, double *mean, double *vari, int stream_index, double *iw);
 
 /* HTS_ModelSet_get_gv_switch: get GV switch */
 HTS_Boolean HTS_ModelSet_get_gv_switch(HTS_ModelSet * ms, char *string);
@@ -355,20 +340,16 @@
 void HTS_Label_initialize(HTS_Label * label);
 
 /* HTS_Label_load_from_fn: load label from file name */
-void HTS_Label_load_from_fn(HTS_Label * label, int sampling_rate, int fperiod,
-                            char *fn);
+void HTS_Label_load_from_fn(HTS_Label * label, int sampling_rate, int fperiod, char *fn);
 
 /* HTS_Label_load_from_fp: load label list from file pointer */
-void HTS_Label_load_from_fp(HTS_Label * label, int sampling_rate, int fperiod,
-                            FILE * fp);
+void HTS_Label_load_from_fp(HTS_Label * label, int sampling_rate, int fperiod, HTS_File * fp);
 
 /* HTS_Label_load_from_string: load label from string */
-void HTS_Label_load_from_string(HTS_Label * label, int sampling_rate,
-                                int fperiod, char *data);
+void HTS_Label_load_from_string(HTS_Label * label, int sampling_rate, int fperiod, char *data);
 
 /* HTS_Label_load_from_string_list: load label list from string list */
-void HTS_Label_load_from_string_list(HTS_Label * label, int sampling_rate,
-                                     int fperiod, char **data, int size);
+void HTS_Label_load_from_string_list(HTS_Label * label, int sampling_rate, int fperiod, char **data, int size);
 
 /* HTS_Label_set_speech_speed: set speech speed rate */
 void HTS_Label_set_speech_speed(HTS_Label * label, double f);
@@ -431,9 +412,7 @@
 void HTS_SStreamSet_initialize(HTS_SStreamSet * sss);
 
 /* HTS_SStreamSet_create: parse label and determine state duration */
-void HTS_SStreamSet_create(HTS_SStreamSet * sss, HTS_ModelSet * ms,
-                           HTS_Label * label, double *duration_iw,
-                           double **parameter_iw, double **gv_iw);
+HTS_Boolean HTS_SStreamSet_create(HTS_SStreamSet * sss, HTS_ModelSet * ms, HTS_Label * label, double *duration_iw, double **parameter_iw, double **gv_iw);
 
 /* HTS_SStreamSet_get_nstream: get number of stream */
 int HTS_SStreamSet_get_nstream(HTS_SStreamSet * sss);
@@ -451,24 +430,19 @@
 int HTS_SStreamSet_get_total_frame(HTS_SStreamSet * sss);
 
 /* HTS_SStreamSet_get_msd: get msd parameter */
-double HTS_SStreamSet_get_msd(HTS_SStreamSet * sss, int stream_index,
-                              int state_index);
+double HTS_SStreamSet_get_msd(HTS_SStreamSet * sss, int stream_index, int state_index);
 
 /* HTS_SStreamSet_window_size: get dynamic window size */
 int HTS_SStreamSet_get_window_size(HTS_SStreamSet * sss, int stream_index);
 
 /* HTS_SStreamSet_get_window_left_width: get left width of dynamic window */
-int HTS_SStreamSet_get_window_left_width(HTS_SStreamSet * sss, int stream_index,
-                                         int window_index);
+int HTS_SStreamSet_get_window_left_width(HTS_SStreamSet * sss, int stream_index, int window_index);
 
 /* HTS_SStreamSet_get_window_right_width: get right width of dynamic window */
-int HTS_SStreamSet_get_window_right_width(HTS_SStreamSet * sss,
-                                          int stream_index, int window_index);
+int HTS_SStreamSet_get_window_right_width(HTS_SStreamSet * sss, int stream_index, int window_index);
 
 /* HTS_SStreamSet_get_window_coefficient: get coefficient of dynamic window */
-double HTS_SStreamSet_get_window_coefficient(HTS_SStreamSet * sss,
-                                             int stream_index, int window_index,
-                                             int coefficient_index);
+double HTS_SStreamSet_get_window_coefficient(HTS_SStreamSet * sss, int stream_index, int window_index, int coefficient_index);
 
 /* HTS_SStreamSet_get_window_max_width: get max width of dynamic window */
 int HTS_SStreamSet_get_window_max_width(HTS_SStreamSet * sss, int stream_index);
@@ -480,36 +454,28 @@
 int HTS_SStreamSet_get_duration(HTS_SStreamSet * sss, int state_index);
 
 /* HTS_SStreamSet_get_mean: get mean parameter */
-double HTS_SStreamSet_get_mean(HTS_SStreamSet * sss, int stream_index,
-                               int state_index, int vector_index);
+double HTS_SStreamSet_get_mean(HTS_SStreamSet * sss, int stream_index, int state_index, int vector_index);
 
 /* HTS_SStreamSet_set_mean: set mean parameter */
-void HTS_SStreamSet_set_mean(HTS_SStreamSet * sss, int stream_index,
-                             int state_index, int vector_index, double f);
+void HTS_SStreamSet_set_mean(HTS_SStreamSet * sss, int stream_index, int state_index, int vector_index, double f);
 
 /* HTS_SStreamSet_get_vari: get variance parameter */
-double HTS_SStreamSet_get_vari(HTS_SStreamSet * sss, int stream_index,
-                               int state_index, int vector_index);
+double HTS_SStreamSet_get_vari(HTS_SStreamSet * sss, int stream_index, int state_index, int vector_index);
 
 /* HTS_SStreamSet_set_vari: set variance parameter */
-void HTS_SStreamSet_set_vari(HTS_SStreamSet * sss, int stream_index,
-                             int state_index, int vector_index, double f);
+void HTS_SStreamSet_set_vari(HTS_SStreamSet * sss, int stream_index, int state_index, int vector_index, double f);
 
 /* HTS_SStreamSet_get_gv_mean: get GV mean parameter */
-double HTS_SStreamSet_get_gv_mean(HTS_SStreamSet * sss, int stream_index,
-                                  int vector_index);
+double HTS_SStreamSet_get_gv_mean(HTS_SStreamSet * sss, int stream_index, int vector_index);
 
 /* HTS_SStreamSet_get_gv_mean: get GV variance parameter */
-double HTS_SStreamSet_get_gv_vari(HTS_SStreamSet * sss, int stream_index,
-                                  int vector_index);
+double HTS_SStreamSet_get_gv_vari(HTS_SStreamSet * sss, int stream_index, int vector_index);
 
 /* HTS_SStreamSet_set_gv_switch: set GV switch */
-void HTS_SStreamSet_set_gv_switch(HTS_SStreamSet * sss, int stream_index,
-                                  int state_index, HTS_Boolean i);
+void HTS_SStreamSet_set_gv_switch(HTS_SStreamSet * sss, int stream_index, int state_index, HTS_Boolean i);
 
 /* HTS_SStreamSet_get_gv_switch: get GV switch */
-HTS_Boolean HTS_SStreamSet_get_gv_switch(HTS_SStreamSet * sss, int stream_index,
-                                         int state_index);
+HTS_Boolean HTS_SStreamSet_get_gv_switch(HTS_SStreamSet * sss, int stream_index, int state_index);
 
 /* HTS_SStreamSet_clear: free state stream set */
 void HTS_SStreamSet_clear(HTS_SStreamSet * sss);
@@ -557,8 +523,7 @@
 void HTS_PStreamSet_initialize(HTS_PStreamSet * pss);
 
 /* HTS_PStreamSet_create: parameter generation using GV weight */
-void HTS_PStreamSet_create(HTS_PStreamSet * pss, HTS_SStreamSet * sss,
-                           double *msd_threshold, double *gv_weight);
+HTS_Boolean HTS_PStreamSet_create(HTS_PStreamSet * pss, HTS_SStreamSet * sss, double *msd_threshold, double *gv_weight);
 
 /* HTS_PStreamSet_get_nstream: get number of stream */
 int HTS_PStreamSet_get_nstream(HTS_PStreamSet * pss);
@@ -570,16 +535,13 @@
 int HTS_PStreamSet_get_total_frame(HTS_PStreamSet * pss);
 
 /* HTS_PStreamSet_get_parameter: get parameter */
-double HTS_PStreamSet_get_parameter(HTS_PStreamSet * pss, int stream_index,
-                                    int frame_index, int vector_index);
+double HTS_PStreamSet_get_parameter(HTS_PStreamSet * pss, int stream_index, int frame_index, int vector_index);
 
 /* HTS_PStreamSet_get_parameter_vector: get parameter vector */
-double *HTS_PStreamSet_get_parameter_vector(HTS_PStreamSet * pss,
-                                            int stream_index, int frame_index);
+double *HTS_PStreamSet_get_parameter_vector(HTS_PStreamSet * pss, int stream_index, int frame_index);
 
 /* HTS_PStreamSet_get_msd_flag: get generated MSD flag per frame */
-HTS_Boolean HTS_PStreamSet_get_msd_flag(HTS_PStreamSet * pss, int stream_index,
-                                        int frame_index);
+HTS_Boolean HTS_PStreamSet_get_msd_flag(HTS_PStreamSet * pss, int stream_index, int frame_index);
 
 /* HTS_PStreamSet_is_msd: get MSD flag */
 HTS_Boolean HTS_PStreamSet_is_msd(HTS_PStreamSet * pss, int stream_index);
@@ -610,12 +572,7 @@
 void HTS_GStreamSet_initialize(HTS_GStreamSet * gss);
 
 /* HTS_GStreamSet_create: generate speech */
-void HTS_GStreamSet_create(HTS_GStreamSet * gss, HTS_PStreamSet * pss,
-                           int stage, HTS_Boolean use_log_gain,
-                           int sampling_rate, int fperiod, double alpha,
-                           double beta,
-                           HTS_Boolean * stop, double volume,
-                           HTS_Audio * audio);
+HTS_Boolean HTS_GStreamSet_create(HTS_GStreamSet * gss, HTS_PStreamSet * pss, int stage, HTS_Boolean use_log_gain, int sampling_rate, int fperiod, double alpha, double beta, HTS_Boolean * stop, double volume, HTS_Audio * audio);
 
 /* HTS_GStreamSet_get_total_nsample: get total number of sample */
 int HTS_GStreamSet_get_total_nsample(HTS_GStreamSet * gss);
@@ -630,8 +587,7 @@
 short HTS_GStreamSet_get_speech(HTS_GStreamSet * gss, int sample_index);
 
 /* HTS_GStreamSet_get_parameter: get generated parameter */
-double HTS_GStreamSet_get_parameter(HTS_GStreamSet * gss, int stream_index,
-                                    int frame_index, int vector_index);
+double HTS_GStreamSet_get_parameter(HTS_GStreamSet * gss, int stream_index, int frame_index, int vector_index);
 
 /* HTS_GStreamSet_clear: free generated parameter stream set */
 void HTS_GStreamSet_clear(HTS_GStreamSet * gss);
@@ -673,40 +629,28 @@
 void HTS_Engine_initialize(HTS_Engine * engine, int nstream);
 
 /* HTS_engine_load_duration_from_fn: load duration pdfs ,trees and number of state from file names */
-void HTS_Engine_load_duration_from_fn(HTS_Engine * engine, char **pdf_fn,
-                                      char **tree_fn, int interpolation_size);
+HTS_Boolean HTS_Engine_load_duration_from_fn(HTS_Engine * engine, char **pdf_fn, char **tree_fn, int interpolation_size);
 
 /* HTS_Engine_load_duration_from_fp: load duration pdfs, trees and number of state from file pointers */
-void HTS_Engine_load_duration_from_fp(HTS_Engine * engine, FILE ** pdf_fp,
-                                      FILE ** tree_fp, int interpolation_size);
+HTS_Boolean HTS_Engine_load_duration_from_fp(HTS_Engine * engine, HTS_File ** pdf_fp, HTS_File ** tree_fp, int interpolation_size);
 
 /* HTS_Engine_load_parameter_from_fn: load parameter pdfs, trees and windows from file names */
-void HTS_Engine_load_parameter_from_fn(HTS_Engine * engine, char **pdf_fn,
-                                       char **tree_fn, char **win_fn,
-                                       int stream_index, HTS_Boolean msd_flag,
-                                       int window_size, int interpolation_size);
+HTS_Boolean HTS_Engine_load_parameter_from_fn(HTS_Engine * engine, char **pdf_fn, char **tree_fn, char **win_fn, int stream_index, HTS_Boolean msd_flag, int window_size, int interpolation_size);
 
 /* HTS_Engine_load_parameter_from_fp: load parameter pdfs, trees and windows from file pointers */
-void HTS_Engine_load_parameter_from_fp(HTS_Engine * engine, FILE ** pdf_fp,
-                                       FILE ** tree_fp, FILE ** win_fp,
-                                       int stream_index, HTS_Boolean msd_flag,
-                                       int window_size, int interpolation_size);
+HTS_Boolean HTS_Engine_load_parameter_from_fp(HTS_Engine * engine, HTS_File ** pdf_fp, HTS_File ** tree_fp, HTS_File ** win_fp, int stream_index, HTS_Boolean msd_flag, int window_size, int interpolation_size);
 
 /* HTS_Engine_load_gv_from_fn: load GV pdfs and trees from file names */
-void HTS_Engine_load_gv_from_fn(HTS_Engine * engine, char **pdf_fn,
-                                char **tree_fn, int stream_index,
-                                int interpolation_size);
+HTS_Boolean HTS_Engine_load_gv_from_fn(HTS_Engine * engine, char **pdf_fn, char **tree_fn, int stream_index, int interpolation_size);
 
 /* HTS_Engine_load_gv_from_fp: load GV pdfs and trees from file pointers */
-void HTS_Engine_load_gv_from_fp(HTS_Engine * engine, FILE ** pdf_fp,
-                                FILE ** tree_fp, int stream_index,
-                                int interpolation_size);
+HTS_Boolean HTS_Engine_load_gv_from_fp(HTS_Engine * engine, HTS_File ** pdf_fp, HTS_File ** tree_fp, int stream_index, int interpolation_size);
 
 /* HTS_Engine_load_gv_switch_from_fn: load GV switch from file names */
-void HTS_Engine_load_gv_switch_from_fn(HTS_Engine * engine, char *fn);
+HTS_Boolean HTS_Engine_load_gv_switch_from_fn(HTS_Engine * engine, char *fn);
 
 /* HTS_Engine_load_gv_switch_from_fp: load GV switch from file pointers */
-void HTS_Engine_load_gv_switch_from_fp(HTS_Engine * engine, FILE * fp);
+HTS_Boolean HTS_Engine_load_gv_switch_from_fp(HTS_Engine * engine, HTS_File * fp);
 
 /* HTS_Engine_set_sampling_rate: set sampling rate */
 void HTS_Engine_set_sampling_rate(HTS_Engine * engine, int i);
@@ -739,24 +683,16 @@
 int HTS_Engine_get_audio_buff_size(HTS_Engine * engine);
 
 /* HTS_Egnine_set_msd_threshold: set MSD threshold */
-void HTS_Engine_set_msd_threshold(HTS_Engine * engine, int stream_index,
-                                  double f);
+void HTS_Engine_set_msd_threshold(HTS_Engine * engine, int stream_index, double f);
 
 /* HTS_Engine_set_duration_interpolation_weight: set interpolation weight for duration */
-void HTS_Engine_set_duration_interpolation_weight(HTS_Engine * engine,
-                                                  int interpolation_index,
-                                                  double f);
+void HTS_Engine_set_duration_interpolation_weight(HTS_Engine * engine, int interpolation_index, double f);
 
 /* HTS_Engine_set_parameter_interpolation_weight: set interpolation weight for parameter */
-void HTS_Engine_set_parameter_interpolation_weight(HTS_Engine * engine,
-                                                   int stream_index,
-                                                   int interpolation_index,
-                                                   double f);
+void HTS_Engine_set_parameter_interpolation_weight(HTS_Engine * engine, int stream_index, int interpolation_index, double f);
 
 /* HTS_Engine_set_gv_interpolation_weight: set interpolation weight for GV */
-void HTS_Engine_set_gv_interpolation_weight(HTS_Engine * engine,
-                                            int stream_index,
-                                            int interpolation_index, double f);
+void HTS_Engine_set_gv_interpolation_weight(HTS_Engine * engine, int stream_index, int interpolation_index, double f);
 
 /* HTS_Engine_set_gv_weight: set GV weight */
 void HTS_Engine_set_gv_weight(HTS_Engine * engine, int stream_index, double f);
@@ -771,12 +707,10 @@
 int HTS_Engine_get_total_state(HTS_Engine * engine);
 
 /* HTS_Engine_set_state_mean: set mean value of state */
-void HTS_Engine_set_state_mean(HTS_Engine * engine, int stream_index,
-                               int state_index, int vector_index, double f);
+void HTS_Engine_set_state_mean(HTS_Engine * engine, int stream_index, int state_index, int vector_index, double f);
 
 /* HTS_Engine_get_state_mean: get mean value of state */
-double HTS_Engine_get_state_mean(HTS_Engine * engine, int stream_index,
-                                 int state_index, int vector_index);
+double HTS_Engine_get_state_mean(HTS_Engine * engine, int stream_index, int state_index, int vector_index);
 
 /* HTS_Engine_get_state_duration: get state duration */
 int HTS_Engine_get_state_duration(HTS_Engine * engine, int state_index);
@@ -791,39 +725,37 @@
 void HTS_Engine_load_label_from_fn(HTS_Engine * engine, char *fn);
 
 /* HTS_Engine_load_label_from_fp: load label from file name */
-void HTS_Engine_load_label_from_fp(HTS_Engine * engine, FILE * fp);
+void HTS_Engine_load_label_from_fp(HTS_Engine * engine, HTS_File * fp);
 
 /* HTS_Engine_load_label_from_string: load label from string */
 void HTS_Engine_load_label_from_string(HTS_Engine * engine, char *data);
 
 /* HTS_Engine_load_label_from_string_list: load label from string list */
-void HTS_Engine_load_label_from_string_list(HTS_Engine * engine, char **data,
-                                            int size);
+void HTS_Engine_load_label_from_string_list(HTS_Engine * engine, char **data, int size);
 
 /* HTS_Engine_create_sstream: parse label and determine state duration */
-void HTS_Engine_create_sstream(HTS_Engine * engine);
+HTS_Boolean HTS_Engine_create_sstream(HTS_Engine * engine);
 
 /* HTS_Engine_create_pstream: generate speech parameter vector sequence */
-void HTS_Engine_create_pstream(HTS_Engine * engine);
+HTS_Boolean HTS_Engine_create_pstream(HTS_Engine * engine);
 
 /* HTS_Engine_create_gstream: synthesis speech */
-void HTS_Engine_create_gstream(HTS_Engine * engine);
+HTS_Boolean HTS_Engine_create_gstream(HTS_Engine * engine);
 
 /* HTS_Engine_save_information: output trace information */
-void HTS_Engine_save_information(HTS_Engine * engine, FILE * fp);
+void HTS_Engine_save_information(HTS_Engine * engine, HTS_File * fp);
 
 /* HTS_Engine_save_label: output label with time */
-void HTS_Engine_save_label(HTS_Engine * engine, FILE * fp);
+void HTS_Engine_save_label(HTS_Engine * engine, HTS_File * fp);
 
 /* HTS_Engine_save_generated_parameter: output generated parameter */
-void HTS_Engine_save_generated_parameter(HTS_Engine * engine, FILE * fp,
-                                         int stream_index);
+void HTS_Engine_save_generated_parameter(HTS_Engine * engine, HTS_File * fp, int stream_index);
 
 /* HTS_Engine_save_generated_speech: output generated speech */
-void HTS_Engine_save_generated_speech(HTS_Engine * engine, FILE * fp);
+void HTS_Engine_save_generated_speech(HTS_Engine * engine, HTS_File * fp);
 
 /* HTS_Engine_save_riff: output RIFF format file */
-void HTS_Engine_save_riff(HTS_Engine * engine, FILE * wavfp);
+void HTS_Engine_save_riff(HTS_Engine * engine, HTS_File * wavfp);
 
 /* HTS_Engine_refresh: free memory per one time synthesis */
 void HTS_Engine_refresh(HTS_Engine * engine);
@@ -868,19 +800,13 @@
 /*  ----------------------- vocoder method ------------------------  */
 
 /* HTS_Vocoder_initialize: initialize vocoder */
-void HTS_Vocoder_initialize(HTS_Vocoder * v, const int m, const int stage,
-                            HTS_Boolean use_log_gain, const int rate,
-                            const int fperiod);
+void HTS_Vocoder_initialize(HTS_Vocoder * v, const int m, const int stage, HTS_Boolean use_log_gain, const int rate, const int fperiod);
 
 /* HTS_Vocoder_synthesize: pulse/noise excitation and MLSA/MGLSA filster based waveform synthesis */
-void HTS_Vocoder_synthesize(HTS_Vocoder * v, const int m, double lf0,
-                            double *spectrum, const int nlpf, double *lpf,
-                            double alpha, double beta, double volume,
-                            short *rawdata, HTS_Audio * audio);
+void HTS_Vocoder_synthesize(HTS_Vocoder * v, const int m, double lf0, double *spectrum, const int nlpf, double *lpf, double alpha, double beta, double volume, short *rawdata, HTS_Audio * audio);
 
 /* HTS_Vocoder_postfilter_mcp: postfilter for MCP */
-void HTS_Vocoder_postfilter_mcp(HTS_Vocoder * v, double *mcp, const int m,
-                                double alpha, double beta);
+void HTS_Vocoder_postfilter_mcp(HTS_Vocoder * v, double *mcp, const int m, double alpha, double beta);
 
 /* HTS_Vocoder_clear: clear vocoder */
 void HTS_Vocoder_clear(HTS_Vocoder * v);
diff -Nru htsengine-1.05/lib/HTS_audio.c htsengine-1.06/lib/HTS_audio.c
--- htsengine-1.05/lib/HTS_audio.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_audio.c	2011-12-20 11:11:29.000000000 +0900
@@ -65,9 +65,7 @@
 #define AUDIO_CHANNEL 1         /* monoral */
 
 /* HTS_Audio_callback_function: callback function from audio device */
-static void CALLBACK HTS_Audio_callback_function(HWAVEOUT hwaveout, UINT msg,
-                                                 DWORD user_data, DWORD param1,
-                                                 DWORD param2)
+static void CALLBACK HTS_Audio_callback_function(HWAVEOUT hwaveout, UINT msg, DWORD user_data, DWORD param1, DWORD param2)
 {
    WAVEHDR *wavehdr = (WAVEHDR *) param1;
    HTS_Audio *audio = (HTS_Audio *) user_data;
@@ -91,8 +89,7 @@
          Sleep(AUDIO_WAIT_BUFF_MS);
       audio->now_buff_1 = TRUE;
       audio->which_buff = 2;
-      memcpy(audio->buff_1.lpData, audio->buff,
-             audio->buff_size * sizeof(short));
+      memcpy(audio->buff_1.lpData, audio->buff, audio->buff_size * sizeof(short));
       audio->buff_1.dwBufferLength = audio->buff_size * sizeof(short);
       error = waveOutWrite(audio->hwaveout, &(audio->buff_1), sizeof(WAVEHDR));
    } else {
@@ -100,15 +97,13 @@
          Sleep(AUDIO_WAIT_BUFF_MS);
       audio->now_buff_2 = TRUE;
       audio->which_buff = 1;
-      memcpy(audio->buff_2.lpData, audio->buff,
-             audio->buff_size * sizeof(short));
+      memcpy(audio->buff_2.lpData, audio->buff, audio->buff_size * sizeof(short));
       audio->buff_2.dwBufferLength = audio->buff_size * sizeof(short);
       error = waveOutWrite(audio->hwaveout, &(audio->buff_2), sizeof(WAVEHDR));
    }
 
    if (error != MMSYSERR_NOERROR)
-      HTS_error(0,
-                "hts_engine: Cannot send datablocks to your output audio device to play waveform.\n");
+      HTS_error(0, "hts_engine: Cannot send datablocks to your output audio device to play waveform.\n");
 }
 
 /* HTS_Audio_close: close audio device */
@@ -122,21 +117,14 @@
    /* stop audio */
    error = waveOutReset(audio->hwaveout);
    if (error != MMSYSERR_NOERROR)
-      HTS_error(0,
-                "hts_engine: Cannot stop and reset your output audio device.\n");
+      HTS_error(0, "hts_engine: Cannot stop and reset your output audio device.\n");
    /* unprepare */
-   error =
-       waveOutUnprepareHeader(audio->hwaveout, &(audio->buff_1),
-                              sizeof(WAVEHDR));
+   error = waveOutUnprepareHeader(audio->hwaveout, &(audio->buff_1), sizeof(WAVEHDR));
    if (error != MMSYSERR_NOERROR)
-      HTS_error(0,
-                "hts_engine: Cannot cleanup the audio datablocks to play waveform.\n");
-   error =
-       waveOutUnprepareHeader(audio->hwaveout, &(audio->buff_2),
-                              sizeof(WAVEHDR));
+      HTS_error(0, "hts_engine: Cannot cleanup the audio datablocks to play waveform.\n");
+   error = waveOutUnprepareHeader(audio->hwaveout, &(audio->buff_2), sizeof(WAVEHDR));
    if (error != MMSYSERR_NOERROR)
-      HTS_error(0,
-                "hts_engine: Cannot cleanup the audio datablocks to play waveform.\n");
+      HTS_error(0, "hts_engine: Cannot cleanup the audio datablocks to play waveform.\n");
    /* close */
    error = waveOutClose(audio->hwaveout);
    if (error != MMSYSERR_NOERROR)
@@ -147,13 +135,11 @@
 }
 
 /* HTS_Audio_open: open audio device */
-static void HTS_Audio_open(HTS_Audio * audio, int sampling_rate,
-                           int max_buff_size)
+static void HTS_Audio_open(HTS_Audio * audio, int sampling_rate, int max_buff_size)
 {
    MMRESULT error;
 
-   if (audio->sampling_rate == sampling_rate
-       && audio->max_buff_size == max_buff_size)
+   if (audio->sampling_rate == sampling_rate && audio->max_buff_size == max_buff_size)
       return;
 
    HTS_Audio_close(audio);
@@ -175,18 +161,12 @@
    audio->waveformatex.nChannels = AUDIO_CHANNEL;
    audio->waveformatex.nSamplesPerSec = sampling_rate;
    audio->waveformatex.wBitsPerSample = sizeof(short) * 8;
-   audio->waveformatex.nBlockAlign = AUDIO_CHANNEL
-       * audio->waveformatex.wBitsPerSample / 8;
-   audio->waveformatex.nAvgBytesPerSec = sampling_rate
-       * audio->waveformatex.nBlockAlign;
+   audio->waveformatex.nBlockAlign = AUDIO_CHANNEL * audio->waveformatex.wBitsPerSample / 8;
+   audio->waveformatex.nAvgBytesPerSec = sampling_rate * audio->waveformatex.nBlockAlign;
    /* open */
-   error =
-       waveOutOpen(&audio->hwaveout, WAVE_MAPPER, &audio->waveformatex,
-                   (DWORD) HTS_Audio_callback_function, (DWORD) audio,
-                   CALLBACK_FUNCTION);
+   error = waveOutOpen(&audio->hwaveout, WAVE_MAPPER, &audio->waveformatex, (DWORD) HTS_Audio_callback_function, (DWORD) audio, CALLBACK_FUNCTION);
    if (error != MMSYSERR_NOERROR)
-      HTS_error(0,
-                "hts_engine: Failed to open your output audio device to play waveform.\n");
+      HTS_error(0, "hts_engine: Failed to open your output audio device to play waveform.\n");
 
    /* prepare */
    audio->buff_1.lpData = (LPSTR) HTS_calloc(max_buff_size, sizeof(short));
@@ -195,27 +175,22 @@
    audio->buff_1.dwLoops = 1;
    audio->buff_1.lpNext = 0;
    audio->buff_1.reserved = 0;
-   error =
-       waveOutPrepareHeader(audio->hwaveout, &(audio->buff_1), sizeof(WAVEHDR));
+   error = waveOutPrepareHeader(audio->hwaveout, &(audio->buff_1), sizeof(WAVEHDR));
    if (error != MMSYSERR_NOERROR)
-      HTS_error(0,
-                "hts_engine: Cannot initialize audio datablocks to play waveform.\n");
+      HTS_error(0, "hts_engine: Cannot initialize audio datablocks to play waveform.\n");
    audio->buff_2.lpData = (LPSTR) HTS_calloc(max_buff_size, sizeof(short));
    audio->buff_2.dwBufferLength = max_buff_size * sizeof(short);
    audio->buff_2.dwFlags = WHDR_BEGINLOOP | WHDR_ENDLOOP;
    audio->buff_2.dwLoops = 1;
    audio->buff_2.lpNext = 0;
    audio->buff_2.reserved = 0;
-   error =
-       waveOutPrepareHeader(audio->hwaveout, &(audio->buff_2), sizeof(WAVEHDR));
+   error = waveOutPrepareHeader(audio->hwaveout, &(audio->buff_2), sizeof(WAVEHDR));
    if (error != MMSYSERR_NOERROR)
-      HTS_error(0,
-                "hts_engine: Cannot initialize audio datablocks to play waveform.\n");
+      HTS_error(0, "hts_engine: Cannot initialize audio datablocks to play waveform.\n");
 }
 
 /* HTS_Audio_initialize: initialize audio */
-void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate,
-                          int max_buff_size)
+void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate, int max_buff_size)
 {
    audio->sampling_rate = 0;
    audio->max_buff_size = 0;
@@ -231,8 +206,7 @@
 }
 
 /* HTS_Audio_set_parameter: set parameters for audio */
-void HTS_Audio_set_parameter(HTS_Audio * audio, int sampling_rate,
-                             int max_buff_size)
+void HTS_Audio_set_parameter(HTS_Audio * audio, int sampling_rate, int max_buff_size)
 {
    HTS_Audio_open(audio, sampling_rate, max_buff_size);
 }
@@ -279,9 +253,8 @@
 
    if (audio->buff_size > 0) {
       audio->err = Pa_WriteStream(audio->stream, audio->buff, audio->buff_size);
-      if (audio->err != paNoError)
-         HTS_error(0,
-                   "hts_engine: Cannot send datablocks to your output audio device to play waveform.\n");
+      if (audio->err != paNoError && audio->err != paOutputUnderflowed)
+         HTS_error(0, "hts_engine: Cannot send datablocks to your output audio device to play waveform.\n");
       audio->buff_size = 0;
    }
 
@@ -299,11 +272,9 @@
 }
 
 /* HTS_Audio_open: open audio device */
-static void HTS_Audio_open(HTS_Audio * audio, int sampling_rate,
-                           int max_buff_size)
+static void HTS_Audio_open(HTS_Audio * audio, int sampling_rate, int max_buff_size)
 {
-   if (audio->sampling_rate == sampling_rate
-       && audio->max_buff_size == max_buff_size)
+   if (audio->sampling_rate == sampling_rate && audio->max_buff_size == max_buff_size)
       return;
 
    HTS_Audio_close(audio);
@@ -316,35 +287,28 @@
 
    audio->err = Pa_Initialize();
    if (audio->err != paNoError)
-      HTS_error(0,
-                "hts_engine: Failed to initialize your output audio device to play waveform.\n");
+      HTS_error(0, "hts_engine: Failed to initialize your output audio device to play waveform.\n");
 
    audio->parameters.device = Pa_GetDefaultOutputDevice();
    audio->parameters.channelCount = 1;
    audio->parameters.sampleFormat = paInt16;
-   audio->parameters.suggestedLatency =
-       Pa_GetDeviceInfo(audio->parameters.device)->defaultLowOutputLatency;
+   audio->parameters.suggestedLatency = Pa_GetDeviceInfo(audio->parameters.device)->defaultLowOutputLatency;
    audio->parameters.hostApiSpecificStreamInfo = NULL;
 
-   audio->err =
-       Pa_OpenStream(&audio->stream, NULL, &audio->parameters, sampling_rate,
-                     max_buff_size, paClipOff, NULL, NULL);
+   audio->err = Pa_OpenStream(&audio->stream, NULL, &audio->parameters, sampling_rate, max_buff_size, paClipOff, NULL, NULL);
    if (audio->err != paNoError)
-      HTS_error(0,
-                "hts_engine: Failed to open your output audio device to play waveform.\n");
+      HTS_error(0, "hts_engine: Failed to open your output audio device to play waveform.\n");
 
    audio->err = Pa_StartStream(audio->stream);
    if (audio->err != paNoError)
-      HTS_error(0,
-                "hts_engine: Failed to start your output audio device to play waveform.\n");
+      HTS_error(0, "hts_engine: Failed to start your output audio device to play waveform.\n");
 
    audio->buff = (short *) HTS_calloc(max_buff_size, sizeof(short));
    audio->buff_size = 0;
 }
 
 /* HTS_Audio_initialize: initialize audio */
-void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate,
-                          int max_buff_size)
+void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate, int max_buff_size)
 {
    audio->sampling_rate = 0;
    audio->max_buff_size = 0;
@@ -358,8 +322,7 @@
 }
 
 /* HTS_Audio_set_parameter: set parameters for audio */
-void HTS_Audio_set_parameter(HTS_Audio * audio, int sampling_rate,
-                             int max_buff_size)
+void HTS_Audio_set_parameter(HTS_Audio * audio, int sampling_rate, int max_buff_size)
 {
    HTS_Audio_open(audio, sampling_rate, max_buff_size);
 }
@@ -369,11 +332,9 @@
 {
    audio->buff[audio->buff_size++] = data;
    if (audio->buff_size >= audio->max_buff_size) {
-      audio->err =
-          Pa_WriteStream(audio->stream, audio->buff, audio->max_buff_size);
-      if (audio->err != paNoError)
-         HTS_error(0,
-                   "hts_engine: Cannot send datablocks to your output audio device to play waveform.\n");
+      audio->err = Pa_WriteStream(audio->stream, audio->buff, audio->max_buff_size);
+      if (audio->err != paNoError && audio->err != paOutputUnderflowed)
+         HTS_error(0, "hts_engine: Cannot send datablocks to your output audio device to play waveform.\n");
       audio->buff_size = 0;
    }
 }
@@ -383,9 +344,8 @@
 {
    if (audio->buff_size > 0) {
       audio->err = Pa_WriteStream(audio->stream, audio->buff, audio->buff_size);
-      if (audio->err != paNoError)
-         HTS_error(0,
-                   "hts_engine: Cannot send datablocks to your output audio device to play waveform.\n");
+      if (audio->err != paNoError && audio->err != paOutputUnderflowed)
+         HTS_error(0, "hts_engine: Cannot send datablocks to your output audio device to play waveform.\n");
       audio->buff_size = 0;
    }
 }
@@ -402,14 +362,12 @@
 /* for others */
 #ifdef AUDIO_PLAY_NONE
 /* HTS_Audio_initialize: initialize audio */
-void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate,
-                          int max_buff_size)
+void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate, int max_buff_size)
 {
 }
 
 /* HTS_Audio_set_parameter: set parameters for audio */
-void HTS_Audio_set_parameter(HTS_Audio * audio, int sampling_rate,
-                             int max_buff_size)
+void HTS_Audio_set_parameter(HTS_Audio * audio, int sampling_rate, int max_buff_size)
 {
 }
 
diff -Nru htsengine-1.05/lib/HTS_engine.c htsengine-1.06/lib/HTS_engine.c
--- htsengine-1.05/lib/HTS_engine.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_engine.c	2011-12-20 11:11:29.000000000 +0900
@@ -73,14 +73,12 @@
    engine->global.alpha = 0.42;
    engine->global.beta = 0.0;
    engine->global.audio_buff_size = 0;
-   engine->global.msd_threshold =
-       (double *) HTS_calloc(nstream, sizeof(double));
+   engine->global.msd_threshold = (double *) HTS_calloc(nstream, sizeof(double));
    for (i = 0; i < nstream; i++)
       engine->global.msd_threshold[i] = 0.5;
 
    /* interpolation weight */
-   engine->global.parameter_iw =
-       (double **) HTS_calloc(nstream, sizeof(double *));
+   engine->global.parameter_iw = (double **) HTS_calloc(nstream, sizeof(double *));
    engine->global.gv_iw = (double **) HTS_calloc(nstream, sizeof(double *));
    engine->global.duration_iw = NULL;
    for (i = 0; i < nstream; i++)
@@ -99,8 +97,7 @@
    engine->global.volume = 1.0;
 
    /* initialize audio */
-   HTS_Audio_initialize(&engine->audio, engine->global.sampling_rate,
-                        engine->global.audio_buff_size);
+   HTS_Audio_initialize(&engine->audio, engine->global.sampling_rate, engine->global.audio_buff_size);
    /* initialize model set */
    HTS_ModelSet_initialize(&engine->ms, nstream);
    /* initialize label list */
@@ -114,152 +111,154 @@
 }
 
 /* HTS_Engine_load_duratin_from_fn: load duration pdfs, trees and number of state from file names */
-void HTS_Engine_load_duration_from_fn(HTS_Engine * engine, char **pdf_fn,
-                                      char **tree_fn, int interpolation_size)
+HTS_Boolean HTS_Engine_load_duration_from_fn(HTS_Engine * engine, char **pdf_fn, char **tree_fn, int interpolation_size)
 {
    int i;
-   FILE **pdf_fp, **tree_fp;
+   HTS_File **pdf_fp, **tree_fp;
+   HTS_Boolean result;
 
-   pdf_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));
-   tree_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));
+   pdf_fp = (HTS_File **) HTS_calloc(interpolation_size, sizeof(HTS_File *));
+   tree_fp = (HTS_File **) HTS_calloc(interpolation_size, sizeof(HTS_File *));
    for (i = 0; i < interpolation_size; i++) {
-      pdf_fp[i] = HTS_get_fp(pdf_fn[i], "rb");
-      tree_fp[i] = HTS_get_fp(tree_fn[i], "r");
+      pdf_fp[i] = HTS_fopen(pdf_fn[i], "rb");
+      tree_fp[i] = HTS_fopen(tree_fn[i], "r");
    }
-   HTS_Engine_load_duration_from_fp(engine, pdf_fp, tree_fp,
-                                    interpolation_size);
+   result = HTS_Engine_load_duration_from_fp(engine, pdf_fp, tree_fp, interpolation_size);
    for (i = 0; i < interpolation_size; i++) {
-      fclose(pdf_fp[i]);
-      fclose(tree_fp[i]);
+      HTS_fclose(pdf_fp[i]);
+      HTS_fclose(tree_fp[i]);
    }
    HTS_free(pdf_fp);
    HTS_free(tree_fp);
+
+   return result;
 }
 
 /* HTS_Engine_load_duration_from_fp: load duration pdfs, trees and number of state from file pointers */
-void HTS_Engine_load_duration_from_fp(HTS_Engine * engine, FILE ** pdf_fp,
-                                      FILE ** tree_fp, int interpolation_size)
+HTS_Boolean HTS_Engine_load_duration_from_fp(HTS_Engine * engine, HTS_File ** pdf_fp, HTS_File ** tree_fp, int interpolation_size)
 {
    int i;
 
-   HTS_ModelSet_load_duration(&engine->ms, pdf_fp, tree_fp, interpolation_size);
-   engine->global.duration_iw =
-       (double *) HTS_calloc(interpolation_size, sizeof(double));
+   if (HTS_ModelSet_load_duration(&engine->ms, pdf_fp, tree_fp, interpolation_size) == FALSE) {
+      return FALSE;
+   }
+   engine->global.duration_iw = (double *) HTS_calloc(interpolation_size, sizeof(double));
    for (i = 0; i < interpolation_size; i++)
       engine->global.duration_iw[i] = 1.0 / interpolation_size;
+
+   return TRUE;
 }
 
 /* HTS_Engine_load_parameter_from_fn: load parameter pdfs, trees and windows from file names */
-void HTS_Engine_load_parameter_from_fn(HTS_Engine * engine, char **pdf_fn,
-                                       char **tree_fn, char **win_fn,
-                                       int stream_index, HTS_Boolean msd_flag,
-                                       int window_size, int interpolation_size)
+HTS_Boolean HTS_Engine_load_parameter_from_fn(HTS_Engine * engine, char **pdf_fn, char **tree_fn, char **win_fn, int stream_index, HTS_Boolean msd_flag, int window_size, int interpolation_size)
 {
    int i;
-   FILE **pdf_fp, **tree_fp, **win_fp;
+   HTS_File **pdf_fp, **tree_fp, **win_fp;
+   HTS_Boolean result;
 
-   pdf_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));
-   tree_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));
-   win_fp = (FILE **) HTS_calloc(window_size, sizeof(FILE *));
+   pdf_fp = (HTS_File **) HTS_calloc(interpolation_size, sizeof(HTS_File *));
+   tree_fp = (HTS_File **) HTS_calloc(interpolation_size, sizeof(HTS_File *));
+   win_fp = (HTS_File **) HTS_calloc(window_size, sizeof(HTS_File *));
    for (i = 0; i < interpolation_size; i++) {
-      pdf_fp[i] = HTS_get_fp(pdf_fn[i], "rb");
-      tree_fp[i] = HTS_get_fp(tree_fn[i], "r");
+      pdf_fp[i] = HTS_fopen(pdf_fn[i], "rb");
+      tree_fp[i] = HTS_fopen(tree_fn[i], "r");
    }
    for (i = 0; i < window_size; i++)
-      win_fp[i] = HTS_get_fp(win_fn[i], "r");
-   HTS_Engine_load_parameter_from_fp(engine, pdf_fp, tree_fp, win_fp,
-                                     stream_index, msd_flag,
-                                     window_size, interpolation_size);
+      win_fp[i] = HTS_fopen(win_fn[i], "r");
+   result = HTS_Engine_load_parameter_from_fp(engine, pdf_fp, tree_fp, win_fp, stream_index, msd_flag, window_size, interpolation_size);
    for (i = 0; i < interpolation_size; i++) {
-      fclose(pdf_fp[i]);
-      fclose(tree_fp[i]);
+      HTS_fclose(pdf_fp[i]);
+      HTS_fclose(tree_fp[i]);
    }
    for (i = 0; i < window_size; i++)
-      fclose(win_fp[i]);
+      HTS_fclose(win_fp[i]);
    HTS_free(pdf_fp);
    HTS_free(tree_fp);
    HTS_free(win_fp);
+
+   return result;
 }
 
 /* HTS_Engine_load_parameter_from_fp: load parameter pdfs, trees and windows from file pointers */
-void HTS_Engine_load_parameter_from_fp(HTS_Engine * engine, FILE ** pdf_fp,
-                                       FILE ** tree_fp, FILE ** win_fp,
-                                       int stream_index, HTS_Boolean msd_flag,
-                                       int window_size, int interpolation_size)
+HTS_Boolean HTS_Engine_load_parameter_from_fp(HTS_Engine * engine, HTS_File ** pdf_fp, HTS_File ** tree_fp, HTS_File ** win_fp, int stream_index, HTS_Boolean msd_flag, int window_size, int interpolation_size)
 {
    int i;
 
-   HTS_ModelSet_load_parameter(&engine->ms, pdf_fp, tree_fp, win_fp,
-                               stream_index, msd_flag,
-                               window_size, interpolation_size);
-   engine->global.parameter_iw[stream_index] =
-       (double *) HTS_calloc(interpolation_size, sizeof(double));
+   if (HTS_ModelSet_load_parameter(&engine->ms, pdf_fp, tree_fp, win_fp, stream_index, msd_flag, window_size, interpolation_size) == FALSE) {
+      return FALSE;
+   }
+   engine->global.parameter_iw[stream_index] = (double *) HTS_calloc(interpolation_size, sizeof(double));
    for (i = 0; i < interpolation_size; i++)
       engine->global.parameter_iw[stream_index][i] = 1.0 / interpolation_size;
+
+   return TRUE;
 }
 
 /* HTS_Engine_load_gv_from_fn: load GV pdfs and trees from file names */
-void HTS_Engine_load_gv_from_fn(HTS_Engine * engine, char **pdf_fn,
-                                char **tree_fn, int stream_index,
-                                int interpolation_size)
+HTS_Boolean HTS_Engine_load_gv_from_fn(HTS_Engine * engine, char **pdf_fn, char **tree_fn, int stream_index, int interpolation_size)
 {
    int i;
-   FILE **pdf_fp, **tree_fp;
+   HTS_File **pdf_fp, **tree_fp;
+   HTS_Boolean result;
 
-   pdf_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));
+   pdf_fp = (HTS_File **) HTS_calloc(interpolation_size, sizeof(HTS_File *));
    if (tree_fn)
-      tree_fp = (FILE **) HTS_calloc(interpolation_size, sizeof(FILE *));
+      tree_fp = (HTS_File **) HTS_calloc(interpolation_size, sizeof(HTS_File *));
    else
       tree_fp = NULL;
    for (i = 0; i < interpolation_size; i++) {
-      pdf_fp[i] = HTS_get_fp(pdf_fn[i], "rb");
+      pdf_fp[i] = HTS_fopen(pdf_fn[i], "rb");
       if (tree_fn) {
          if (tree_fn[i])
-            tree_fp[i] = HTS_get_fp(tree_fn[i], "r");
+            tree_fp[i] = HTS_fopen(tree_fn[i], "r");
          else
             tree_fp[i] = NULL;
       }
    }
-   HTS_Engine_load_gv_from_fp(engine, pdf_fp, tree_fp, stream_index,
-                              interpolation_size);
+   result = HTS_Engine_load_gv_from_fp(engine, pdf_fp, tree_fp, stream_index, interpolation_size);
    for (i = 0; i < interpolation_size; i++) {
-      fclose(pdf_fp[i]);
+      HTS_fclose(pdf_fp[i]);
       if (tree_fp && tree_fp[i])
-         fclose(tree_fp[i]);
+         HTS_fclose(tree_fp[i]);
    }
    HTS_free(pdf_fp);
    if (tree_fp)
       HTS_free(tree_fp);
+
+   return result;
 }
 
 /* HTS_Engine_load_gv_from_fp: load GV pdfs and trees from file pointers */
-void HTS_Engine_load_gv_from_fp(HTS_Engine * engine, FILE ** pdf_fp,
-                                FILE ** tree_fp, int stream_index,
-                                int interpolation_size)
+HTS_Boolean HTS_Engine_load_gv_from_fp(HTS_Engine * engine, HTS_File ** pdf_fp, HTS_File ** tree_fp, int stream_index, int interpolation_size)
 {
    int i;
 
-   HTS_ModelSet_load_gv(&engine->ms, pdf_fp, tree_fp, stream_index,
-                        interpolation_size);
-   engine->global.gv_iw[stream_index] =
-       (double *) HTS_calloc(interpolation_size, sizeof(double));
+   if (HTS_ModelSet_load_gv(&engine->ms, pdf_fp, tree_fp, stream_index, interpolation_size) == FALSE) {
+      return FALSE;
+   }
+   engine->global.gv_iw[stream_index] = (double *) HTS_calloc(interpolation_size, sizeof(double));
    for (i = 0; i < interpolation_size; i++)
       engine->global.gv_iw[stream_index][i] = 1.0 / interpolation_size;
+
+   return TRUE;
 }
 
 /* HTS_Engine_load_gv_switch_from_fn: load GV switch from file name */
-void HTS_Engine_load_gv_switch_from_fn(HTS_Engine * engine, char *fn)
+HTS_Boolean HTS_Engine_load_gv_switch_from_fn(HTS_Engine * engine, char *fn)
 {
-   FILE *fp = HTS_get_fp(fn, "r");
+   HTS_File *fp = HTS_fopen(fn, "r");
+   HTS_Boolean result;
+
+   result = HTS_Engine_load_gv_switch_from_fp(engine, fp);
+   HTS_fclose(fp);
 
-   HTS_Engine_load_gv_switch_from_fp(engine, fp);
-   fclose(fp);
+   return result;
 }
 
 /* HTS_Engine_load_gv_switch_from_fp: load GV switch from file pointer */
-void HTS_Engine_load_gv_switch_from_fp(HTS_Engine * engine, FILE * fp)
+HTS_Boolean HTS_Engine_load_gv_switch_from_fp(HTS_Engine * engine, HTS_File * fp)
 {
-   HTS_ModelSet_load_gv_switch(&engine->ms, fp);
+   return HTS_ModelSet_load_gv_switch(&engine->ms, fp);
 }
 
 /* HTS_Engine_set_sampling_rate: set sampling rate */
@@ -270,8 +269,7 @@
    if (i > 48000)
       i = 48000;
    engine->global.sampling_rate = i;
-   HTS_Audio_set_parameter(&engine->audio, engine->global.sampling_rate,
-                           engine->global.audio_buff_size);
+   HTS_Audio_set_parameter(&engine->audio, engine->global.sampling_rate, engine->global.audio_buff_size);
 }
 
 /* HTS_Engine_get_sampling_rate: get sampling rate */
@@ -338,8 +336,7 @@
    if (i > 48000)
       i = 48000;
    engine->global.audio_buff_size = i;
-   HTS_Audio_set_parameter(&engine->audio, engine->global.sampling_rate,
-                           engine->global.audio_buff_size);
+   HTS_Audio_set_parameter(&engine->audio, engine->global.sampling_rate, engine->global.audio_buff_size);
 }
 
 /* HTS_Engine_get_audio_buff_size: get audio buffer size */
@@ -349,8 +346,7 @@
 }
 
 /* HTS_Egnine_set_msd_threshold: set MSD threshold */
-void HTS_Engine_set_msd_threshold(HTS_Engine * engine, int stream_index,
-                                  double f)
+void HTS_Engine_set_msd_threshold(HTS_Engine * engine, int stream_index, double f)
 {
    if (f < 0.0)
       f = 0.0;
@@ -360,26 +356,19 @@
 }
 
 /* HTS_Engine_set_duration_interpolation_weight: set interpolation weight for duration */
-void HTS_Engine_set_duration_interpolation_weight(HTS_Engine * engine,
-                                                  int interpolation_index,
-                                                  double f)
+void HTS_Engine_set_duration_interpolation_weight(HTS_Engine * engine, int interpolation_index, double f)
 {
    engine->global.duration_iw[interpolation_index] = f;
 }
 
 /* HTS_Engine_set_parameter_interpolation_weight: set interpolation weight for parameter */
-void HTS_Engine_set_parameter_interpolation_weight(HTS_Engine * engine,
-                                                   int stream_index,
-                                                   int interpolation_index,
-                                                   double f)
+void HTS_Engine_set_parameter_interpolation_weight(HTS_Engine * engine, int stream_index, int interpolation_index, double f)
 {
    engine->global.parameter_iw[stream_index][interpolation_index] = f;
 }
 
 /* HTS_Engine_set_gv_interpolation_weight: set interpolation weight for GV */
-void HTS_Engine_set_gv_interpolation_weight(HTS_Engine * engine,
-                                            int stream_index,
-                                            int interpolation_index, double f)
+void HTS_Engine_set_gv_interpolation_weight(HTS_Engine * engine, int stream_index, int interpolation_index, double f)
 {
    engine->global.gv_iw[stream_index][interpolation_index] = f;
 }
@@ -415,19 +404,15 @@
 }
 
 /* HTS_Engine_set_state_mean: set mean value of state */
-void HTS_Engine_set_state_mean(HTS_Engine * engine, int stream_index,
-                               int state_index, int vector_index, double f)
+void HTS_Engine_set_state_mean(HTS_Engine * engine, int stream_index, int state_index, int vector_index, double f)
 {
-   HTS_SStreamSet_set_mean(&engine->sss, stream_index, state_index,
-                           vector_index, f);
+   HTS_SStreamSet_set_mean(&engine->sss, stream_index, state_index, vector_index, f);
 }
 
 /* HTS_Engine_get_state_mean: get mean value of state */
-double HTS_Engine_get_state_mean(HTS_Engine * engine, int stream_index,
-                                 int state_index, int vector_index)
+double HTS_Engine_get_state_mean(HTS_Engine * engine, int stream_index, int state_index, int vector_index)
 {
-   return HTS_SStreamSet_get_mean(&engine->sss, stream_index, state_index,
-                                  vector_index);
+   return HTS_SStreamSet_get_mean(&engine->sss, stream_index, state_index, vector_index);
 }
 
 /* HTS_Engine_get_state_duration: get state duration */
@@ -451,62 +436,47 @@
 /* HTS_Engine_load_label_from_fn: load label from file name */
 void HTS_Engine_load_label_from_fn(HTS_Engine * engine, char *fn)
 {
-   HTS_Label_load_from_fn(&engine->label, engine->global.sampling_rate,
-                          engine->global.fperiod, fn);
+   HTS_Label_load_from_fn(&engine->label, engine->global.sampling_rate, engine->global.fperiod, fn);
 }
 
 /* HTS_Engine_load_label_from_fp: load label from file pointer */
-void HTS_Engine_load_label_from_fp(HTS_Engine * engine, FILE * fp)
+void HTS_Engine_load_label_from_fp(HTS_Engine * engine, HTS_File * fp)
 {
-   HTS_Label_load_from_fp(&engine->label, engine->global.sampling_rate,
-                          engine->global.fperiod, fp);
+   HTS_Label_load_from_fp(&engine->label, engine->global.sampling_rate, engine->global.fperiod, fp);
 }
 
 /* HTS_Engine_load_label_from_string: load label from string */
 void HTS_Engine_load_label_from_string(HTS_Engine * engine, char *data)
 {
-   HTS_Label_load_from_string(&engine->label, engine->global.sampling_rate,
-                              engine->global.fperiod, data);
+   HTS_Label_load_from_string(&engine->label, engine->global.sampling_rate, engine->global.fperiod, data);
 }
 
 /* HTS_Engine_load_label_from_string_list: load label from string list */
-void HTS_Engine_load_label_from_string_list(HTS_Engine * engine, char **data,
-                                            int size)
+void HTS_Engine_load_label_from_string_list(HTS_Engine * engine, char **data, int size)
 {
-   HTS_Label_load_from_string_list(&engine->label, engine->global.sampling_rate,
-                                   engine->global.fperiod, data, size);
+   HTS_Label_load_from_string_list(&engine->label, engine->global.sampling_rate, engine->global.fperiod, data, size);
 }
 
 /* HTS_Engine_create_sstream: parse label and determine state duration */
-void HTS_Engine_create_sstream(HTS_Engine * engine)
+HTS_Boolean HTS_Engine_create_sstream(HTS_Engine * engine)
 {
-   HTS_SStreamSet_create(&engine->sss, &engine->ms, &engine->label,
-                         engine->global.duration_iw,
-                         engine->global.parameter_iw, engine->global.gv_iw);
+   return HTS_SStreamSet_create(&engine->sss, &engine->ms, &engine->label, engine->global.duration_iw, engine->global.parameter_iw, engine->global.gv_iw);
 }
 
 /* HTS_Engine_create_pstream: generate speech parameter vector sequence */
-void HTS_Engine_create_pstream(HTS_Engine * engine)
+HTS_Boolean HTS_Engine_create_pstream(HTS_Engine * engine)
 {
-   HTS_PStreamSet_create(&engine->pss, &engine->sss,
-                         engine->global.msd_threshold,
-                         engine->global.gv_weight);
+   return HTS_PStreamSet_create(&engine->pss, &engine->sss, engine->global.msd_threshold, engine->global.gv_weight);
 }
 
 /* HTS_Engine_create_gstream: synthesis speech */
-void HTS_Engine_create_gstream(HTS_Engine * engine)
+HTS_Boolean HTS_Engine_create_gstream(HTS_Engine * engine)
 {
-   HTS_GStreamSet_create(&engine->gss, &engine->pss, engine->global.stage,
-                         engine->global.use_log_gain,
-                         engine->global.sampling_rate, engine->global.fperiod,
-                         engine->global.alpha, engine->global.beta,
-                         &engine->global.stop, engine->global.volume,
-                         engine->global.audio_buff_size >
-                         0 ? &engine->audio : NULL);
+   return HTS_GStreamSet_create(&engine->gss, &engine->pss, engine->global.stage, engine->global.use_log_gain, engine->global.sampling_rate, engine->global.fperiod, engine->global.alpha, engine->global.beta, &engine->global.stop, engine->global.volume, engine->global.audio_buff_size > 0 ? &engine->audio : NULL);
 }
 
 /* HTS_Engine_save_information: output trace information */
-void HTS_Engine_save_information(HTS_Engine * engine, FILE * fp)
+void HTS_Engine_save_information(HTS_Engine * engine, HTS_File * fp)
 {
    int i, j, k, l, m, n;
    double temp;
@@ -518,69 +488,49 @@
 
    /* global parameter */
    fprintf(fp, "[Global parameter]\n");
-   fprintf(fp, "Sampring frequency                     -> %8d(Hz)\n",
-           global->sampling_rate);
-   fprintf(fp, "Frame period                           -> %8d(point)\n",
-           global->fperiod);
-   fprintf(fp, "                                          %8.5f(msec)\n",
-           1e+3 * global->fperiod / global->sampling_rate);
-   fprintf(fp, "All-pass constant                      -> %8.5f\n",
-           (float) global->alpha);
-   fprintf(fp, "Gamma                                  -> %8.5f\n",
-           (float) (global->stage == 0 ? 0.0 : -1.0 / global->stage));
+   fprintf(fp, "Sampring frequency                     -> %8d(Hz)\n", global->sampling_rate);
+   fprintf(fp, "Frame period                           -> %8d(point)\n", global->fperiod);
+   fprintf(fp, "                                          %8.5f(msec)\n", 1e+3 * global->fperiod / global->sampling_rate);
+   fprintf(fp, "All-pass constant                      -> %8.5f\n", (float) global->alpha);
+   fprintf(fp, "Gamma                                  -> %8.5f\n", (float) (global->stage == 0 ? 0.0 : -1.0 / global->stage));
    if (global->stage != 0)
-      fprintf(fp, "Log gain flag                          -> %s\n",
-              global->use_log_gain ? "TRUE" : "FALSE");
-   fprintf(fp, "Postfiltering coefficient              -> %8.5f\n",
-           (float) global->beta);
-   fprintf(fp, "Audio buffer size                      -> %8d(sample)\n",
-           global->audio_buff_size);
+      fprintf(fp, "Log gain flag                          -> %s\n", global->use_log_gain ? "TRUE" : "FALSE");
+   fprintf(fp, "Postfiltering coefficient              -> %8.5f\n", (float) global->beta);
+   fprintf(fp, "Audio buffer size                      -> %8d(sample)\n", global->audio_buff_size);
    fprintf(fp, "\n");
 
    /* duration parameter */
    fprintf(fp, "[Duration parameter]\n");
-   fprintf(fp, "Number of states                       -> %8d\n",
-           HTS_ModelSet_get_nstate(ms));
-   fprintf(fp, "         Interpolation                 -> %8d\n",
-           HTS_ModelSet_get_duration_interpolation_size(ms));
+   fprintf(fp, "Number of states                       -> %8d\n", HTS_ModelSet_get_nstate(ms));
+   fprintf(fp, "         Interpolation                 -> %8d\n", HTS_ModelSet_get_duration_interpolation_size(ms));
    /* check interpolation */
-   for (i = 0, temp = 0.0;
-        i < HTS_ModelSet_get_duration_interpolation_size(ms); i++)
+   for (i = 0, temp = 0.0; i < HTS_ModelSet_get_duration_interpolation_size(ms); i++)
       temp += global->duration_iw[i];
    for (i = 0; i < HTS_ModelSet_get_duration_interpolation_size(ms); i++)
       if (global->duration_iw[i] != 0.0)
          global->duration_iw[i] /= temp;
    for (i = 0; i < HTS_ModelSet_get_duration_interpolation_size(ms); i++)
-      fprintf(fp,
-              "         Interpolation weight[%2d]      -> %8.0f(%%)\n", i,
-              (float) (100 * global->duration_iw[i]));
+      fprintf(fp, "         Interpolation weight[%2d]      -> %8.0f(%%)\n", i, (float) (100 * global->duration_iw[i]));
    fprintf(fp, "\n");
 
    fprintf(fp, "[Stream parameter]\n");
    for (i = 0; i < HTS_ModelSet_get_nstream(ms); i++) {
       /* stream parameter */
-      fprintf(fp, "Stream[%2d] vector length               -> %8d\n", i,
-              HTS_ModelSet_get_vector_length(ms, i));
-      fprintf(fp, "           Dynamic window size         -> %8d\n",
-              HTS_ModelSet_get_window_size(ms, i));
+      fprintf(fp, "Stream[%2d] vector length               -> %8d\n", i, HTS_ModelSet_get_vector_length(ms, i));
+      fprintf(fp, "           Dynamic window size         -> %8d\n", HTS_ModelSet_get_window_size(ms, i));
       /* interpolation */
-      fprintf(fp, "           Interpolation               -> %8d\n",
-              HTS_ModelSet_get_parameter_interpolation_size(ms, i));
-      for (j = 0, temp = 0.0;
-           j < HTS_ModelSet_get_parameter_interpolation_size(ms, i); j++)
+      fprintf(fp, "           Interpolation               -> %8d\n", HTS_ModelSet_get_parameter_interpolation_size(ms, i));
+      for (j = 0, temp = 0.0; j < HTS_ModelSet_get_parameter_interpolation_size(ms, i); j++)
          temp += global->parameter_iw[i][j];
       for (j = 0; j < HTS_ModelSet_get_parameter_interpolation_size(ms, i); j++)
          if (global->parameter_iw[i][j] != 0.0)
             global->parameter_iw[i][j] /= temp;
       for (j = 0; j < HTS_ModelSet_get_parameter_interpolation_size(ms, i); j++)
-         fprintf(fp,
-                 "           Interpolation weight[%2d]    -> %8.0f(%%)\n", j,
-                 (float) (100 * global->parameter_iw[i][j]));
+         fprintf(fp, "           Interpolation weight[%2d]    -> %8.0f(%%)\n", j, (float) (100 * global->parameter_iw[i][j]));
       /* MSD */
       if (HTS_ModelSet_is_msd(ms, i)) { /* for MSD */
          fprintf(fp, "           MSD flag                    ->     TRUE\n");
-         fprintf(fp, "           MSD threshold               -> %8.5f\n",
-                 global->msd_threshold[i]);
+         fprintf(fp, "           MSD threshold               -> %8.5f\n", global->msd_threshold[i]);
       } else {                  /* for non MSD */
          fprintf(fp, "           MSD flag                    ->    FALSE\n");
       }
@@ -589,36 +539,26 @@
          fprintf(fp, "           GV flag                     ->     TRUE\n");
          if (HTS_ModelSet_have_gv_switch(ms)) {
             if (HTS_ModelSet_have_gv_tree(ms, i)) {
-               fprintf(fp,
-                       "           GV type                     ->     CDGV\n");
-               fprintf(fp,
-                       "                                       ->  +SWITCH\n");
+               fprintf(fp, "           GV type                     ->     CDGV\n");
+               fprintf(fp, "                                       ->  +SWITCH\n");
             } else
-               fprintf(fp,
-                       "           GV type                     ->   SWITCH\n");
+               fprintf(fp, "           GV type                     ->   SWITCH\n");
          } else {
             if (HTS_ModelSet_have_gv_tree(ms, i))
-               fprintf(fp,
-                       "           GV type                     ->     CDGV\n");
+               fprintf(fp, "           GV type                     ->     CDGV\n");
             else
-               fprintf(fp,
-                       "           GV type                     ->   NORMAL\n");
+               fprintf(fp, "           GV type                     ->   NORMAL\n");
          }
-         fprintf(fp, "           GV weight                   -> %8.0f(%%)\n",
-                 (float) (100 * global->gv_weight[i]));
-         fprintf(fp, "           GV interpolation size       -> %8d\n",
-                 HTS_ModelSet_get_gv_interpolation_size(ms, i));
+         fprintf(fp, "           GV weight                   -> %8.0f(%%)\n", (float) (100 * global->gv_weight[i]));
+         fprintf(fp, "           GV interpolation size       -> %8d\n", HTS_ModelSet_get_gv_interpolation_size(ms, i));
          /* interpolation */
-         for (j = 0, temp = 0.0;
-              j < HTS_ModelSet_get_gv_interpolation_size(ms, i); j++)
+         for (j = 0, temp = 0.0; j < HTS_ModelSet_get_gv_interpolation_size(ms, i); j++)
             temp += global->gv_iw[i][j];
          for (j = 0; j < HTS_ModelSet_get_gv_interpolation_size(ms, i); j++)
             if (global->gv_iw[i][j] != 0.0)
                global->gv_iw[i][j] /= temp;
          for (j = 0; j < HTS_ModelSet_get_gv_interpolation_size(ms, i); j++)
-            fprintf(fp,
-                    "           GV interpolation weight[%2d] -> %8.0f(%%)\n", j,
-                    (float) (100 * global->gv_iw[i][j]));
+            fprintf(fp, "           GV interpolation weight[%2d] -> %8.0f(%%)\n", j, (float) (100 * global->gv_iw[i][j]));
       } else {
          fprintf(fp, "           GV flag                     ->    FALSE\n");
       }
@@ -627,58 +567,37 @@
 
    /* generated sequence */
    fprintf(fp, "[Generated sequence]\n");
-   fprintf(fp, "Number of HMMs                         -> %8d\n",
-           HTS_Label_get_size(label));
-   fprintf(fp, "Number of stats                        -> %8d\n",
-           HTS_Label_get_size(label) * HTS_ModelSet_get_nstate(ms));
-   fprintf(fp, "Length of this speech                  -> %8.3f(sec)\n",
-           (float) ((double) HTS_PStreamSet_get_total_frame(pss) *
-                    global->fperiod / global->sampling_rate));
-   fprintf(fp, "                                       -> %8.3d(frames)\n",
-           HTS_PStreamSet_get_total_frame(pss) * global->fperiod);
+   fprintf(fp, "Number of HMMs                         -> %8d\n", HTS_Label_get_size(label));
+   fprintf(fp, "Number of stats                        -> %8d\n", HTS_Label_get_size(label) * HTS_ModelSet_get_nstate(ms));
+   fprintf(fp, "Length of this speech                  -> %8.3f(sec)\n", (float) ((double) HTS_PStreamSet_get_total_frame(pss) * global->fperiod / global->sampling_rate));
+   fprintf(fp, "                                       -> %8.3d(frames)\n", HTS_PStreamSet_get_total_frame(pss) * global->fperiod);
 
    for (i = 0; i < HTS_Label_get_size(label); i++) {
       fprintf(fp, "HMM[%2d]\n", i);
-      fprintf(fp, "  Name                                 -> %s\n",
-              HTS_Label_get_string(label, i));
+      fprintf(fp, "  Name                                 -> %s\n", HTS_Label_get_string(label, i));
       fprintf(fp, "  Duration\n");
       for (j = 0; j < HTS_ModelSet_get_duration_interpolation_size(ms); j++) {
          fprintf(fp, "    Interpolation[%2d]\n", j);
-         HTS_ModelSet_get_duration_index(ms, HTS_Label_get_string(label, i), &k,
-                                         &l, j);
+         HTS_ModelSet_get_duration_index(ms, HTS_Label_get_string(label, i), &k, &l, j);
          fprintf(fp, "      Tree index                       -> %8d\n", k);
          fprintf(fp, "      PDF index                        -> %8d\n", l);
       }
       for (j = 0; j < HTS_ModelSet_get_nstate(ms); j++) {
          fprintf(fp, "  State[%2d]\n", j + 2);
-         fprintf(fp, "    Length                             -> %8d(frames)\n",
-                 HTS_SStreamSet_get_duration(sss,
-                                             i * HTS_ModelSet_get_nstate(ms) +
-                                             j));
+         fprintf(fp, "    Length                             -> %8d(frames)\n", HTS_SStreamSet_get_duration(sss, i * HTS_ModelSet_get_nstate(ms) + j));
          for (k = 0; k < HTS_ModelSet_get_nstream(ms); k++) {
             fprintf(fp, "    Stream[%2d]\n", k);
             if (HTS_ModelSet_is_msd(ms, k)) {
-               if (HTS_SStreamSet_get_msd
-                   (sss, k,
-                    i * HTS_ModelSet_get_nstate(ms) + j) >
-                   global->msd_threshold[k])
-                  fprintf(fp,
-                          "      MSD flag                         ->     TRUE\n");
+               if (HTS_SStreamSet_get_msd(sss, k, i * HTS_ModelSet_get_nstate(ms) + j) > global->msd_threshold[k])
+                  fprintf(fp, "      MSD flag                         ->     TRUE\n");
                else
-                  fprintf(fp,
-                          "      MSD flag                         ->    FALSE\n");
+                  fprintf(fp, "      MSD flag                         ->    FALSE\n");
             }
-            for (l = 0;
-                 l < HTS_ModelSet_get_parameter_interpolation_size(ms, k);
-                 l++) {
+            for (l = 0; l < HTS_ModelSet_get_parameter_interpolation_size(ms, k); l++) {
                fprintf(fp, "      Interpolation[%2d]\n", l);
-               HTS_ModelSet_get_parameter_index(ms,
-                                                HTS_Label_get_string(label, i),
-                                                &m, &n, k, j + 2, l);
-               fprintf(fp, "        Tree index                     -> %8d\n",
-                       m);
-               fprintf(fp, "        PDF index                      -> %8d\n",
-                       n);
+               HTS_ModelSet_get_parameter_index(ms, HTS_Label_get_string(label, i), &m, &n, k, j + 2, l);
+               fprintf(fp, "        Tree index                     -> %8d\n", m);
+               fprintf(fp, "        PDF index                      -> %8d\n", n);
             }
          }
       }
@@ -686,7 +605,7 @@
 }
 
 /* HTS_Engine_save_label: output label with time */
-void HTS_Engine_save_label(HTS_Engine * engine, FILE * fp)
+void HTS_Engine_save_label(HTS_Engine * engine, HTS_File * fp)
 {
    int i, j;
    int frame, state, duration;
@@ -694,23 +613,19 @@
    HTS_Label *label = &engine->label;
    HTS_SStreamSet *sss = &engine->sss;
    const int nstate = HTS_ModelSet_get_nstate(&engine->ms);
-   const double rate =
-       engine->global.fperiod * 1e+7 / engine->global.sampling_rate;
+   const double rate = engine->global.fperiod * 1e+7 / engine->global.sampling_rate;
 
    for (i = 0, state = 0, frame = 0; i < HTS_Label_get_size(label); i++) {
       for (j = 0, duration = 0; j < nstate; j++)
          duration += HTS_SStreamSet_get_duration(sss, state++);
       /* in HTK & HTS format */
-      fprintf(fp, "%lu %lu %s\n", (unsigned long) (frame * rate),
-              (unsigned long) ((frame + duration) * rate),
-              HTS_Label_get_string(label, i));
+      fprintf(fp, "%lu %lu %s\n", (unsigned long) (frame * rate), (unsigned long) ((frame + duration) * rate), HTS_Label_get_string(label, i));
       frame += duration;
    }
 }
 
 /* HTS_Engine_save_generated_parameter: output generated parameter */
-void HTS_Engine_save_generated_parameter(HTS_Engine * engine, FILE * fp,
-                                         int stream_index)
+void HTS_Engine_save_generated_parameter(HTS_Engine * engine, HTS_File * fp, int stream_index)
 {
    int i, j;
    float temp;
@@ -724,7 +639,7 @@
 }
 
 /* HTS_Engine_save_generated_speech: output generated speech */
-void HTS_Engine_save_generated_speech(HTS_Engine * engine, FILE * fp)
+void HTS_Engine_save_generated_speech(HTS_Engine * engine, HTS_File * fp)
 {
    int i;
    short temp;
@@ -737,7 +652,7 @@
 }
 
 /* HTS_Engine_save_riff: output RIFF format file */
-void HTS_Engine_save_riff(HTS_Engine * engine, FILE * fp)
+void HTS_Engine_save_riff(HTS_Engine * engine, HTS_File * fp)
 {
    int i;
    short temp;
@@ -834,7 +749,7 @@
 }
 
 /* HTS_show_copyright: write copyright to file pointer */
-void HTS_show_copyright(FILE * fp)
+void HTS_show_copyright(HTS_File * fp)
 {
    char buf[HTS_MAXBUFLEN];
 
diff -Nru htsengine-1.05/lib/HTS_gstream.c htsengine-1.06/lib/HTS_gstream.c
--- htsengine-1.05/lib/HTS_gstream.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_gstream.c	2011-12-20 11:11:30.000000000 +0900
@@ -70,11 +70,7 @@
 
 /* HTS_GStreamSet_create: generate speech */
 /* (stream[0] == spectrum && stream[1] == lf0) */
-void HTS_GStreamSet_create(HTS_GStreamSet * gss, HTS_PStreamSet * pss,
-                           int stage, HTS_Boolean use_log_gain,
-                           int sampling_rate, int fperiod, double alpha,
-                           double beta,
-                           HTS_Boolean * stop, double volume, HTS_Audio * audio)
+HTS_Boolean HTS_GStreamSet_create(HTS_GStreamSet * gss, HTS_PStreamSet * pss, int stage, HTS_Boolean use_log_gain, int sampling_rate, int fperiod, double alpha, double beta, HTS_Boolean * stop, double volume, HTS_Audio * audio)
 {
    int i, j, k;
    int msd_frame;
@@ -83,9 +79,10 @@
    double *lpf = NULL;
 
    /* check */
-   if (gss->gstream || gss->gspeech)
-      HTS_error(1,
-                "HTS_GStreamSet_create: HTS_GStreamSet is not initialized.\n");
+   if (gss->gstream || gss->gspeech) {
+      HTS_error(1, "HTS_GStreamSet_create: HTS_GStreamSet is not initialized.\n");
+      return FALSE;
+   }
 
    /* initialize */
    gss->nstream = HTS_PStreamSet_get_nstream(pss);
@@ -94,12 +91,9 @@
    gss->gstream = (HTS_GStream *) HTS_calloc(gss->nstream, sizeof(HTS_GStream));
    for (i = 0; i < gss->nstream; i++) {
       gss->gstream[i].static_length = HTS_PStreamSet_get_static_length(pss, i);
-      gss->gstream[i].par =
-          (double **) HTS_calloc(gss->total_frame, sizeof(double *));
+      gss->gstream[i].par = (double **) HTS_calloc(gss->total_frame, sizeof(double *));
       for (j = 0; j < gss->total_frame; j++)
-         gss->gstream[i].par[j] =
-             (double *) HTS_calloc(gss->gstream[i].static_length,
-                                   sizeof(double));
+         gss->gstream[i].par[j] = (double *) HTS_calloc(gss->gstream[i].static_length, sizeof(double));
    }
    gss->gspeech = (short *) HTS_calloc(gss->total_nsample, sizeof(short));
 
@@ -109,8 +103,7 @@
          for (j = 0, msd_frame = 0; j < gss->total_frame; j++)
             if (HTS_PStreamSet_get_msd_flag(pss, i, j)) {
                for (k = 0; k < gss->gstream[i].static_length; k++)
-                  gss->gstream[i].par[j][k] =
-                      HTS_PStreamSet_get_parameter(pss, i, msd_frame, k);
+                  gss->gstream[i].par[j][k] = HTS_PStreamSet_get_parameter(pss, i, msd_frame, k);
                msd_frame++;
             } else
                for (k = 0; k < gss->gstream[i].static_length; k++)
@@ -118,38 +111,41 @@
       } else {                  /* for non MSD */
          for (j = 0; j < gss->total_frame; j++)
             for (k = 0; k < gss->gstream[i].static_length; k++)
-               gss->gstream[i].par[j][k] =
-                   HTS_PStreamSet_get_parameter(pss, i, j, k);
+               gss->gstream[i].par[j][k] = HTS_PStreamSet_get_parameter(pss, i, j, k);
       }
    }
 
    /* check */
-   if (gss->nstream != 2 && gss->nstream != 3)
-      HTS_error(1,
-                "HTS_GStreamSet_create: The number of streams should be 2 or 3.\n");
-   if (HTS_PStreamSet_get_static_length(pss, 1) != 1)
-      HTS_error(1,
-                "HTS_GStreamSet_create: The size of lf0 static vector should be 1.\n");
-   if (gss->nstream >= 3 && gss->gstream[2].static_length % 2 == 0)
-      HTS_error(1,
-                "HTS_GStreamSet_create: The number of low-pass filter coefficient should be odd numbers.");
+   if (gss->nstream != 2 && gss->nstream != 3) {
+      HTS_error(1, "HTS_GStreamSet_create: The number of streams should be 2 or 3.\n");
+      HTS_GStreamSet_clear(gss);
+      return FALSE;
+   }
+   if (HTS_PStreamSet_get_static_length(pss, 1) != 1) {
+      HTS_error(1, "HTS_GStreamSet_create: The size of lf0 static vector should be 1.\n");
+      HTS_GStreamSet_clear(gss);
+      return FALSE;
+   }
+   if (gss->nstream >= 3 && gss->gstream[2].static_length % 2 == 0) {
+      HTS_error(1, "HTS_GStreamSet_create: The number of low-pass filter coefficient should be odd numbers.");
+      HTS_GStreamSet_clear(gss);
+      return FALSE;
+   }
 
    /* synthesize speech waveform */
-   HTS_Vocoder_initialize(&v, gss->gstream[0].static_length - 1, stage,
-                          use_log_gain, sampling_rate, fperiod);
+   HTS_Vocoder_initialize(&v, gss->gstream[0].static_length - 1, stage, use_log_gain, sampling_rate, fperiod);
    if (gss->nstream >= 3)
       nlpf = (gss->gstream[2].static_length - 1) / 2;
    for (i = 0; i < gss->total_frame && (*stop) == FALSE; i++) {
       if (gss->nstream >= 3)
          lpf = &gss->gstream[2].par[i][0];
-      HTS_Vocoder_synthesize(&v, gss->gstream[0].static_length - 1,
-                             gss->gstream[1].par[i][0],
-                             &gss->gstream[0].par[i][0], nlpf, lpf, alpha, beta,
-                             volume, &gss->gspeech[i * fperiod], audio);
+      HTS_Vocoder_synthesize(&v, gss->gstream[0].static_length - 1, gss->gstream[1].par[i][0], &gss->gstream[0].par[i][0], nlpf, lpf, alpha, beta, volume, &gss->gspeech[i * fperiod], audio);
    }
    HTS_Vocoder_clear(&v);
    if (audio)
       HTS_Audio_flush(audio);
+
+   return TRUE;
 }
 
 /* HTS_GStreamSet_get_total_nsample: get total number of sample */
@@ -177,8 +173,7 @@
 }
 
 /* HTS_GStreamSet_get_parameter: get generated parameter */
-double HTS_GStreamSet_get_parameter(HTS_GStreamSet * gss, int stream_index,
-                                    int frame_index, int vector_index)
+double HTS_GStreamSet_get_parameter(HTS_GStreamSet * gss, int stream_index, int frame_index, int vector_index)
 {
    return gss->gstream[stream_index].par[frame_index][vector_index];
 }
diff -Nru htsengine-1.05/lib/HTS_hidden.h htsengine-1.06/lib/HTS_hidden.h
--- htsengine-1.05/lib/HTS_hidden.h	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_hidden.h	2011-12-20 11:11:30.000000000 +0900
@@ -72,23 +72,26 @@
 /* HTS_error: output error message */
 void HTS_error(const int error, char *message, ...);
 
-/* HTS_get_fp: wrapper for fopen */
-FILE *HTS_get_fp(const char *name, const char *opt);
+/* HTS_fgetc: wrapper for fgetc */
+int HTS_fgetc(HTS_File * fp);
+
+/* HTS_feof: wrapper for feof */
+int HTS_feof(HTS_File * fp);
 
 /* HTS_get_pattern_token: get pattern token */
-void HTS_get_pattern_token(FILE * fp, char *buff);
+HTS_Boolean HTS_get_pattern_token(HTS_File * fp, char *buff);
 
 /* HTS_get_token: get token (separator are space,tab,line break) */
-HTS_Boolean HTS_get_token(FILE * fp, char *buff);
+HTS_Boolean HTS_get_token(HTS_File * fp, char *buff);
 
 /* HTS_get_token_from_string: get token from string (separator are space,tab,line break) */
 HTS_Boolean HTS_get_token_from_string(char *string, int *index, char *buff);
 
 /* HTS_fwrite_little_endian: fwrite with byteswap */
-int HTS_fwrite_little_endian(void *p, const int size, const int num, FILE * fp);
+int HTS_fwrite_little_endian(void *p, const int size, const int num, HTS_File * fp);
 
 /* HTS_fread_big_endiana: fread with byteswap */
-int HTS_fread_big_endian(void *p, const int size, const int num, FILE * fp);
+int HTS_fread_big_endian(void *p, const int size, const int num, HTS_File * fp);
 
 /* HTS_calloc: wrapper for calloc */
 char *HTS_calloc(const size_t num, const size_t size);
@@ -150,7 +153,7 @@
 #define IRLENG    96
 #endif                          /* HTS_EMBEDDED */
 
-#define PULSELISTSIZE 512
+#define PULSELISTSIZE 1024
 
 /* for MGLSA filter */
 #define NORMFLG1 TRUE
diff -Nru htsengine-1.05/lib/HTS_label.c htsengine-1.06/lib/HTS_label.c
--- htsengine-1.05/lib/HTS_label.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_label.c	2011-12-20 11:11:30.000000000 +0900
@@ -105,25 +105,25 @@
 }
 
 /* HTS_Label_load_from_fn: load label from file name */
-void HTS_Label_load_from_fn(HTS_Label * label, int sampling_rate, int fperiod,
-                            char *fn)
+void HTS_Label_load_from_fn(HTS_Label * label, int sampling_rate, int fperiod, char *fn)
 {
-   FILE *fp = HTS_get_fp(fn, "r");
+   HTS_File *fp = HTS_fopen(fn, "r");
    HTS_Label_load_from_fp(label, sampling_rate, fperiod, fp);
-   fclose(fp);
+   HTS_fclose(fp);
 }
 
 /* HTS_Label_load_from_fp: load label from file pointer */
-void HTS_Label_load_from_fp(HTS_Label * label, int sampling_rate, int fperiod,
-                            FILE * fp)
+void HTS_Label_load_from_fp(HTS_Label * label, int sampling_rate, int fperiod, HTS_File * fp)
 {
    char buff[HTS_MAXBUFLEN];
    HTS_LabelString *lstring = NULL;
    double start, end;
    const double rate = (double) sampling_rate / ((double) fperiod * 1e+7);
 
-   if (label->head || label->size != 0)
+   if (label->head || label->size != 0) {
       HTS_error(1, "HTS_Label_load_from_fp: label is not initialized.\n");
+      return;
+   }
    /* parse label file */
    while (HTS_get_token(fp, buff)) {
       if (!isgraph((int) buff[0]))
@@ -131,8 +131,7 @@
       label->size++;
 
       if (lstring) {
-         lstring->next =
-             (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
+         lstring->next = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
          lstring = lstring->next;
       } else {                  /* first time */
          lstring = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
@@ -156,8 +155,7 @@
 }
 
 /* HTS_Label_load_from_string: load label from string */
-void HTS_Label_load_from_string(HTS_Label * label, int sampling_rate,
-                                int fperiod, char *data)
+void HTS_Label_load_from_string(HTS_Label * label, int sampling_rate, int fperiod, char *data)
 {
    char buff[HTS_MAXBUFLEN];
    HTS_LabelString *lstring = NULL;
@@ -165,8 +163,10 @@
    double start, end;
    const double rate = (double) sampling_rate / ((double) fperiod * 1e+7);
 
-   if (label->head || label->size != 0)
+   if (label->head || label->size != 0) {
       HTS_error(1, "HTS_Label_load_from_fp: label list is not initialized.\n");
+      return;
+   }
    /* copy label */
    while (HTS_get_token_from_string(data, &data_index, buff)) {
       if (!isgraph((int) buff[0]))
@@ -174,8 +174,7 @@
       label->size++;
 
       if (lstring) {
-         lstring->next =
-             (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
+         lstring->next = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
          lstring = lstring->next;
       } else {                  /* first time */
          lstring = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
@@ -199,8 +198,7 @@
 }
 
 /* HTS_Label_load_from_string_list: load label from string list */
-void HTS_Label_load_from_string_list(HTS_Label * label, int sampling_rate,
-                                     int fperiod, char **data, int size)
+void HTS_Label_load_from_string_list(HTS_Label * label, int sampling_rate, int fperiod, char **data, int size)
 {
    char buff[HTS_MAXBUFLEN];
    HTS_LabelString *lstring = NULL;
@@ -209,8 +207,10 @@
    double start, end;
    const double rate = (double) sampling_rate / ((double) fperiod * 1e+7);
 
-   if (label->head || label->size != 0)
+   if (label->head || label->size != 0) {
       HTS_error(1, "HTS_Label_load_from_fp: label list is not initialized.\n");
+      return;
+   }
    /* copy label */
    for (i = 0; i < size; i++) {
       if (!isgraph((int) data[i][0]))
@@ -218,8 +218,7 @@
       label->size++;
 
       if (lstring) {
-         lstring->next =
-             (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
+         lstring->next = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
          lstring = lstring->next;
       } else {                  /* first time */
          lstring = (HTS_LabelString *) HTS_calloc(1, sizeof(HTS_LabelString));
@@ -232,7 +231,7 @@
          HTS_get_token_from_string(data[i], &data_index, buff);
          end = atof(buff);
          HTS_get_token_from_string(data[i], &data_index, buff);
-         lstring->name = HTS_strdup(&buff[data_index]);
+         lstring->name = HTS_strdup(buff);
          lstring->start = rate * start;
          lstring->end = rate * end;
       } else {
diff -Nru htsengine-1.05/lib/HTS_misc.c htsengine-1.06/lib/HTS_misc.c
--- htsengine-1.05/lib/HTS_misc.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_misc.c	2011-12-20 11:11:30.000000000 +0900
@@ -109,48 +109,89 @@
       exit(error);
 }
 
-/* HTS_get_fp: wrapper for fopen */
-FILE *HTS_get_fp(const char *name, const char *opt)
+/* HTS_fopen: wrapper for fopen */
+HTS_File *HTS_fopen(const char *name, const char *opt)
 {
-   FILE *fp = fopen(name, opt);
+   HTS_File *fp = fopen(name, opt);
 
-   if (fp == NULL)
-      HTS_error(2, "HTS_get_fp: Cannot open %s.\n", name);
+   if (fp == NULL) {
+      HTS_error(1, "HTS_fopen: Cannot open %s.\n", name);
+      return NULL;
+   }
+
+   return fp;
+}
 
-   return (fp);
+/* HTS_fgetc: wrapper for fgetc */
+int HTS_fgetc(HTS_File * fp)
+{
+   return fgetc(fp);
+}
+
+/* HTS_feof: wrapper for feof */
+int HTS_feof(HTS_File * fp)
+{
+   return feof(fp);
+}
+
+/* HTS_fread: wrapper for fread */
+size_t HTS_fread(void *buf, size_t size, size_t n, HTS_File * fp)
+{
+   return fread(buf, size, n, fp);
+}
+
+/* HTS_fwrite: wrapper for fwrite */
+size_t HTS_fwrite(const void *buf, size_t size, size_t n, HTS_File * fp)
+{
+   return fwrite(buf, size, n, fp);
+}
+
+/* HTS_fclose: wrapper for fclose */
+void HTS_fclose(HTS_File * fp)
+{
+   fclose(fp);
 }
 
 /* HTS_get_pattern_token: get pattern token */
-void HTS_get_pattern_token(FILE * fp, char *buff)
+HTS_Boolean HTS_get_pattern_token(HTS_File * fp, char *buff)
 {
    char c;
    int i;
    HTS_Boolean squote = FALSE, dquote = FALSE;
 
-   c = fgetc(fp);
+   if (fp == NULL || HTS_feof(fp))
+      return FALSE;
+   c = HTS_fgetc(fp);
 
-   while (c == ' ' || c == '\n')
-      c = fgetc(fp);
+   while (c == ' ' || c == '\n') {
+      if (HTS_feof(fp))
+         return FALSE;
+      c = HTS_fgetc(fp);
+   }
 
    if (c == '\'') {             /* single quote case */
-      c = fgetc(fp);
+      if (HTS_feof(fp))
+         return FALSE;
+      c = HTS_fgetc(fp);
       squote = TRUE;
    }
 
    if (c == '\"') {             /*double quote case */
-      c = fgetc(fp);
+      if (HTS_feof(fp))
+         return FALSE;
+      c = HTS_fgetc(fp);
       dquote = TRUE;
    }
 
    if (c == ',') {              /*special character ',' */
       strcpy(buff, ",");
-      return;
+      return TRUE;
    }
 
    i = 0;
    while (1) {
       buff[i++] = c;
-      c = fgetc(fp);
+      c = HTS_fgetc(fp);
       if (squote && c == '\'')
          break;
       if (dquote && c == '\"')
@@ -160,39 +201,42 @@
             break;
          if (c == '\n')
             break;
-         if (feof(fp))
+         if (HTS_feof(fp))
             break;
       }
    }
 
    buff[i] = '\0';
+   return TRUE;
 }
 
-/* HTS_get_token: get token (separator are space,tab,line break) */
-HTS_Boolean HTS_get_token(FILE * fp, char *buff)
+/* HTS_get_token: get token (separators are space, tab, and line break) */
+HTS_Boolean HTS_get_token(HTS_File * fp, char *buff)
 {
    char c;
    int i;
 
-   if (feof(fp))
+   if (fp == NULL || HTS_feof(fp))
       return FALSE;
-   c = fgetc(fp);
+   c = HTS_fgetc(fp);
    while (c == ' ' || c == '\n' || c == '\t') {
-      if (feof(fp))
+      if (HTS_feof(fp))
          return FALSE;
-      c = getc(fp);
+      c = HTS_fgetc(fp);
    }
 
-   for (i = 0; c != ' ' && c != '\n' && c != '\t' && !feof(fp); i++) {
-      buff[i] = c;
-      c = fgetc(fp);
+   for (i = 0; c != ' ' && c != '\n' && c != '\t';) {
+      buff[i++] = c;
+      if (HTS_feof(fp))
+         break;
+      c = HTS_fgetc(fp);
    }
 
    buff[i] = '\0';
    return TRUE;
 }
 
-/* HTS_get_token_from_string: get token from string (separator are space,tab,line break) */
+/* HTS_get_token_from_string: get token from string (separators are space, tab, and line break) */
 HTS_Boolean HTS_get_token_from_string(char *string, int *index, char *buff)
 {
    char c;
@@ -219,9 +263,9 @@
 }
 
 /* HTS_fread_big_endian: fread with byteswap */
-int HTS_fread_big_endian(void *p, const int size, const int num, FILE * fp)
+int HTS_fread_big_endian(void *p, const int size, const int num, HTS_File * fp)
 {
-   const int block = fread(p, size, num, fp);
+   const int block = HTS_fread(p, size, num, fp);
 
 #ifdef WORDS_LITTLEENDIAN
    HTS_byte_swap(p, size, block);
@@ -231,14 +275,14 @@
 }
 
 /* HTS_fwrite_little_endian: fwrite with byteswap */
-int HTS_fwrite_little_endian(void *p, const int size, const int num, FILE * fp)
+int HTS_fwrite_little_endian(void *p, const int size, const int num, HTS_File * fp)
 {
    const int block = num * size;
 
 #ifdef WORDS_BIGENDIAN
    HTS_byte_swap(p, size, block);
 #endif                          /* WORDS_BIGENDIAN */
-   fwrite(p, size, num, fp);
+   HTS_fwrite(p, size, num, fp);
 
    return block;
 }
diff -Nru htsengine-1.05/lib/HTS_model.c htsengine-1.06/lib/HTS_model.c
--- htsengine-1.05/lib/HTS_model.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_model.c	2011-12-20 11:11:30.000000000 +0900
@@ -63,8 +63,7 @@
 #include "HTS_hidden.h"
 
 /* HTS_dp_match: recursive matching */
-static HTS_Boolean HTS_dp_match(const char *string, const char *pattern,
-                                const int pos, const int max)
+static HTS_Boolean HTS_dp_match(const char *string, const char *pattern, const int pos, const int max)
 {
    if (pos > max)
       return FALSE;
@@ -105,8 +104,7 @@
          max++;
       }
    }
-   if (nstar == 2 && nquestion == 0 && pattern[0] == '*'
-       && pattern[i - 1] == '*') {
+   if (nstar == 2 && nquestion == 0 && pattern[0] == '*' && pattern[i - 1] == '*') {
       /* only string matching is required */
       buff_length = i - 2;
       for (i = 0, j = 1; i < buff_length; i++, j++)
@@ -158,22 +156,35 @@
    return atoi(string);
 }
 
+static void HTS_Question_clear(HTS_Question * question);
+
 /* HTS_Question_load: Load questions from file */
-static void HTS_Question_load(HTS_Question * question, FILE * fp)
+static HTS_Boolean HTS_Question_load(HTS_Question * question, HTS_File * fp)
 {
    char buff[HTS_MAXBUFLEN];
    HTS_Pattern *pattern, *last_pattern;
 
+   if (question == NULL || fp == NULL)
+      return FALSE;
+
    /* get question name */
-   HTS_get_pattern_token(fp, buff);
+   if (HTS_get_pattern_token(fp, buff) == FALSE)
+      return FALSE;
    question->string = HTS_strdup(buff);
    question->head = NULL;
    /* get pattern list */
-   HTS_get_pattern_token(fp, buff);
+   if (HTS_get_pattern_token(fp, buff) == FALSE) {
+      free(question->string);
+      question->string = NULL;
+      return FALSE;
+   }
    last_pattern = NULL;
    if (strcmp(buff, "{") == 0) {
       while (1) {
-         HTS_get_pattern_token(fp, buff);
+         if (HTS_get_pattern_token(fp, buff) == FALSE) {
+            HTS_Question_clear(question);
+            return FALSE;
+         }
          pattern = (HTS_Pattern *) HTS_calloc(1, sizeof(HTS_Pattern));
          if (question->head)
             last_pattern->next = pattern;
@@ -181,17 +192,20 @@
             question->head = pattern;
          pattern->string = HTS_strdup(buff);
          pattern->next = NULL;
-         HTS_get_pattern_token(fp, buff);
+         if (HTS_get_pattern_token(fp, buff) == FALSE) {
+            HTS_Question_clear(question);
+            return FALSE;
+         }
          if (!strcmp(buff, "}"))
             break;
          last_pattern = pattern;
       }
    }
+   return TRUE;
 }
 
 /* HTS_Question_match: check given string match given question */
-static HTS_Boolean HTS_Question_match(const HTS_Question * question,
-                                      const char *string)
+static HTS_Boolean HTS_Question_match(const HTS_Question * question, const char *string)
 {
    HTS_Pattern *pattern;
 
@@ -203,8 +217,7 @@
 }
 
 /* HTS_Question_find_question: find question from question list */
-static HTS_Question *HTS_Question_find_question(HTS_Question * question,
-                                                const char *buff)
+static HTS_Question *HTS_Question_find_question(HTS_Question * question, const char *buff)
 {
 
    for (; question; question = question->next)
@@ -285,27 +298,51 @@
    }
 }
 
+static void HTS_Tree_clear(HTS_Tree * tree);
+
 /* HTS_Tree_load: Load trees */
-static void HTS_Tree_load(HTS_Tree * tree, FILE * fp, HTS_Question * question)
+static HTS_Boolean HTS_Tree_load(HTS_Tree * tree, HTS_File * fp, HTS_Question * question)
 {
    char buff[HTS_MAXBUFLEN];
    HTS_Node *node, *last_node;
 
-   HTS_get_pattern_token(fp, buff);
+   if (tree == NULL || fp == NULL)
+      return FALSE;
+
+   if (HTS_get_pattern_token(fp, buff) == FALSE) {
+      HTS_Tree_clear(tree);
+      return FALSE;
+   }
    node = (HTS_Node *) HTS_calloc(1, sizeof(HTS_Node));
    node->index = 0;
    tree->root = last_node = node;
 
    if (strcmp(buff, "{") == 0) {
-      while (HTS_get_pattern_token(fp, buff), strcmp(buff, "}") != 0) {
+      while (HTS_get_pattern_token(fp, buff) == TRUE && strcmp(buff, "}") != 0) {
          node = HTS_Node_find(last_node, atoi(buff));
-         HTS_get_pattern_token(fp, buff);       /* load question at this node */
-
+         if (node == NULL) {
+            HTS_Tree_clear(tree);
+            return FALSE;
+         }
+         if (HTS_get_pattern_token(fp, buff) == FALSE) {
+            HTS_Tree_clear(tree);
+            return FALSE;
+         }
          node->quest = HTS_Question_find_question(question, buff);
+         if (node->quest == NULL) {
+            HTS_Tree_clear(tree);
+            return FALSE;
+         }
          node->yes = (HTS_Node *) HTS_calloc(1, sizeof(HTS_Node));
          node->no = (HTS_Node *) HTS_calloc(1, sizeof(HTS_Node));
 
-         HTS_get_pattern_token(fp, buff);
+         if (HTS_get_pattern_token(fp, buff) == FALSE) {
+            node->quest = NULL;
+            free(node->yes);
+            free(node->no);
+            HTS_Tree_clear(tree);
+            return FALSE;
+         }
          if (HTS_is_num(buff))
             node->no->index = atoi(buff);
          else
@@ -313,7 +350,13 @@
          node->no->next = last_node;
          last_node = node->no;
 
-         HTS_get_pattern_token(fp, buff);
+         if (HTS_get_pattern_token(fp, buff) == FALSE) {
+            node->quest = NULL;
+            free(node->yes);
+            free(node->no);
+            HTS_Tree_clear(tree);
+            return FALSE;
+         }
          if (HTS_is_num(buff))
             node->yes->index = atoi(buff);
          else
@@ -324,6 +367,8 @@
    } else {
       node->pdf = HTS_name2num(buff);
    }
+
+   return TRUE;
 }
 
 /* HTS_Node_search: tree search */
@@ -373,12 +418,19 @@
    win->max_width = 0;
 }
 
+static void HTS_Window_clear(HTS_Window * win);
+
 /* HTS_Window_load: load dynamic windows */
-static void HTS_Window_load(HTS_Window * win, FILE ** fp, int size)
+static HTS_Boolean HTS_Window_load(HTS_Window * win, HTS_File ** fp, int size)
 {
    int i, j;
    int fsize, length;
    char buff[HTS_MAXBUFLEN];
+   HTS_Boolean result = TRUE;
+
+   /* check */
+   if (win == NULL || fp == NULL || size <= 0)
+      return FALSE;
 
    win->size = size;
    win->l_width = (int *) HTS_calloc(win->size, sizeof(int));
@@ -386,13 +438,25 @@
    win->coefficient = (double **) HTS_calloc(win->size, sizeof(double *));
    /* set delta coefficents */
    for (i = 0; i < win->size; i++) {
-      HTS_get_token(fp[i], buff);
-      fsize = atoi(buff);
+      if (HTS_get_token(fp[i], buff) == FALSE) {
+         result = FALSE;
+         fsize = 1;
+      } else {
+         fsize = atoi(buff);
+         if (fsize <= 0) {
+            result = FALSE;
+            fsize = 1;
+         }
+      }
       /* read coefficients */
       win->coefficient[i] = (double *) HTS_calloc(fsize, sizeof(double));
       for (j = 0; j < fsize; j++) {
-         HTS_get_token(fp[i], buff);
-         win->coefficient[i][j] = (double) atof(buff);
+         if (HTS_get_token(fp[i], buff) == FALSE) {
+            result = FALSE;
+            win->coefficient[i][j] = 0.0;
+         } else {
+            win->coefficient[i][j] = (double) atof(buff);
+         }
       }
       /* set pointer */
       length = fsize / 2;
@@ -410,6 +474,12 @@
       if (win->max_width < abs(win->r_width[i]))
          win->max_width = abs(win->r_width[i]);
    }
+
+   if (result == FALSE) {
+      HTS_Window_clear(win);
+      return FALSE;
+   }
+   return TRUE;
 }
 
 /* HTS_Window_clear: free dynamic window */
@@ -443,95 +513,120 @@
    model->question = NULL;
 }
 
+static void HTS_Model_clear(HTS_Model * model);
+
 /* HTS_Model_load_pdf: load pdfs */
-static void HTS_Model_load_pdf(HTS_Model * model, FILE * fp, int ntree,
-                               HTS_Boolean msd_flag)
+static HTS_Boolean HTS_Model_load_pdf(HTS_Model * model, HTS_File * fp, int ntree, HTS_Boolean msd_flag)
 {
    int i, j, k, l, m;
    float temp;
    int ssize;
+   HTS_Boolean result = TRUE;
 
    /* check */
-   if (fp == NULL)
+   if (model == NULL || fp == NULL || ntree <= 0) {
       HTS_error(1, "HTS_Model_load_pdf: File for pdfs is not specified.\n");
+      return FALSE;
+   }
 
    /* load pdf */
    model->ntree = ntree;
    /* read MSD flag */
    HTS_fread_big_endian(&i, sizeof(int), 1, fp);
-   if ((i != 0 || msd_flag != FALSE) && (i != 1 || msd_flag != TRUE))
+   if ((i != 0 || msd_flag != FALSE) && (i != 1 || msd_flag != TRUE)) {
       HTS_error(1, "HTS_Model_load_pdf: Failed to load header of pdfs.\n");
+      HTS_Model_initialize(model);
+      return FALSE;
+   }
    /* read stream size */
    HTS_fread_big_endian(&ssize, sizeof(int), 1, fp);
-   if (ssize < 1)
+   if (ssize < 1) {
       HTS_error(1, "HTS_Model_load_pdf: Failed to load header of pdfs.\n");
+      HTS_Model_initialize(model);
+      return FALSE;
+   }
    /* read vector size */
    HTS_fread_big_endian(&model->vector_length, sizeof(int), 1, fp);
-   if (model->vector_length < 0)
-      HTS_error(1,
-                "HTS_Model_load_pdf: # of HMM states %d should be positive.\n",
-                model->vector_length);
+   if (model->vector_length <= 0) {
+      HTS_error(1, "HTS_Model_load_pdf: # of HMM states %d should be positive.\n", model->vector_length);
+      HTS_Model_initialize(model);
+      return FALSE;
+   }
    model->npdf = (int *) HTS_calloc(ntree, sizeof(int));
    model->npdf -= 2;
    /* read the number of pdfs */
-   HTS_fread_big_endian(&model->npdf[2], sizeof(int), ntree, fp);
+   if (HTS_fread_big_endian(&model->npdf[2], sizeof(int), ntree, fp) != ntree)
+      result = FALSE;
    for (i = 2; i <= ntree + 1; i++)
-      if (model->npdf[i] < 0)
-         HTS_error(1,
-                   "HTS_Model_load_pdf: # of pdfs at %d-th state should be positive.\n",
-                   i);
+      if (model->npdf[i] <= 0) {
+         HTS_error(1, "HTS_Model_load_pdf: # of pdfs at %d-th state should be positive.\n", i);
+         result = FALSE;
+         break;
+      }
+   if (result == FALSE) {
+      model->npdf += 2;
+      free(model->npdf);
+      HTS_Model_initialize(model);
+      return FALSE;
+   }
    model->pdf = (double ***) HTS_calloc(ntree, sizeof(double **));
    model->pdf -= 2;
    /* read means and variances */
    if (msd_flag) {              /* for MSD */
       for (j = 2; j <= ntree + 1; j++) {
-         model->pdf[j] = (double **)
-             HTS_calloc(model->npdf[j], sizeof(double *));
+         model->pdf[j] = (double **) HTS_calloc(model->npdf[j], sizeof(double *));
          model->pdf[j]--;
          for (k = 1; k <= model->npdf[j]; k++) {
-            model->pdf[j][k] = (double *)
-                HTS_calloc(2 * model->vector_length + 1, sizeof(double));
+            model->pdf[j][k] = (double *) HTS_calloc(2 * model->vector_length + 1, sizeof(double));
             for (l = 0; l < ssize; l++) {
                for (m = 0; m < model->vector_length / ssize; m++) {
-                  HTS_fread_big_endian(&temp, sizeof(float), 1, fp);
-                  model->pdf[j][k][l * model->vector_length / ssize + m] =
-                      (double) temp;
-                  HTS_fread_big_endian(&temp, sizeof(float), 1, fp);
-                  model->pdf[j][k][l * model->vector_length / ssize + m +
-                                   model->vector_length] = (double) temp;
+                  if (HTS_fread_big_endian(&temp, sizeof(float), 1, fp) != 1)
+                     result = FALSE;
+                  model->pdf[j][k][l * model->vector_length / ssize + m] = (double) temp;
+                  if (HTS_fread_big_endian(&temp, sizeof(float), 1, fp) != 1)
+                     result = FALSE;
+                  model->pdf[j][k][l * model->vector_length / ssize + m + model->vector_length] = (double) temp;
                }
-               HTS_fread_big_endian(&temp, sizeof(float), 1, fp);
+               if (HTS_fread_big_endian(&temp, sizeof(float), 1, fp) != 1)
+                  result = FALSE;
                if (l == 0) {
-                  if (temp < 0.0 || temp > 1.0)
-                     HTS_error(1,
-                               "HTS_Model_load_pdf: MSD weight should be within 0.0 to 1.0.\n");
+                  if (temp < 0.0 || temp > 1.0) {
+                     HTS_error(1, "HTS_Model_load_pdf: MSD weight should be within 0.0 to 1.0.\n");
+                     result = FALSE;
+                  }
                   model->pdf[j][k][2 * model->vector_length] = (double) temp;
                }
-               HTS_fread_big_endian(&temp, sizeof(float), 1, fp);
+               if (HTS_fread_big_endian(&temp, sizeof(float), 1, fp) != 1)
+                  result = FALSE;
             }
          }
       }
    } else {                     /* for non MSD */
       for (j = 2; j <= ntree + 1; j++) {
-         model->pdf[j] =
-             (double **) HTS_calloc(model->npdf[j], sizeof(double *));
+         model->pdf[j] = (double **) HTS_calloc(model->npdf[j], sizeof(double *));
          model->pdf[j]--;
          for (k = 1; k <= model->npdf[j]; k++) {
-            model->pdf[j][k] =
-                (double *) HTS_calloc(2 * model->vector_length, sizeof(double));
+            model->pdf[j][k] = (double *) HTS_calloc(2 * model->vector_length, sizeof(double));
             for (l = 0; l < model->vector_length; l++) {
-               HTS_fread_big_endian(&temp, sizeof(float), 1, fp);
+               if (HTS_fread_big_endian(&temp, sizeof(float), 1, fp) != 1)
+                  result = FALSE;
                model->pdf[j][k][l] = (double) temp;
-               HTS_fread_big_endian(&temp, sizeof(float), 1, fp);
+               if (HTS_fread_big_endian(&temp, sizeof(float), 1, fp) != 1)
+                  result = FALSE;
                model->pdf[j][k][l + model->vector_length] = (double) temp;
             }
          }
       }
    }
+   if (result == FALSE) {
+      HTS_Model_clear(model);
+      return FALSE;
+   }
+   return TRUE;
 }
 
 /* HTS_Model_load_tree: load trees */
-static void HTS_Model_load_tree(HTS_Model * model, FILE * fp)
+static HTS_Boolean HTS_Model_load_tree(HTS_Model * model, HTS_File * fp)
 {
    char buff[HTS_MAXBUFLEN];
    HTS_Question *question, *last_question;
@@ -539,18 +634,24 @@
    int state;
 
    /* check */
-   if (fp == NULL)
+   if (model == NULL || fp == NULL) {
       HTS_error(1, "HTS_Model_load_tree: File for trees is not specified.\n");
+      return FALSE;
+   }
 
    model->ntree = 0;
    last_question = NULL;
    last_tree = NULL;
-   while (!feof(fp)) {
+   while (!HTS_feof(fp)) {
       HTS_get_pattern_token(fp, buff);
       /* parse questions */
       if (strcmp(buff, "QS") == 0) {
          question = (HTS_Question *) HTS_calloc(1, sizeof(HTS_Question));
-         HTS_Question_load(question, fp);
+         if (HTS_Question_load(question, fp) == FALSE) {
+            free(question);
+            HTS_Model_clear(model);
+            return FALSE;
+         }
          if (model->question)
             last_question->next = question;
          else
@@ -567,7 +668,11 @@
          tree->head = NULL;
          tree->state = state;
          HTS_Tree_parse_pattern(tree, buff);
-         HTS_Tree_load(tree, fp, model->question);
+         if (HTS_Tree_load(tree, fp, model->question) == FALSE) {
+            free(tree);
+            HTS_Model_clear(model);
+            return FALSE;
+         }
          if (model->tree)
             last_tree->next = tree;
          else
@@ -578,8 +683,11 @@
       }
    }
    /* No Tree information in tree file */
-   if (model->tree == NULL)
+   if (model->tree == NULL) {
       HTS_error(1, "HTS_Model_load_tree: No trees are loaded.\n");
+      return FALSE;
+   }
+   return TRUE;
 }
 
 /* HTS_Model_clear: free pdfs and trees */
@@ -627,70 +735,93 @@
    stream->interpolation_size = 0;
 }
 
+static void HTS_Stream_clear(HTS_Stream * stream);
+
 /* HTS_Stream_load_pdf: load pdf */
-static void HTS_Stream_load_pdf(HTS_Stream * stream, FILE ** fp, int ntree,
-                                HTS_Boolean msd_flag, int interpolation_size)
+static HTS_Boolean HTS_Stream_load_pdf(HTS_Stream * stream, HTS_File ** fp, int ntree, HTS_Boolean msd_flag, int interpolation_size)
 {
    int i;
+   HTS_Boolean result = TRUE;
 
    /* initialize */
    stream->msd_flag = msd_flag;
    stream->interpolation_size = interpolation_size;
-   stream->model =
-       (HTS_Model *) HTS_calloc(interpolation_size, sizeof(HTS_Model));
+   stream->model = (HTS_Model *) HTS_calloc(interpolation_size, sizeof(HTS_Model));
    /* load pdfs */
    for (i = 0; i < stream->interpolation_size; i++) {
       HTS_Model_initialize(&stream->model[i]);
-      HTS_Model_load_pdf(&stream->model[i], fp[i], ntree, stream->msd_flag);
+      if (HTS_Model_load_pdf(&stream->model[i], fp[i], ntree, stream->msd_flag) == FALSE)
+         result = FALSE;
+   }
+   if (result == FALSE) {
+      HTS_Stream_clear(stream);
+      return FALSE;
    }
    /* check */
-   for (i = 1; i < stream->interpolation_size; i++)
-      if (stream->model[0].vector_length != stream->model[1].vector_length)
-         HTS_error(1,
-                   "HTS_Stream_load_pdf: # of states are different in between given modelsets.\n");
+   for (i = 1; i < stream->interpolation_size; i++) {
+      if (stream->model[0].vector_length != stream->model[1].vector_length) {
+         HTS_error(1, "HTS_Stream_load_pdf: # of states are different in between given modelsets.\n");
+         HTS_Stream_clear(stream);
+         return FALSE;
+      }
+   }
    /* set */
    stream->vector_length = stream->model[0].vector_length;
+
+   return TRUE;
 }
 
 /* HTS_Stream_load_pdf_and_tree: load PDFs and trees */
-static void HTS_Stream_load_pdf_and_tree(HTS_Stream * stream, FILE ** pdf_fp,
-                                         FILE ** tree_fp, HTS_Boolean msd_flag,
-                                         int interpolation_size)
+static HTS_Boolean HTS_Stream_load_pdf_and_tree(HTS_Stream * stream, HTS_File ** pdf_fp, HTS_File ** tree_fp, HTS_Boolean msd_flag, int interpolation_size)
 {
    int i;
+   HTS_Boolean result = TRUE;
 
    /* initialize */
    stream->msd_flag = msd_flag;
    stream->interpolation_size = interpolation_size;
-   stream->model =
-       (HTS_Model *) HTS_calloc(interpolation_size, sizeof(HTS_Model));
+   stream->model = (HTS_Model *) HTS_calloc(interpolation_size, sizeof(HTS_Model));
    /* load */
    for (i = 0; i < stream->interpolation_size; i++) {
-      if (!pdf_fp[i])
-         HTS_error(1,
-                   "HTS_Stream_load_pdf_and_tree: File for duration PDFs is not specified.\n");
-      if (!tree_fp[i])
-         HTS_error(1,
-                   "HTS_Stream_load_pdf_and_tree: File for duration trees is not specified.\n");
+      if (!pdf_fp[i]) {
+         HTS_error(1, "HTS_Stream_load_pdf_and_tree: File for duration PDFs is not specified.\n");
+         HTS_Stream_clear(stream);
+         return FALSE;
+      }
+      if (!tree_fp[i]) {
+         HTS_error(1, "HTS_Stream_load_pdf_and_tree: File for duration trees is not specified.\n");
+         HTS_Stream_clear(stream);
+         return FALSE;
+      }
       HTS_Model_initialize(&stream->model[i]);
-      HTS_Model_load_tree(&stream->model[i], tree_fp[i]);
-      HTS_Model_load_pdf(&stream->model[i], pdf_fp[i], stream->model[i].ntree,
-                         stream->msd_flag);
+      result = HTS_Model_load_tree(&stream->model[i], tree_fp[i]);
+      if (result == FALSE) {
+         HTS_Stream_clear(stream);
+         return FALSE;
+      }
+      result = HTS_Model_load_pdf(&stream->model[i], pdf_fp[i], stream->model[i].ntree, stream->msd_flag);
+      if (result == FALSE) {
+         HTS_Stream_clear(stream);
+         return FALSE;
+      }
    }
    /* check */
    for (i = 1; i < stream->interpolation_size; i++)
-      if (stream->model[0].vector_length != stream->model[i].vector_length)
-         HTS_error(1,
-                   "HTS_Stream_load_pdf_and_tree: Vector sizes of state output vectors are different in between given modelsets.\n");
+      if (stream->model[0].vector_length != stream->model[i].vector_length) {
+         HTS_error(1, "HTS_Stream_load_pdf_and_tree: Vector sizes of state output vectors are different in between given modelsets.\n");
+         HTS_Stream_clear(stream);
+         return FALSE;
+      }
    /* set */
    stream->vector_length = stream->model[0].vector_length;
+
+   return TRUE;
 }
 
 /* HTS_Stream_load_dynamic_window: load windows */
-static void HTS_Stream_load_dynamic_window(HTS_Stream * stream, FILE ** fp,
-                                           int size)
+static HTS_Boolean HTS_Stream_load_dynamic_window(HTS_Stream * stream, HTS_File ** fp, int size)
 {
-   HTS_Window_load(&stream->window, fp, size);
+   return HTS_Window_load(&stream->window, fp, size);
 }
 
 /* HTS_Stream_clear: free stream */
@@ -719,40 +850,64 @@
 }
 
 /* HTS_ModelSet_load_duration: load duration model and number of state */
-void HTS_ModelSet_load_duration(HTS_ModelSet * ms, FILE ** pdf_fp,
-                                FILE ** tree_fp, int interpolation_size)
+HTS_Boolean HTS_ModelSet_load_duration(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, int interpolation_size)
 {
    /* check */
-   if (pdf_fp == NULL)
-      HTS_error(1,
-                "HTS_ModelSet_load_duration: File for duration PDFs is not specified.\n");
-   if (tree_fp == NULL)
-      HTS_error(1,
-                "HTS_ModelSet_load_duration: File for duration trees is not specified.\n");
+   if (ms == NULL) {
+      return FALSE;
+   }
+   if (interpolation_size <= 0) {
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
+   if (pdf_fp == NULL) {
+      HTS_error(1, "HTS_ModelSet_load_duration: File for duration PDFs is not specified.\n");
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
+   if (tree_fp == NULL) {
+      HTS_error(1, "HTS_ModelSet_load_duration: File for duration trees is not specified.\n");
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
 
-   HTS_Stream_load_pdf_and_tree(&ms->duration, pdf_fp, tree_fp, FALSE,
-                                interpolation_size);
+   if (HTS_Stream_load_pdf_and_tree(&ms->duration, pdf_fp, tree_fp, FALSE, interpolation_size) == FALSE) {
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
    ms->nstate = ms->duration.vector_length;
+
+   return TRUE;
 }
 
 /* HTS_ModelSet_load_parameter: load model */
-void HTS_ModelSet_load_parameter(HTS_ModelSet * ms, FILE ** pdf_fp,
-                                 FILE ** tree_fp, FILE ** win_fp,
-                                 int stream_index, HTS_Boolean msd_flag,
-                                 int window_size, int interpolation_size)
+HTS_Boolean HTS_ModelSet_load_parameter(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, HTS_File ** win_fp, int stream_index, HTS_Boolean msd_flag, int window_size, int interpolation_size)
 {
    int i;
 
    /* check */
-   if (pdf_fp == NULL)
-      HTS_error(1,
-                "HTS_ModelSet_load_parameter: File for pdfs is not specified.\n");
-   if (tree_fp == NULL)
-      HTS_error(1,
-                "HTS_ModelSet_load_parameter: File for wins is not specified.\n");
-   if (win_fp == NULL)
-      HTS_error(1,
-                "HTS_ModelSet_load_parameter: File for wins is not specified.\n");
+   if (ms == NULL) {
+      return FALSE;
+   }
+   if (stream_index < 0 || stream_index >= ms->nstream || window_size <= 0 || interpolation_size <= 0) {
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
+   if (pdf_fp == NULL) {
+      HTS_error(1, "HTS_ModelSet_load_parameter: File for pdfs is not specified.\n");
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
+   if (tree_fp == NULL) {
+      HTS_error(1, "HTS_ModelSet_load_parameter: File for wins is not specified.\n");
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
+   if (win_fp == NULL) {
+      HTS_error(1, "HTS_ModelSet_load_parameter: File for wins is not specified.\n");
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
    /* initialize */
    if (!ms->stream) {
       ms->stream = (HTS_Stream *) HTS_calloc(ms->nstream, sizeof(HTS_Stream));
@@ -760,34 +915,55 @@
          HTS_Stream_initialize(&ms->stream[i]);
    }
    /* load */
-   HTS_Stream_load_pdf_and_tree(&ms->stream[stream_index], pdf_fp, tree_fp,
-                                msd_flag, interpolation_size);
-   HTS_Stream_load_dynamic_window(&ms->stream[stream_index], win_fp,
-                                  window_size);
+   if (HTS_Stream_load_pdf_and_tree(&ms->stream[stream_index], pdf_fp, tree_fp, msd_flag, interpolation_size) == FALSE) {
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
+   if (HTS_Stream_load_dynamic_window(&ms->stream[stream_index], win_fp, window_size) == FALSE) {
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
+
+   return TRUE;
 }
 
 /* HTS_ModelSet_load_gv: load GV model */
-void HTS_ModelSet_load_gv(HTS_ModelSet * ms, FILE ** pdf_fp, FILE ** tree_fp,
-                          int stream_index, int interpolation_size)
+HTS_Boolean HTS_ModelSet_load_gv(HTS_ModelSet * ms, HTS_File ** pdf_fp, HTS_File ** tree_fp, int stream_index, int interpolation_size)
 {
    int i;
 
    /* check */
-   if (pdf_fp == NULL)
-      HTS_error(1,
-                "HTS_ModelSet_load_gv: File for GV pdfs is not specified.\n");
+   if (ms == NULL) {
+      return FALSE;
+   }
+   if (stream_index < 0 || stream_index >= ms->nstream || interpolation_size <= 0) {
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
+   if (pdf_fp == NULL) {
+      HTS_error(1, "HTS_ModelSet_load_gv: File for GV pdfs is not specified.\n");
+      HTS_ModelSet_clear(ms);
+      return FALSE;
+   }
    /* initialize */
    if (!ms->gv) {
       ms->gv = (HTS_Stream *) HTS_calloc(ms->nstream, sizeof(HTS_Stream));
       for (i = 0; i < ms->nstream; i++)
          HTS_Stream_initialize(&ms->gv[i]);
    }
-   if (tree_fp)
-      HTS_Stream_load_pdf_and_tree(&ms->gv[stream_index], pdf_fp, tree_fp,
-                                   FALSE, interpolation_size);
-   else
-      HTS_Stream_load_pdf(&ms->gv[stream_index], pdf_fp, 1, FALSE,
-                          interpolation_size);
+   if (tree_fp) {
+      if (HTS_Stream_load_pdf_and_tree(&ms->gv[stream_index], pdf_fp, tree_fp, FALSE, interpolation_size) == FALSE) {
+         HTS_ModelSet_clear(ms);
+         return FALSE;
+      }
+   } else {
+      if (HTS_Stream_load_pdf(&ms->gv[stream_index], pdf_fp, 1, FALSE, interpolation_size) == FALSE) {
+         HTS_ModelSet_clear(ms);
+         return FALSE;
+      }
+   }
+
+   return TRUE;
 }
 
 /* HTS_ModelSet_have_gv_tree: if context-dependent GV is used, return true */
@@ -802,10 +978,11 @@
 }
 
 /* HTS_ModelSet_load_gv_switch: load GV switch */
-void HTS_ModelSet_load_gv_switch(HTS_ModelSet * ms, FILE * fp)
+HTS_Boolean HTS_ModelSet_load_gv_switch(HTS_ModelSet * ms, HTS_File * fp)
 {
    if (fp != NULL)
-      HTS_Model_load_tree(&ms->gv_switch, fp);
+      return HTS_Model_load_tree(&ms->gv_switch, fp);
+   return FALSE;
 }
 
 /* HTS_ModelSet_have_gv_switch: if GV switch is used, return true */
@@ -848,26 +1025,21 @@
 }
 
 /* HTS_ModelSet_get_window_left_width: get left width of dynamic window */
-int HTS_ModelSet_get_window_left_width(HTS_ModelSet * ms, int stream_index,
-                                       int window_index)
+int HTS_ModelSet_get_window_left_width(HTS_ModelSet * ms, int stream_index, int window_index)
 {
    return ms->stream[stream_index].window.l_width[window_index];
 }
 
 /* HTS_ModelSet_get_window_right_width: get right width of dynamic window */
-int HTS_ModelSet_get_window_right_width(HTS_ModelSet * ms, int stream_index,
-                                        int window_index)
+int HTS_ModelSet_get_window_right_width(HTS_ModelSet * ms, int stream_index, int window_index)
 {
    return ms->stream[stream_index].window.r_width[window_index];
 }
 
 /* HTS_ModelSet_get_window_coefficient: get coefficient of dynamic window */
-double HTS_ModelSet_get_window_coefficient(HTS_ModelSet * ms, int stream_index,
-                                           int window_index,
-                                           int coefficient_index)
+double HTS_ModelSet_get_window_coefficient(HTS_ModelSet * ms, int stream_index, int window_index, int coefficient_index)
 {
-   return ms->stream[stream_index].window.
-       coefficient[window_index][coefficient_index];
+   return ms->stream[stream_index].window.coefficient[window_index][coefficient_index];
 }
 
 /* HTS_ModelSet_get_window_max_width: get max width of dynamic window */
@@ -883,8 +1055,7 @@
 }
 
 /* HTS_ModelSet_get_parameter_interpolation_size: get interpolation size (parameter model) */
-int HTS_ModelSet_get_parameter_interpolation_size(HTS_ModelSet * ms,
-                                                  int stream_index)
+int HTS_ModelSet_get_parameter_interpolation_size(HTS_ModelSet * ms, int stream_index)
 {
    return ms->stream[stream_index].interpolation_size;
 }
@@ -906,9 +1077,7 @@
 }
 
 /* HTS_ModelSet_get_duration_index: get index of duration tree and PDF */
-void HTS_ModelSet_get_duration_index(HTS_ModelSet * ms, char *string,
-                                     int *tree_index, int *pdf_index,
-                                     int interpolation_index)
+void HTS_ModelSet_get_duration_index(HTS_ModelSet * ms, char *string, int *tree_index, int *pdf_index, int interpolation_index)
 {
    HTS_Tree *tree;
    HTS_Pattern *pattern;
@@ -917,8 +1086,7 @@
    find = FALSE;
    (*tree_index) = 2;
    (*pdf_index) = 1;
-   for (tree = ms->duration.model[interpolation_index].tree; tree;
-        tree = tree->next) {
+   for (tree = ms->duration.model[interpolation_index].tree; tree; tree = tree->next) {
       pattern = tree->head;
       if (!pattern)
          find = TRUE;
@@ -932,15 +1100,15 @@
       (*tree_index)++;
    }
 
-   if (tree == NULL)
-      HTS_error(1, "HTS_ModelSet_get_duration_index: Cannot find model %s.\n",
-                string);
+   if (tree == NULL) {
+      HTS_error(1, "HTS_ModelSet_get_duration_index: Cannot find model %s.\n", string);
+      return;
+   }
    (*pdf_index) = HTS_Tree_search_node(tree, string);
 }
 
 /* HTS_ModelSet_get_duration: get duration using interpolation weight */
-void HTS_ModelSet_get_duration(HTS_ModelSet * ms, char *string, double *mean,
-                               double *vari, double *iw)
+void HTS_ModelSet_get_duration(HTS_ModelSet * ms, char *string, double *mean, double *vari, double *iw)
 {
    int i, j;
    int tree_index, pdf_index;
@@ -954,17 +1122,13 @@
       HTS_ModelSet_get_duration_index(ms, string, &tree_index, &pdf_index, i);
       for (j = 0; j < ms->nstate; j++) {
          mean[j] += iw[i] * ms->duration.model[i].pdf[tree_index][pdf_index][j];
-         vari[j] += iw[i] * iw[i] * ms->duration.model[i]
-             .pdf[tree_index][pdf_index][j + vector_length];
+         vari[j] += iw[i] * iw[i] * ms->duration.model[i].pdf[tree_index][pdf_index][j + vector_length];
       }
    }
 }
 
 /* HTS_ModelSet_get_parameter_index: get index of parameter tree and PDF */
-void HTS_ModelSet_get_parameter_index(HTS_ModelSet * ms, char *string,
-                                      int *tree_index, int *pdf_index,
-                                      int stream_index, int state_index,
-                                      int interpolation_index)
+void HTS_ModelSet_get_parameter_index(HTS_ModelSet * ms, char *string, int *tree_index, int *pdf_index, int stream_index, int state_index, int interpolation_index)
 {
    HTS_Tree *tree;
    HTS_Pattern *pattern;
@@ -973,8 +1137,7 @@
    find = FALSE;
    (*tree_index) = 2;
    (*pdf_index) = 1;
-   for (tree = ms->stream[stream_index].model[interpolation_index].tree; tree;
-        tree = tree->next) {
+   for (tree = ms->stream[stream_index].model[interpolation_index].tree; tree; tree = tree->next) {
       if (tree->state == state_index) {
          pattern = tree->head;
          if (!pattern)
@@ -990,16 +1153,15 @@
       (*tree_index)++;
    }
 
-   if (tree == NULL)
-      HTS_error(1, "HTS_ModelSet_get_parameter_index: Cannot find model %s.\n",
-                string);
+   if (tree == NULL) {
+      HTS_error(1, "HTS_ModelSet_get_parameter_index: Cannot find model %s.\n", string);
+      return;
+   }
    (*pdf_index) = HTS_Tree_search_node(tree, string);
 }
 
 /* HTS_ModelSet_get_parameter: get parameter using interpolation weight */
-void HTS_ModelSet_get_parameter(HTS_ModelSet * ms, char *string, double *mean,
-                                double *vari, double *msd, int stream_index,
-                                int state_index, double *iw)
+void HTS_ModelSet_get_parameter(HTS_ModelSet * ms, char *string, double *mean, double *vari, double *msd, int stream_index, int state_index, double *iw)
 {
    int i, j;
    int tree_index, pdf_index;
@@ -1012,11 +1174,9 @@
    if (msd)
       *msd = 0.0;
    for (i = 0; i < ms->stream[stream_index].interpolation_size; i++) {
-      HTS_ModelSet_get_parameter_index(ms, string, &tree_index, &pdf_index,
-                                       stream_index, state_index, i);
+      HTS_ModelSet_get_parameter_index(ms, string, &tree_index, &pdf_index, stream_index, state_index, i);
       for (j = 0; j < vector_length; j++) {
-         mean[j] += iw[i] *
-             ms->stream[stream_index].model[i].pdf[tree_index][pdf_index][j];
+         mean[j] += iw[i] * ms->stream[stream_index].model[i].pdf[tree_index][pdf_index][j];
          vari[j] += iw[i] * iw[i] * ms->stream[stream_index].model[i]
              .pdf[tree_index][pdf_index][j + vector_length];
       }
@@ -1028,9 +1188,7 @@
 }
 
 /* HTS_ModelSet_get_gv_index: get index of GV tree and PDF */
-void HTS_ModelSet_get_gv_index(HTS_ModelSet * ms, char *string, int *tree_index,
-                               int *pdf_index, int stream_index,
-                               int interpolation_index)
+void HTS_ModelSet_get_gv_index(HTS_ModelSet * ms, char *string, int *tree_index, int *pdf_index, int stream_index, int interpolation_index)
 {
    HTS_Tree *tree;
    HTS_Pattern *pattern;
@@ -1042,8 +1200,7 @@
 
    if (HTS_ModelSet_have_gv_tree(ms, stream_index) == FALSE)
       return;
-   for (tree = ms->gv[stream_index].model[interpolation_index].tree; tree;
-        tree = tree->next) {
+   for (tree = ms->gv[stream_index].model[interpolation_index].tree; tree; tree = tree->next) {
       pattern = tree->head;
       if (!pattern)
          find = TRUE;
@@ -1057,15 +1214,15 @@
       (*tree_index)++;
    }
 
-   if (tree == NULL)
-      HTS_error(1, "HTS_ModelSet_get_gv_index: Cannot find model %s.\n",
-                string);
+   if (tree == NULL) {
+      HTS_error(1, "HTS_ModelSet_get_gv_index: Cannot find model %s.\n", string);
+      return;
+   }
    (*pdf_index) = HTS_Tree_search_node(tree, string);
 }
 
 /* HTS_ModelSet_get_gv: get GV using interpolation weight */
-void HTS_ModelSet_get_gv(HTS_ModelSet * ms, char *string, double *mean,
-                         double *vari, int stream_index, double *iw)
+void HTS_ModelSet_get_gv(HTS_ModelSet * ms, char *string, double *mean, double *vari, int stream_index, double *iw)
 {
    int i, j;
    int tree_index, pdf_index;
@@ -1076,11 +1233,9 @@
       vari[i] = 0.0;
    }
    for (i = 0; i < ms->gv[stream_index].interpolation_size; i++) {
-      HTS_ModelSet_get_gv_index(ms, string, &tree_index, &pdf_index,
-                                stream_index, i);
+      HTS_ModelSet_get_gv_index(ms, string, &tree_index, &pdf_index, stream_index, i);
       for (j = 0; j < vector_length; j++) {
-         mean[j] += iw[i] *
-             ms->gv[stream_index].model[i].pdf[tree_index][pdf_index][j];
+         mean[j] += iw[i] * ms->gv[stream_index].model[i].pdf[tree_index][pdf_index][j];
          vari[j] += iw[i] * iw[i] * ms->gv[stream_index].model[i]
              .pdf[tree_index][pdf_index][j + vector_length];
       }
@@ -1088,8 +1243,7 @@
 }
 
 /* HTS_ModelSet_get_gv_switch_index: get index of GV switch tree and PDF */
-void HTS_ModelSet_get_gv_switch_index(HTS_ModelSet * ms, char *string,
-                                      int *tree_index, int *pdf_index)
+void HTS_ModelSet_get_gv_switch_index(HTS_ModelSet * ms, char *string, int *tree_index, int *pdf_index)
 {
    HTS_Tree *tree;
    HTS_Pattern *pattern;
@@ -1112,9 +1266,10 @@
       (*tree_index)++;
    }
 
-   if (tree == NULL)
-      HTS_error(1, "HTS_ModelSet_get_gv_switch_index: Cannot find model %s.\n",
-                string);
+   if (tree == NULL) {
+      HTS_error(1, "HTS_ModelSet_get_gv_switch_index: Cannot find model %s.\n", string);
+      return;
+   }
    (*pdf_index) = HTS_Tree_search_node(tree, string);
 }
 
diff -Nru htsengine-1.05/lib/HTS_pstream.c htsengine-1.06/lib/HTS_pstream.c
--- htsengine-1.05/lib/HTS_pstream.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_pstream.c	2011-12-20 11:11:30.000000000 +0900
@@ -92,10 +92,8 @@
          for (j = pst->win_l_width[i]; j <= pst->win_r_width[i]; j++)
             if ((t + j >= 0) && (t + j < pst->length)
                 && (pst->win_coefficient[i][-j] != 0.0)) {
-               wu = pst->win_coefficient[i][-j] *
-                   pst->sm.ivar[t + j][i * pst->static_length + m];
-               pst->sm.wum[t] +=
-                   wu * pst->sm.mean[t + j][i * pst->static_length + m];
+               wu = pst->win_coefficient[i][-j] * pst->sm.ivar[t + j][i * pst->static_length + m];
+               pst->sm.wum[t] += wu * pst->sm.mean[t + j][i * pst->static_length + m];
                for (k = 0; (k < pst->width) && (t + k < pst->length); k++)
                   if ((k - j <= pst->win_r_width[i])
                       && (pst->win_coefficient[i][k - j] != 0.0))
@@ -112,13 +110,11 @@
 
    for (t = 0; t < pst->length; t++) {
       for (i = 1; (i < pst->width) && (t >= i); i++)
-         pst->sm.wuw[t][0] -= pst->sm.wuw[t - i][i] *
-             pst->sm.wuw[t - i][i] * pst->sm.wuw[t - i][0];
+         pst->sm.wuw[t][0] -= pst->sm.wuw[t - i][i] * pst->sm.wuw[t - i][i] * pst->sm.wuw[t - i][0];
 
       for (i = 1; i < pst->width; i++) {
          for (j = 1; (i + j < pst->width) && (t >= j); j++)
-            pst->sm.wuw[t][i] -= pst->sm.wuw[t - j][j] *
-                pst->sm.wuw[t - j][i + j] * pst->sm.wuw[t - j][0];
+            pst->sm.wuw[t][i] -= pst->sm.wuw[t - j][j] * pst->sm.wuw[t - j][i + j] * pst->sm.wuw[t - j][0];
          pst->sm.wuw[t][i] /= pst->sm.wuw[t][0];
       }
    }
@@ -149,8 +145,7 @@
 }
 
 /* HTS_PStream_calc_gv: subfunction for mlpg using GV */
-static void HTS_PStream_calc_gv(HTS_PStream * pst, const int m, double *mean,
-                                double *vari)
+static void HTS_PStream_calc_gv(HTS_PStream * pst, const int m, double *mean, double *vari)
 {
    int t;
 
@@ -209,15 +204,9 @@
 
    for (t = 0, hmmobj = 0.0; t < pst->length; t++) {
       hmmobj += W1 * w * pst->par[t][m] * (pst->sm.wum[t] - 0.5 * pst->sm.g[t]);
-      h = -W1 * w * pst->sm.wuw[t][1 - 1]
-          - W2 * 2.0 / (pst->length * pst->length) *
-          ((pst->length - 1) * pst->gv_vari[m] * (vari - pst->gv_mean[m])
-           + 2.0 * pst->gv_vari[m] * (pst->par[t][m] - mean) * (pst->par[t][m] -
-                                                                mean));
+      h = -W1 * w * pst->sm.wuw[t][1 - 1] - W2 * 2.0 / (pst->length * pst->length) * ((pst->length - 1) * pst->gv_vari[m] * (vari - pst->gv_mean[m]) + 2.0 * pst->gv_vari[m] * (pst->par[t][m] - mean) * (pst->par[t][m] - mean));
       if (pst->gv_switch[t])
-         pst->sm.g[t] =
-             1.0 / h * (W1 * w * (-pst->sm.g[t] + pst->sm.wum[t]) +
-                        W2 * dv * (pst->par[t][m] - mean));
+         pst->sm.g[t] = 1.0 / h * (W1 * w * (-pst->sm.g[t] + pst->sm.wum[t]) + W2 * dv * (pst->par[t][m] - mean));
       else
          pst->sm.g[t] = 1.0 / h * (W1 * w * (-pst->sm.g[t] + pst->sm.wum[t]));
    }
@@ -279,8 +268,7 @@
 }
 
 /* HTS_PStreamSet_create: parameter generation using GV weight */
-void HTS_PStreamSet_create(HTS_PStreamSet * pss, HTS_SStreamSet * sss,
-                           double *msd_threshold, double *gv_weight)
+HTS_Boolean HTS_PStreamSet_create(HTS_PStreamSet * pss, HTS_SStreamSet * sss, double *msd_threshold, double *gv_weight)
 {
    int i, j, k, l, m;
    int frame, msd_frame, state;
@@ -288,8 +276,10 @@
    HTS_PStream *pst;
    HTS_Boolean not_bound;
 
-   if (pss->nstream)
+   if (pss->nstream) {
       HTS_error(1, "HTS_PstreamSet_create: HTS_PStreamSet should be clear.\n");
+      return FALSE;
+   }
 
    /* initialize */
    pss->nstream = HTS_SStreamSet_get_nstream(sss);
@@ -304,10 +294,8 @@
          for (state = 0; state < HTS_SStreamSet_get_total_state(sss); state++)
             if (HTS_SStreamSet_get_msd(sss, i, state) > msd_threshold[i])
                pst->length += HTS_SStreamSet_get_duration(sss, state);
-         pst->msd_flag =
-             (HTS_Boolean *) HTS_calloc(pss->total_frame, sizeof(HTS_Boolean));
-         for (state = 0, frame = 0; state < HTS_SStreamSet_get_total_state(sss);
-              state++)
+         pst->msd_flag = (HTS_Boolean *) HTS_calloc(pss->total_frame, sizeof(HTS_Boolean));
+         for (state = 0, frame = 0; state < HTS_SStreamSet_get_total_state(sss); state++)
             if (HTS_SStreamSet_get_msd(sss, i, state) > msd_threshold[i])
                for (j = 0; j < HTS_SStreamSet_get_duration(sss, state); j++) {
                   pst->msd_flag[frame] = TRUE;
@@ -334,8 +322,7 @@
       /* copy dynamic window */
       pst->win_l_width = (int *) HTS_calloc(pst->win_size, sizeof(int));
       pst->win_r_width = (int *) HTS_calloc(pst->win_size, sizeof(int));
-      pst->win_coefficient =
-          (double **) HTS_calloc(pst->win_size, sizeof(double));
+      pst->win_coefficient = (double **) HTS_calloc(pst->win_size, sizeof(double));
       for (j = 0; j < pst->win_size; j++) {
          pst->win_l_width[j] = HTS_SStreamSet_get_window_left_width(sss, i, j);
          pst->win_r_width[j] = HTS_SStreamSet_get_window_right_width(sss, i, j);
@@ -347,36 +334,26 @@
                 HTS_calloc(-2 * pst->win_l_width[j], sizeof(double));
          pst->win_coefficient[j] -= pst->win_l_width[j];
          for (k = pst->win_l_width[j]; k <= pst->win_r_width[j]; k++)
-            pst->win_coefficient[j][k] =
-                HTS_SStreamSet_get_window_coefficient(sss, i, j, k);
+            pst->win_coefficient[j][k] = HTS_SStreamSet_get_window_coefficient(sss, i, j, k);
       }
       /* copy GV */
       if (HTS_SStreamSet_use_gv(sss, i)) {
-         pst->gv_mean =
-             (double *) HTS_calloc(pst->static_length, sizeof(double));
-         pst->gv_vari =
-             (double *) HTS_calloc(pst->static_length, sizeof(double));
+         pst->gv_mean = (double *) HTS_calloc(pst->static_length, sizeof(double));
+         pst->gv_vari = (double *) HTS_calloc(pst->static_length, sizeof(double));
          for (j = 0; j < pst->static_length; j++) {
-            pst->gv_mean[j] =
-                HTS_SStreamSet_get_gv_mean(sss, i, j) * gv_weight[i];
+            pst->gv_mean[j] = HTS_SStreamSet_get_gv_mean(sss, i, j) * gv_weight[i];
             pst->gv_vari[j] = HTS_SStreamSet_get_gv_vari(sss, i, j);
          }
-         pst->gv_switch =
-             (HTS_Boolean *) HTS_calloc(pst->length, sizeof(HTS_Boolean));
+         pst->gv_switch = (HTS_Boolean *) HTS_calloc(pst->length, sizeof(HTS_Boolean));
          if (HTS_SStreamSet_is_msd(sss, i)) {   /* for MSD */
-            for (state = 0, frame = 0, msd_frame = 0;
-                 state < HTS_SStreamSet_get_total_state(sss); state++)
-               for (j = 0; j < HTS_SStreamSet_get_duration(sss, state);
-                    j++, frame++)
+            for (state = 0, frame = 0, msd_frame = 0; state < HTS_SStreamSet_get_total_state(sss); state++)
+               for (j = 0; j < HTS_SStreamSet_get_duration(sss, state); j++, frame++)
                   if (pst->msd_flag[frame])
-                     pst->gv_switch[msd_frame++] =
-                         HTS_SStreamSet_get_gv_switch(sss, i, state);
+                     pst->gv_switch[msd_frame++] = HTS_SStreamSet_get_gv_switch(sss, i, state);
          } else {               /* for non MSD */
-            for (state = 0, frame = 0;
-                 state < HTS_SStreamSet_get_total_state(sss); state++)
+            for (state = 0, frame = 0; state < HTS_SStreamSet_get_total_state(sss); state++)
                for (j = 0; j < HTS_SStreamSet_get_duration(sss, state); j++)
-                  pst->gv_switch[frame++] =
-                      HTS_SStreamSet_get_gv_switch(sss, i, state);
+                  pst->gv_switch[frame++] = HTS_SStreamSet_get_gv_switch(sss, i, state);
          }
          for (j = 0, pst->gv_length = 0; j < pst->length; j++)
             if (pst->gv_switch[j])
@@ -389,28 +366,22 @@
       }
       /* copy pdfs */
       if (HTS_SStreamSet_is_msd(sss, i)) {      /* for MSD */
-         for (state = 0, frame = 0, msd_frame = 0;
-              state < HTS_SStreamSet_get_total_state(sss); state++)
+         for (state = 0, frame = 0, msd_frame = 0; state < HTS_SStreamSet_get_total_state(sss); state++)
             for (j = 0; j < HTS_SStreamSet_get_duration(sss, state); j++) {
                if (pst->msd_flag[frame]) {
                   /* check current frame is MSD boundary or not */
                   for (k = 0; k < pst->win_size; k++) {
                      not_bound = TRUE;
-                     for (l = pst->win_l_width[k]; l <= pst->win_r_width[k];
-                          l++)
-                        if (frame + l < 0 || pss->total_frame <= frame + l
-                            || !pst->msd_flag[frame + l]) {
+                     for (l = pst->win_l_width[k]; l <= pst->win_r_width[k]; l++)
+                        if (frame + l < 0 || pss->total_frame <= frame + l || !pst->msd_flag[frame + l]) {
                            not_bound = FALSE;
                            break;
                         }
                      for (l = 0; l < pst->static_length; l++) {
                         m = pst->static_length * k + l;
-                        pst->sm.mean[msd_frame][m] =
-                            HTS_SStreamSet_get_mean(sss, i, state, m);
+                        pst->sm.mean[msd_frame][m] = HTS_SStreamSet_get_mean(sss, i, state, m);
                         if (not_bound || k == 0)
-                           pst->sm.ivar[msd_frame][m] =
-                               HTS_finv(HTS_SStreamSet_get_vari
-                                        (sss, i, state, m));
+                           pst->sm.ivar[msd_frame][m] = HTS_finv(HTS_SStreamSet_get_vari(sss, i, state, m));
                         else
                            pst->sm.ivar[msd_frame][m] = 0.0;
                      }
@@ -420,8 +391,7 @@
                frame++;
             }
       } else {                  /* for non MSD */
-         for (state = 0, frame = 0;
-              state < HTS_SStreamSet_get_total_state(sss); state++) {
+         for (state = 0, frame = 0; state < HTS_SStreamSet_get_total_state(sss); state++) {
             for (j = 0; j < HTS_SStreamSet_get_duration(sss, state); j++) {
                for (k = 0; k < pst->win_size; k++) {
                   not_bound = TRUE;
@@ -432,11 +402,9 @@
                      }
                   for (l = 0; l < pst->static_length; l++) {
                      m = pst->static_length * k + l;
-                     pst->sm.mean[frame][m] =
-                         HTS_SStreamSet_get_mean(sss, i, state, m);
+                     pst->sm.mean[frame][m] = HTS_SStreamSet_get_mean(sss, i, state, m);
                      if (not_bound || k == 0)
-                        pst->sm.ivar[frame][m] =
-                            HTS_finv(HTS_SStreamSet_get_vari(sss, i, state, m));
+                        pst->sm.ivar[frame][m] = HTS_finv(HTS_SStreamSet_get_vari(sss, i, state, m));
                      else
                         pst->sm.ivar[frame][m] = 0.0;
                   }
@@ -448,6 +416,8 @@
       /* parameter generation */
       HTS_PStream_mlpg(pst);
    }
+
+   return TRUE;
 }
 
 /* HTS_PStreamSet_get_nstream: get number of stream */
@@ -469,23 +439,19 @@
 }
 
 /* HTS_PStreamSet_get_parameter: get parameter */
-double HTS_PStreamSet_get_parameter(HTS_PStreamSet * pss,
-                                    int stream_index, int frame_index,
-                                    int vector_index)
+double HTS_PStreamSet_get_parameter(HTS_PStreamSet * pss, int stream_index, int frame_index, int vector_index)
 {
    return pss->pstream[stream_index].par[frame_index][vector_index];
 }
 
 /* HTS_PStreamSet_get_parameter_vector: get parameter vector*/
-double *HTS_PStreamSet_get_parameter_vector(HTS_PStreamSet * pss,
-                                            int stream_index, int frame_index)
+double *HTS_PStreamSet_get_parameter_vector(HTS_PStreamSet * pss, int stream_index, int frame_index)
 {
    return pss->pstream[stream_index].par[frame_index];
 }
 
 /* HTS_PStreamSet_get_msd_flag: get generated MSD flag per frame */
-HTS_Boolean HTS_PStreamSet_get_msd_flag(HTS_PStreamSet * pss,
-                                        int stream_index, int frame_index)
+HTS_Boolean HTS_PStreamSet_get_msd_flag(HTS_PStreamSet * pss, int stream_index, int frame_index)
 {
    return pss->pstream[stream_index].msd_flag[frame_index];
 }
diff -Nru htsengine-1.05/lib/HTS_sstream.c htsengine-1.06/lib/HTS_sstream.c
--- htsengine-1.05/lib/HTS_sstream.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_sstream.c	2011-12-20 11:11:30.000000000 +0900
@@ -55,32 +55,91 @@
 
 HTS_SSTREAM_C_START;
 
+#include <stdlib.h>
+
 /* hts_engine libraries */
 #include "HTS_hidden.h"
 
-static void HTS_set_duration(int *duration, double *mean, double *vari,
-                             double *remain, int size, double frame_length)
+/* HTS_set_duration: set duration from state duration probability distribution */
+static double HTS_set_duration(int *duration, double *mean, double *vari, int size, double frame_length)
 {
-   int i;
+   int i, j;
    double temp1, temp2;
    double rho = 0.0;
+   int sum = 0;
+   int target_length;
 
-   if (frame_length != 0.0) {   /* if frame length is specified, rho is determined */
-      temp1 = 0.0;
-      temp2 = 0.0;
+   /* if the frame length is not specified, only the mean vector is used */
+   if (frame_length == 0.0) {
       for (i = 0; i < size; i++) {
-         temp1 += mean[i];
-         temp2 += vari[i];
+         duration[i] = (int) (mean[i] + 0.5);
+         if (duration[i] < 1)
+            duration[i] = 1;
+         sum += duration[i];
       }
-      rho = (frame_length - temp1) / temp2;
+      return (double) sum;
+   }
+
+   /* get the target frame length */
+   target_length = (int) (frame_length + 0.5);
+
+   /* check the specified duration */
+   if (target_length <= size) {
+      if (target_length < size)
+         HTS_error(-1, "HTS_set_duration: Specified frame length is too short.\n");
+      for (i = 0; i < size; i++)
+         duration[i] = 1;
+      return (double) size;
+   }
+
+   /* RHO calculation */
+   temp1 = 0.0;
+   temp2 = 0.0;
+   for (i = 0; i < size; i++) {
+      temp1 += mean[i];
+      temp2 += vari[i];
    }
+   rho = ((double) target_length - temp1) / temp2;
+
+   /* first estimation */
    for (i = 0; i < size; i++) {
-      temp1 = mean[i] + rho * vari[i] + *remain;
-      duration[i] = (int) (temp1 + 0.5);
+      duration[i] = (int) (mean[i] + rho * vari[i] + 0.5);
       if (duration[i] < 1)
          duration[i] = 1;
-      *remain = temp1 - (double) duration[i];
+      sum += duration[i];
+   }
+
+   /* loop estimation */
+   while (target_length != sum) {
+      /* sarch flexible state and modify its duration */
+      if (target_length > sum) {
+         j = -1;
+         for (i = 1; i < size; i++) {
+            temp2 = abs(rho - ((double) duration[i] + 1 - mean[i]) / vari[i]);
+            if (j < 0 || temp1 < temp2) {
+               j = i;
+               temp1 = temp2;
+            }
+         }
+         sum++;
+         duration[j]++;
+      } else {
+         j = -1;
+         for (i = 1; i < size; i++) {
+            if (duration[i] > 1) {
+               temp2 = abs(rho - ((double) duration[i] - 1 - mean[i]) / vari[i]);
+               if (j < 0 || temp1 < temp2) {
+                  j = i;
+                  temp1 = temp2;
+               }
+            }
+         }
+         sum--;
+         duration[j]--;
+      }
    }
+
+   return (double) target_length;
 }
 
 /* HTS_SStreamSet_initialize: initialize state stream set */
@@ -95,20 +154,34 @@
 }
 
 /* HTS_SStreamSet_create: parse label and determine state duration */
-void HTS_SStreamSet_create(HTS_SStreamSet * sss, HTS_ModelSet * ms,
-                           HTS_Label * label, double *duration_iw,
-                           double **parameter_iw, double **gv_iw)
+HTS_Boolean HTS_SStreamSet_create(HTS_SStreamSet * sss, HTS_ModelSet * ms, HTS_Label * label, double *duration_iw, double **parameter_iw, double **gv_iw)
 {
    int i, j, k;
-   double temp1, temp2;
+   double temp;
    int state;
    HTS_SStream *sst;
    double *duration_mean, *duration_vari;
-   double duration_remain;
    double frame_length;
    int next_time;
    int next_state;
 
+   /* check interpolation weights */
+   for (i = 0, temp = 0.0; i < HTS_ModelSet_get_duration_interpolation_size(ms); i++)
+      temp += duration_iw[i];
+   if (temp == 0.0)
+      return FALSE;
+   for (i = 0; i < sss->nstream; i++) {
+      for (j = 0, temp = 0.0; j < HTS_ModelSet_get_parameter_interpolation_size(ms, i); j++)
+         temp += parameter_iw[i][j];
+      if (temp == 0.0)
+         return FALSE;
+      if (HTS_ModelSet_use_gv(ms, i)) {
+         for (j = 0, temp = 0.0; j < HTS_ModelSet_get_gv_interpolation_size(ms, i); j++)
+            temp += gv_iw[i][j];
+         return FALSE;
+      }
+   }
+
    /* initialize state sequence */
    sss->nstate = HTS_ModelSet_get_nstate(ms);
    sss->nstream = HTS_ModelSet_get_nstream(ms);
@@ -126,93 +199,69 @@
       else
          sst->msd = NULL;
       for (j = 0; j < sss->total_state; j++) {
-         sst->mean[j] =
-             (double *) HTS_calloc(sst->vector_length, sizeof(double));
-         sst->vari[j] =
-             (double *) HTS_calloc(sst->vector_length, sizeof(double));
+         sst->mean[j] = (double *) HTS_calloc(sst->vector_length, sizeof(double));
+         sst->vari[j] = (double *) HTS_calloc(sst->vector_length, sizeof(double));
       }
-      sst->gv_switch =
-          (HTS_Boolean *) HTS_calloc(sss->total_state, sizeof(HTS_Boolean));
+      sst->gv_switch = (HTS_Boolean *) HTS_calloc(sss->total_state, sizeof(HTS_Boolean));
       for (j = 0; j < sss->total_state; j++)
          sst->gv_switch[j] = TRUE;
    }
 
    /* check interpolation weights */
-   for (i = 0, temp1 = 0.0;
-        i < HTS_ModelSet_get_duration_interpolation_size(ms); i++)
-      temp1 += duration_iw[i];
+   for (i = 0, temp = 0.0; i < HTS_ModelSet_get_duration_interpolation_size(ms); i++)
+      temp += duration_iw[i];
    for (i = 0; i < HTS_ModelSet_get_duration_interpolation_size(ms); i++)
       if (duration_iw[i] != 0.0)
-         duration_iw[i] /= temp1;
+         duration_iw[i] /= temp;
    for (i = 0; i < sss->nstream; i++) {
-      for (j = 0, temp1 = 0.0;
-           j < HTS_ModelSet_get_parameter_interpolation_size(ms, i); j++)
-         temp1 += parameter_iw[i][j];
+      for (j = 0, temp = 0.0; j < HTS_ModelSet_get_parameter_interpolation_size(ms, i); j++)
+         temp += parameter_iw[i][j];
       for (j = 0; j < HTS_ModelSet_get_parameter_interpolation_size(ms, i); j++)
          if (parameter_iw[i][j] != 0.0)
-            parameter_iw[i][j] /= temp1;
+            parameter_iw[i][j] /= temp;
       if (HTS_ModelSet_use_gv(ms, i)) {
-         for (j = 0, temp1 = 0.0;
-              j < HTS_ModelSet_get_gv_interpolation_size(ms, i); j++)
-            temp1 += gv_iw[i][j];
+         for (j = 0, temp = 0.0; j < HTS_ModelSet_get_gv_interpolation_size(ms, i); j++)
+            temp += gv_iw[i][j];
          for (j = 0; j < HTS_ModelSet_get_gv_interpolation_size(ms, i); j++)
             if (gv_iw[i][j] != 0.0)
-               gv_iw[i][j] /= temp1;
+               gv_iw[i][j] /= temp;
       }
    }
 
    /* determine state duration */
-   duration_mean =
-       (double *) HTS_calloc(sss->nstate * HTS_Label_get_size(label),
-                             sizeof(double));
-   duration_vari =
-       (double *) HTS_calloc(sss->nstate * HTS_Label_get_size(label),
-                             sizeof(double));
-   duration_remain = 0.0;
+   duration_mean = (double *) HTS_calloc(sss->nstate * HTS_Label_get_size(label), sizeof(double));
+   duration_vari = (double *) HTS_calloc(sss->nstate * HTS_Label_get_size(label), sizeof(double));
    for (i = 0; i < HTS_Label_get_size(label); i++)
-      HTS_ModelSet_get_duration(ms, HTS_Label_get_string(label, i),
-                                &duration_mean[i * sss->nstate],
-                                &duration_vari[i * sss->nstate], duration_iw);
+      HTS_ModelSet_get_duration(ms, HTS_Label_get_string(label, i), &duration_mean[i * sss->nstate], &duration_vari[i * sss->nstate], duration_iw);
    if (HTS_Label_get_frame_specified_flag(label)) {
       /* use duration set by user */
       next_time = 0;
       next_state = 0;
       state = 0;
       for (i = 0; i < HTS_Label_get_size(label); i++) {
-         temp1 = HTS_Label_get_start_frame(label, i);
-         temp2 = HTS_Label_get_end_frame(label, i);
-         if (temp2 >= 0) {
-            HTS_set_duration(&sss->duration[next_state],
-                             &duration_mean[next_state],
-                             &duration_vari[next_state], &duration_remain,
-                             state + sss->nstate - next_state,
-                             temp2 - next_time);
-            for (j = next_state; j < state + sss->nstate; j++)
-               next_time += sss->duration[j];
+         temp = HTS_Label_get_end_frame(label, i);
+         if (temp >= 0) {
+            next_time += HTS_set_duration(&sss->duration[next_state], &duration_mean[next_state], &duration_vari[next_state], state + sss->nstate - next_state, temp - next_time);
             next_state = state + sss->nstate;
          } else if (i + 1 == HTS_Label_get_size(label)) {
-            HTS_set_duration(&sss->duration[next_state],
-                             &duration_mean[next_state],
-                             &duration_vari[next_state], &duration_remain,
-                             state + sss->nstate - next_state, 0.0);
+            HTS_error(-1, "HTS_SStreamSet_create: The time of final label is not specified.\n");
+            HTS_set_duration(&sss->duration[next_state], &duration_mean[next_state], &duration_vari[next_state], state + sss->nstate - next_state, 0.0);
          }
          state += sss->nstate;
       }
    } else {
       /* determine frame length */
       if (HTS_Label_get_speech_speed(label) != 1.0) {
-         temp1 = 0.0;
+         temp = 0.0;
          for (i = 0; i < HTS_Label_get_size(label) * sss->nstate; i++) {
-            temp1 += duration_mean[i];
+            temp += duration_mean[i];
          }
-         frame_length = temp1 / HTS_Label_get_speech_speed(label);
+         frame_length = temp / HTS_Label_get_speech_speed(label);
       } else {
          frame_length = 0.0;
       }
       /* set state duration */
-      HTS_set_duration(sss->duration, duration_mean, duration_vari,
-                       &duration_remain,
-                       HTS_Label_get_size(label) * sss->nstate, frame_length);
+      HTS_set_duration(sss->duration, duration_mean, duration_vari, HTS_Label_get_size(label) * sss->nstate, frame_length);
    }
    HTS_free(duration_mean);
    HTS_free(duration_vari);
@@ -224,14 +273,9 @@
          for (k = 0; k < sss->nstream; k++) {
             sst = &sss->sstream[k];
             if (sst->msd)
-               HTS_ModelSet_get_parameter(ms, HTS_Label_get_string(label, i),
-                                          sst->mean[state], sst->vari[state],
-                                          &sst->msd[state], k, j,
-                                          parameter_iw[k]);
+               HTS_ModelSet_get_parameter(ms, HTS_Label_get_string(label, i), sst->mean[state], sst->vari[state], &sst->msd[state], k, j, parameter_iw[k]);
             else
-               HTS_ModelSet_get_parameter(ms, HTS_Label_get_string(label, i),
-                                          sst->mean[state], sst->vari[state],
-                                          NULL, k, j, parameter_iw[k]);
+               HTS_ModelSet_get_parameter(ms, HTS_Label_get_string(label, i), sst->mean[state], sst->vari[state], NULL, k, j, parameter_iw[k]);
          }
          state++;
       }
@@ -244,22 +288,17 @@
       sst->win_max_width = HTS_ModelSet_get_window_max_width(ms, i);
       sst->win_l_width = (int *) HTS_calloc(sst->win_size, sizeof(int));
       sst->win_r_width = (int *) HTS_calloc(sst->win_size, sizeof(int));
-      sst->win_coefficient =
-          (double **) HTS_calloc(sst->win_size, sizeof(double));
+      sst->win_coefficient = (double **) HTS_calloc(sst->win_size, sizeof(double));
       for (j = 0; j < sst->win_size; j++) {
          sst->win_l_width[j] = HTS_ModelSet_get_window_left_width(ms, i, j);
          sst->win_r_width[j] = HTS_ModelSet_get_window_right_width(ms, i, j);
          if (sst->win_l_width[j] + sst->win_r_width[j] == 0)
-            sst->win_coefficient[j] =
-                (double *) HTS_calloc(-2 * sst->win_l_width[j] + 1,
-                                      sizeof(double));
+            sst->win_coefficient[j] = (double *) HTS_calloc(-2 * sst->win_l_width[j] + 1, sizeof(double));
          else
-            sst->win_coefficient[j] =
-                (double *) HTS_calloc(-2 * sst->win_l_width[j], sizeof(double));
+            sst->win_coefficient[j] = (double *) HTS_calloc(-2 * sst->win_l_width[j], sizeof(double));
          sst->win_coefficient[j] -= sst->win_l_width[j];
          for (k = sst->win_l_width[j]; k <= sst->win_r_width[j]; k++)
-            sst->win_coefficient[j][k] =
-                HTS_ModelSet_get_window_coefficient(ms, i, j, k);
+            sst->win_coefficient[j][k] = HTS_ModelSet_get_window_coefficient(ms, i, j, k);
       }
    }
 
@@ -267,14 +306,9 @@
    for (i = 0; i < sss->nstream; i++) {
       sst = &sss->sstream[i];
       if (HTS_ModelSet_use_gv(ms, i)) {
-         sst->gv_mean =
-             (double *) HTS_calloc(sst->vector_length / sst->win_size,
-                                   sizeof(double));
-         sst->gv_vari =
-             (double *) HTS_calloc(sst->vector_length / sst->win_size,
-                                   sizeof(double));
-         HTS_ModelSet_get_gv(ms, HTS_Label_get_string(label, 0), sst->gv_mean,
-                             sst->gv_vari, i, gv_iw[i]);
+         sst->gv_mean = (double *) HTS_calloc(sst->vector_length / sst->win_size, sizeof(double));
+         sst->gv_vari = (double *) HTS_calloc(sst->vector_length / sst->win_size, sizeof(double));
+         HTS_ModelSet_get_gv(ms, HTS_Label_get_string(label, 0), sst->gv_mean, sst->gv_vari, i, gv_iw[i]);
       } else {
          sst->gv_mean = NULL;
          sst->gv_vari = NULL;
@@ -283,11 +317,12 @@
 
    if (HTS_ModelSet_have_gv_switch(ms) == TRUE)
       for (i = 0; i < HTS_Label_get_size(label); i++)
-         if (HTS_ModelSet_get_gv_switch(ms, HTS_Label_get_string(label, i)) ==
-             FALSE)
+         if (HTS_ModelSet_get_gv_switch(ms, HTS_Label_get_string(label, i)) == FALSE)
             for (j = 0; j < sss->nstream; j++)
                for (k = 0; k < sss->nstate; k++)
                   sss->sstream[j].gv_switch[i * sss->nstate + k] = FALSE;
+
+   return TRUE;
 }
 
 /* HTS_SStreamSet_get_nstream: get number of stream */
@@ -321,8 +356,7 @@
 }
 
 /* HTS_SStreamSet_get_msd: get MSD parameter */
-double HTS_SStreamSet_get_msd(HTS_SStreamSet * sss, int stream_index,
-                              int state_index)
+double HTS_SStreamSet_get_msd(HTS_SStreamSet * sss, int stream_index, int state_index)
 {
    return sss->sstream[stream_index].msd[state_index];
 }
@@ -334,27 +368,21 @@
 }
 
 /* HTS_SStreamSet_get_window_left_width: get left width of dynamic window */
-int HTS_SStreamSet_get_window_left_width(HTS_SStreamSet * sss,
-                                         int stream_index, int window_index)
+int HTS_SStreamSet_get_window_left_width(HTS_SStreamSet * sss, int stream_index, int window_index)
 {
    return sss->sstream[stream_index].win_l_width[window_index];
 }
 
 /* HTS_SStreamSet_get_winodow_right_width: get right width of dynamic window */
-int HTS_SStreamSet_get_window_right_width(HTS_SStreamSet * sss,
-                                          int stream_index, int window_index)
+int HTS_SStreamSet_get_window_right_width(HTS_SStreamSet * sss, int stream_index, int window_index)
 {
    return sss->sstream[stream_index].win_r_width[window_index];
 }
 
 /* HTS_SStreamSet_get_window_coefficient: get coefficient of dynamic window */
-double HTS_SStreamSet_get_window_coefficient(HTS_SStreamSet * sss,
-                                             int stream_index,
-                                             int window_index,
-                                             int coefficient_index)
+double HTS_SStreamSet_get_window_coefficient(HTS_SStreamSet * sss, int stream_index, int window_index, int coefficient_index)
 {
-   return sss->sstream[stream_index].
-       win_coefficient[window_index][coefficient_index];
+   return sss->sstream[stream_index].win_coefficient[window_index][coefficient_index];
 }
 
 /* HTS_SStreamSet_get_window_max_width: get max width of dynamic window */
@@ -376,59 +404,49 @@
 }
 
 /* HTS_SStreamSet_get_mean: get mean parameter */
-double HTS_SStreamSet_get_mean(HTS_SStreamSet * sss,
-                               int stream_index,
-                               int state_index, int vector_index)
+double HTS_SStreamSet_get_mean(HTS_SStreamSet * sss, int stream_index, int state_index, int vector_index)
 {
    return sss->sstream[stream_index].mean[state_index][vector_index];
 }
 
 /* HTS_SStreamSet_set_mean: set mean parameter */
-void HTS_SStreamSet_set_mean(HTS_SStreamSet * sss, int stream_index,
-                             int state_index, int vector_index, double f)
+void HTS_SStreamSet_set_mean(HTS_SStreamSet * sss, int stream_index, int state_index, int vector_index, double f)
 {
    sss->sstream[stream_index].mean[state_index][vector_index] = f;
 }
 
 /* HTS_SStreamSet_get_vari: get variance parameter */
-double HTS_SStreamSet_get_vari(HTS_SStreamSet * sss,
-                               int stream_index,
-                               int state_index, int vector_index)
+double HTS_SStreamSet_get_vari(HTS_SStreamSet * sss, int stream_index, int state_index, int vector_index)
 {
    return sss->sstream[stream_index].vari[state_index][vector_index];
 }
 
 /* HTS_SStreamSet_set_vari: set variance parameter */
-void HTS_SStreamSet_set_vari(HTS_SStreamSet * sss, int stream_index,
-                             int state_index, int vector_index, double f)
+void HTS_SStreamSet_set_vari(HTS_SStreamSet * sss, int stream_index, int state_index, int vector_index, double f)
 {
    sss->sstream[stream_index].vari[state_index][vector_index] = f;
 }
 
 /* HTS_SStreamSet_get_gv_mean: get GV mean parameter */
-double HTS_SStreamSet_get_gv_mean(HTS_SStreamSet * sss,
-                                  int stream_index, int vector_index)
+double HTS_SStreamSet_get_gv_mean(HTS_SStreamSet * sss, int stream_index, int vector_index)
 {
    return sss->sstream[stream_index].gv_mean[vector_index];
 }
 
 /* HTS_SStreamSet_get_gv_mean: get GV variance parameter */
-double HTS_SStreamSet_get_gv_vari(HTS_SStreamSet * sss,
-                                  int stream_index, int vector_index)
+double HTS_SStreamSet_get_gv_vari(HTS_SStreamSet * sss, int stream_index, int vector_index)
 {
    return sss->sstream[stream_index].gv_vari[vector_index];
 }
 
 /* HTS_SStreamSet_set_gv_switch: set GV switch */
-void HTS_SStreamSet_set_gv_switch(HTS_SStreamSet * sss, int stream_index,
-                                  int state_index, HTS_Boolean i)
+void HTS_SStreamSet_set_gv_switch(HTS_SStreamSet * sss, int stream_index, int state_index, HTS_Boolean i)
 {
    sss->sstream[stream_index].gv_switch[state_index] = i;
 }
 
 /* HTS_SStreamSet_get_gv_switch: get GV switch */
-HTS_Boolean HTS_SStreamSet_get_gv_switch(HTS_SStreamSet * sss, int stream_index,
-                                         int state_index)
+HTS_Boolean HTS_SStreamSet_get_gv_switch(HTS_SStreamSet * sss, int stream_index, int state_index)
 {
    return sss->sstream[stream_index].gv_switch[state_index];
 }
diff -Nru htsengine-1.05/lib/HTS_vocoder.c htsengine-1.06/lib/HTS_vocoder.c
--- htsengine-1.05/lib/HTS_vocoder.c	2011-07-07 07:59:30.000000000 +0900
+++ htsengine-1.06/lib/HTS_vocoder.c	2011-12-20 11:11:30.000000000 +0900
@@ -101,8 +101,7 @@
 }
 
 /* HTS_mlsafir: sub functions for MLSA filter */
-static double HTS_mlsafir(const double x, const double *b, const int m,
-                          const double a, const double aa, double *d)
+static double HTS_mlsafir(const double x, const double *b, const int m, const double a, const double aa, double *d)
 {
    double y = 0.0;
    int i;
@@ -123,9 +122,7 @@
 }
 
 /* HTS_mlsadf1: sub functions for MLSA filter */
-static double HTS_mlsadf1(double x, const double *b, const int m,
-                          const double a, const double aa, const int pd,
-                          double *d, const double *ppade)
+static double HTS_mlsadf1(double x, const double *b, const int m, const double a, const double aa, const int pd, double *d, const double *ppade)
 {
    double v, out = 0.0, *pt;
    int i;
@@ -147,9 +144,7 @@
 }
 
 /* HTS_mlsadf2: sub functions for MLSA filter */
-static double HTS_mlsadf2(double x, const double *b, const int m,
-                          const double a, const double aa, const int pd,
-                          double *d, const double *ppade)
+static double HTS_mlsadf2(double x, const double *b, const int m, const double a, const double aa, const int pd, double *d, const double *ppade)
 {
    double v, out = 0.0, *pt;
    int i;
@@ -171,8 +166,7 @@
 }
 
 /* HTS_mlsadf: functions for MLSA filter */
-static double HTS_mlsadf(double x, const double *b, const int m, const double a,
-                         const int pd, double *d)
+static double HTS_mlsadf(double x, const double *b, const int m, const double a, const int pd, double *d)
 {
    const double aa = 1 - a * a;
    const double *ppade = &(HTS_pade[pd * (pd + 1) / 2]);
@@ -269,8 +263,7 @@
 }
 
 /* HTS_freqt: frequency transformation */
-static void HTS_freqt(HTS_Vocoder * v, const double *c1, const int m1,
-                      double *c2, const int m2, const double a)
+static void HTS_freqt(HTS_Vocoder * v, const double *c1, const int m1, double *c2, const int m2, const double a)
 {
    int i, j;
    const double b = 1 - a * a;
@@ -293,8 +286,7 @@
       if (1 <= m2)
          g[1] = b * v->freqt_buff[0] + a * (v->freqt_buff[1] = g[1]);
       for (j = 2; j <= m2; j++)
-         g[j] = v->freqt_buff[j - 1] +
-             a * ((v->freqt_buff[j] = g[j]) - g[j - 1]);
+         g[j] = v->freqt_buff[j - 1] + a * ((v->freqt_buff[j] = g[j]) - g[j - 1]);
    }
 
    HTS_movem(g, c2, m2 + 1);
@@ -317,8 +309,7 @@
 }
 
 /* HTS_b2en: calculate frame energy */
-static double HTS_b2en(HTS_Vocoder * v, const double *b, const int m,
-                       const double a)
+static double HTS_b2en(HTS_Vocoder * v, const double *b, const int m, const double a)
 {
    int i;
    double en = 0.0;
@@ -328,8 +319,7 @@
    if (v->spectrum2en_size < m) {
       if (v->spectrum2en_buff != NULL)
          HTS_free(v->spectrum2en_buff);
-      v->spectrum2en_buff =
-          (double *) HTS_calloc((m + 1) + 2 * IRLENG, sizeof(double));
+      v->spectrum2en_buff = (double *) HTS_calloc((m + 1) + 2 * IRLENG, sizeof(double));
       v->spectrum2en_size = m;
    }
    cep = v->spectrum2en_buff + m + 1;
@@ -467,9 +457,7 @@
 }
 
 /* HTS_gc2gc: generalized cepstral transformation */
-static void HTS_gc2gc(HTS_Vocoder * v, double *c1, const int m1,
-                      const double g1, double *c2, const int m2,
-                      const double g2)
+static void HTS_gc2gc(HTS_Vocoder * v, double *c1, const int m1, const double g1, double *c2, const int m2, const double g2)
 {
    int i, min, k, mk;
    double ss1, ss2, cc;
@@ -502,9 +490,7 @@
 }
 
 /* HTS_mgc2mgc: frequency and generalized cepstral transformation */
-static void HTS_mgc2mgc(HTS_Vocoder * v, double *c1, const int m1,
-                        const double a1, const double g1, double *c2,
-                        const int m2, const double a2, const double g2)
+static void HTS_mgc2mgc(HTS_Vocoder * v, double *c1, const int m1, const double a1, const double g1, double *c2, const int m2, const double a2, const double g2)
 {
    double a;
 
@@ -522,8 +508,7 @@
 }
 
 /* HTS_lsp2mgc: transform LSP to MGC */
-static void HTS_lsp2mgc(HTS_Vocoder * v, double *lsp, double *mgc,
-                        const int m, const double alpha)
+static void HTS_lsp2mgc(HTS_Vocoder * v, double *lsp, double *mgc, const int m, const double alpha)
 {
    int i;
    /* lsp2lpc */
@@ -552,8 +537,7 @@
 }
 
 /* HTS_mglsadff: sub functions for MGLSA filter */
-static double HTS_mglsadff(double x, const double *b, const int m,
-                           const double a, double *d)
+static double HTS_mglsadff(double x, const double *b, const int m, const double a, double *d)
 {
    int i;
 
@@ -572,8 +556,7 @@
 }
 
 /* HTS_mglsadf: sub functions for MGLSA filter */
-static double HTS_mglsadf(double x, const double *b, const int m,
-                          const double a, const int n, double *d)
+static double HTS_mglsadf(double x, const double *b, const int m, const double a, const int n, double *d)
 {
    int i;
 
@@ -583,6 +566,7 @@
    return x;
 }
 
+/* HTS_white_noise: return white noise */
 static double HTS_white_noise(HTS_Vocoder * v)
 {
    if (v->gauss)
@@ -592,8 +576,7 @@
 }
 
 /* HTS_ping_pulse: ping pulse using low-pass filter */
-static void HTS_ping_pulse(HTS_Vocoder * v, const int ping_place,
-                           const double p, const int nlpf, const double *lpf)
+static void HTS_ping_pulse(HTS_Vocoder * v, const int ping_place, const double p, const int nlpf, const double *lpf)
 {
    int i, j;
    const double power = sqrt(p);
@@ -604,8 +587,7 @@
 }
 
 /* HTS_ping_noise: ping noise using low-pass filter */
-static void HTS_ping_noise(HTS_Vocoder * v, const int ping_place,
-                           const int nlpf, const double *lpf)
+static void HTS_ping_noise(HTS_Vocoder * v, const int ping_place, const int nlpf, const double *lpf)
 {
    int i, j;
    const double power = HTS_white_noise(v);
@@ -633,8 +615,7 @@
 }
 
 /* HTS_Vocoder_start_excitation: start excitation of each frame */
-static void HTS_Vocoder_start_excitation(HTS_Vocoder * v, const double pitch,
-                                         const int nlpf)
+static void HTS_Vocoder_start_excitation(HTS_Vocoder * v, const double pitch, const int nlpf)
 {
    if (v->p1 != 0.0 && pitch != 0.0)
       v->inc = (pitch - v->p1) * v->iprd / v->fprd;
@@ -649,9 +630,7 @@
 }
 
 /* HTS_Vocoder_get_excitation: get excitation of each sample */
-static double HTS_Vocoder_get_excitation(HTS_Vocoder * v, const int fprd_index,
-                                         const int iprd_index, const int nlpf,
-                                         const double *lpf)
+static double HTS_Vocoder_get_excitation(HTS_Vocoder * v, const int fprd_index, const int iprd_index, const int nlpf, const double *lpf)
 {
    double x;
    int i, j;
@@ -723,9 +702,7 @@
 }
 
 /* HTS_Vocoder_initialize: initialize vocoder */
-void HTS_Vocoder_initialize(HTS_Vocoder * v, const int m, const int stage,
-                            HTS_Boolean use_log_gain, const int rate,
-                            const int fperiod)
+void HTS_Vocoder_initialize(HTS_Vocoder * v, const int m, const int stage, HTS_Boolean use_log_gain, const int rate, const int fperiod)
 {
    /* set parameter */
    v->stage = stage;
@@ -755,9 +732,7 @@
    v->spectrum2en_buff = NULL;
    v->spectrum2en_size = 0;
    if (v->stage == 0) {         /* for MCP */
-      v->c =
-          (double *) HTS_calloc(m * (3 + PADEORDER) + 5 * PADEORDER + 6,
-                                sizeof(double));
+      v->c = (double *) HTS_calloc(m * (3 + PADEORDER) + 5 * PADEORDER + 6, sizeof(double));
       v->cc = v->c + m + 1;
       v->cinc = v->cc + m + 1;
       v->d1 = v->cinc + m + 1;
@@ -771,10 +746,7 @@
 }
 
 /* HTS_Vocoder_synthesize: pulse/noise excitation and MLSA/MGLSA filster based waveform synthesis */
-void HTS_Vocoder_synthesize(HTS_Vocoder * v, const int m, double lf0,
-                            double *spectrum, const int nlpf, double *lpf,
-                            double alpha, double beta, double volume,
-                            short *rawdata, HTS_Audio * audio)
+void HTS_Vocoder_synthesize(HTS_Vocoder * v, const int m, double lf0, double *spectrum, const int nlpf, double *lpf, double alpha, double beta, double volume, short *rawdata, HTS_Audio * audio)
 {
    double x;
    int i, j;
@@ -863,8 +835,7 @@
 }
 
 /* HTS_Vocoder_postfilter_mcp: postfilter for MCP */
-void HTS_Vocoder_postfilter_mcp(HTS_Vocoder * v, double *mcp, const int m,
-                                double alpha, double beta)
+void HTS_Vocoder_postfilter_mcp(HTS_Vocoder * v, double *mcp, const int m, double alpha, double beta)
 {
    double e1, e2;
    int k;
diff -Nru open-jtalk-1.04/AUTHORS open-jtalk-1.05/AUTHORS
--- open-jtalk-1.04/AUTHORS	2011-07-07 11:14:53.000000000 +0900
+++ open-jtalk-1.05/AUTHORS	2011-12-20 23:44:24.000000000 +0900
@@ -1,6 +1,6 @@
 The Open JTalk is a Japanese TTS system. This software is released under the
-New and Simplified BSD license. See the COPYING file in the same directory as
-this file for the license.
+Modified BSD license. See the COPYING file in the same directory as this file
+for the license.
 
 The Open JTalk has been developed by several members of HTS working group and
 some graduate students in Nagoya Institute of Technology:
diff -Nru open-jtalk-1.04/ChangeLog open-jtalk-1.05/ChangeLog
--- open-jtalk-1.04/ChangeLog	2011-07-07 11:21:14.000000000 +0900
+++ open-jtalk-1.05/ChangeLog	2011-12-24 17:52:41.000000000 +0900
@@ -1,3 +1,40 @@
+2011-12-24 17:52  uratec
+
+	* ChangeLog, bin/open_jtalk.c: Fix version number.
+
+2011-12-20 23:48  uratec
+
+	* AUTHORS, ChangeLog, README: Fix documents.
+
+2011-12-20 16:51  uratec
+
+	* ChangeLog, NEWS, README, configure.ac: Update documents to
+	  version 1.05
+
+2011-12-20 15:05  uratec
+
+	* njd_set_digit/: njd_set_digit.c, njd_set_digit_rule_euc_jp.h,
+	  njd_set_digit_rule_shift_jis.h, njd_set_digit_rule_utf_8.h:
+	  Modify rule after a decimal point.
+
+2011-12-20 13:59  uratec
+
+	* njd_set_accent_type/njd_set_accent_type.c: Modify accent type
+	  detection.
+
+2011-12-20 13:49  uratec
+
+	* jpcommon/: jpcommon_rule_euc_jp.h, jpcommon_rule_shift_jis.h,
+	  jpcommon_rule_utf_8.h: Add new moras.
+
+2011-12-20 13:48  uratec
+
+	* jpcommon/jpcommon_label.c: Fix bugs in label generation.
+
+2011-12-20 13:46  uratec
+
+	* mecab-naist-jdic/naist-jdic.csv: add new words to dictionary
+
 2011-07-07 11:20  uratec
 
 	* ChangeLog, NEWS, README, configure.ac, bin/open_jtalk.c: update
diff -Nru open-jtalk-1.04/NEWS open-jtalk-1.05/NEWS
--- open-jtalk-1.04/NEWS	2011-07-07 11:14:53.000000000 +0900
+++ open-jtalk-1.05/NEWS	2011-12-20 16:44:52.000000000 +0900
@@ -1,3 +1,9 @@
+Version 1.05:
+ * modify pronunciation rule after a decimal point.
+ * modify accent type detection.
+ * add new moras and new words.
+ * fix some bugs.
+
 Version 1.04:
  * fix some bugs.
  * modify dictionary.
diff -Nru open-jtalk-1.04/README open-jtalk-1.05/README
--- open-jtalk-1.04/README	2011-07-07 11:14:53.000000000 +0900
+++ open-jtalk-1.05/README	2011-12-20 23:44:43.000000000 +0900
@@ -1,6 +1,6 @@
 ===============================================================================
-               The Japanese TTS System "Open JTalk" version 1.04
-                             release July 7, 2011
+               The Japanese TTS System "Open JTalk" version 1.05
+                           release December 25, 2011
 
 
 The Open JTalk is a Japanese TTS System. It has been being developed by HTS
@@ -11,7 +11,7 @@
                                     Copying
 *******************************************************************************
 
-The Open JTalk is released under the New and Simplified BSD license (see
+The Open JTalk is released under the Modified BSD license (see
 http://www.opensource.org/). Using and distributing this software is free
 (without restriction including without limitation the rights to use, copy,
 modify, merge, publish, distribute, sublicense, and/or sell copies of this
diff -Nru open-jtalk-1.04/bin/open_jtalk.c open-jtalk-1.05/bin/open_jtalk.c
--- open-jtalk-1.04/bin/open_jtalk.c	2011-07-07 11:14:53.000000000 +0900
+++ open-jtalk-1.05/bin/open_jtalk.c	2011-12-24 17:49:12.000000000 +0900
@@ -199,7 +199,7 @@
 {
    fprintf(stderr, "\n");
    fprintf(stderr, "The Japanese TTS System \"Open JTalk\"\n");
-   fprintf(stderr, "Open JTalk version 1.04 (http://open-jtalk.sourceforge.net/)\n");
+   fprintf(stderr, "Open JTalk version 1.05 (http://open-jtalk.sourceforge.net/)\n");
    fprintf(stderr, "Copyright (C) 2008-2011  Nagoya Institute of Technology\n");
    fprintf(stderr, "All rights reserved.\n");
    HTS_show_copyright(stderr);
diff -Nru open-jtalk-1.04/configure open-jtalk-1.05/configure
--- open-jtalk-1.04/configure	2011-07-07 11:14:58.000000000 +0900
+++ open-jtalk-1.05/configure	2011-12-24 17:55:47.000000000 +0900
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for open_jtalk 1.04.
+# Generated by GNU Autoconf 2.63 for open_jtalk 1.05.
 #
 # Report bugs to <open-jtalk-users@xxxxxxxxxxxxxxxxxxxxx>.
 #
@@ -598,8 +598,8 @@
 # Identity of this package.
 PACKAGE_NAME='open_jtalk'
 PACKAGE_TARNAME='open_jtalk'
-PACKAGE_VERSION='1.04'
-PACKAGE_STRING='open_jtalk 1.04'
+PACKAGE_VERSION='1.05'
+PACKAGE_STRING='open_jtalk 1.05'
 PACKAGE_BUGREPORT='open-jtalk-users@xxxxxxxxxxxxxxxxxxxxx'
 
 # Factoring default headers for most tests.
@@ -1322,7 +1322,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures open_jtalk 1.04 to adapt to many kinds of systems.
+\`configure' configures open_jtalk 1.05 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1392,7 +1392,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of open_jtalk 1.04:";;
+     short | recursive ) echo "Configuration of open_jtalk 1.05:";;
    esac
   cat <<\_ACEOF
 
@@ -1492,7 +1492,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-open_jtalk configure 1.04
+open_jtalk configure 1.05
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1508,7 +1508,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by open_jtalk $as_me 1.04, which was
+It was created by open_jtalk $as_me 1.05, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -2225,7 +2225,7 @@
 
 # Define the identity of the package.
  PACKAGE=open_jtalk
- VERSION=1.04
+ VERSION=1.05
 
 
 # Some tools Automake needs.
@@ -11150,7 +11150,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by open_jtalk $as_me 1.04, which was
+This file was extended by open_jtalk $as_me 1.05, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -11213,7 +11213,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-open_jtalk config.status 1.04
+open_jtalk config.status 1.05
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff -Nru open-jtalk-1.04/configure.ac open-jtalk-1.05/configure.ac
--- open-jtalk-1.04/configure.ac	2011-07-07 11:14:05.000000000 +0900
+++ open-jtalk-1.05/configure.ac	2011-12-20 13:37:32.000000000 +0900
@@ -1,9 +1,9 @@
 # Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.59)
-AC_INIT(open_jtalk, 1.04, open-jtalk-users@xxxxxxxxxxxxxxxxxxxxx)
+AC_INIT(open_jtalk, 1.05, open-jtalk-users@xxxxxxxxxxxxxxxxxxxxx)
 AC_CONFIG_AUX_DIR([config])
 AC_COPYRIGHT(Copyright 2008-2011 Nagoya Institute of Technology)
-AM_INIT_AUTOMAKE(open_jtalk, 1.04, nostdinc no-installinfo no-installman)
+AM_INIT_AUTOMAKE(open_jtalk, 1.05, nostdinc no-installinfo no-installman)
 
 # Checks for C/C++ compiler
 AC_PROG_CC
diff -Nru open-jtalk-1.04/debian/changelog open-jtalk-1.05/debian/changelog
--- open-jtalk-1.04/debian/changelog	2011-12-10 11:50:23.000000000 +0900
+++ open-jtalk-1.05/debian/changelog	2011-12-25 10:09:27.000000000 +0900
@@ -1,3 +1,13 @@
+open-jtalk (1.05-1) unstable; urgency=low
+
+  * New upstream release
+    - modify pronunciation rule after a decimal point.
+    - modify accent type detection.
+    - add new moras and new words.
+    - fix some bugs.
+
+ -- Koichi Akabe <vbkaisetsu@xxxxxxxxx>  Sun, 25 Dec 2011 09:40:47 +0900
+
 open-jtalk (1.04-2) unstable; urgency=low
 
   * debian/control
diff -Nru open-jtalk-1.04/debian/control open-jtalk-1.05/debian/control
--- open-jtalk-1.04/debian/control	2011-12-10 12:03:11.000000000 +0900
+++ open-jtalk-1.05/debian/control	2011-12-25 10:53:34.000000000 +0900
@@ -12,7 +12,8 @@
 Suggests: open-jtalk-mecab-naist-jdic, hts-voice-nitech-jp-atr503-m001
 Description: Japanese text-to-speech system
  Open JTalk is a Japanese text-to-speech system based on HTS engine. This
- program uses Mecab dictionaries to analyse texts and gets pronunciation.
+ program uses Mecab and its dictionary modified for Open JTalk to analyse
+ texts and gets pronunciation.
 
 Package: open-jtalk-mecab-naist-jdic
 Section: misc
diff -Nru open-jtalk-1.04/jpcommon/jpcommon_label.c open-jtalk-1.05/jpcommon/jpcommon_label.c
--- open-jtalk-1.04/jpcommon/jpcommon_label.c	2011-07-07 11:14:54.000000000 +0900
+++ open-jtalk-1.05/jpcommon/jpcommon_label.c	2011-12-20 13:25:06.000000000 +0900
@@ -394,7 +394,7 @@
       if (label->phoneme_tail != NULL) {
          if (strcmp(label->phoneme_tail->phoneme, JPCOMMON_PHONEME_SHORT_PAUSE) == 0) {
             fprintf(stderr,
-                    "WARNING: JPCommonLabel_push_word() in jpcommon_label.c: Short pause should not be chained.\n");
+                    "WARNING: JPCommonLabel_insert_word() in jpcommon_label.c: Short pause should not be chained.\n");
             return;
          }
          label->phoneme_tail->next =
@@ -404,7 +404,7 @@
          label->phoneme_tail = label->phoneme_tail->next;
       } else {
          fprintf(stderr,
-                 "WARNING: JPCommonLabel_push_word() in jpcommon_label.c: First mora should not be short pause.\n");
+                 "WARNING: JPCommonLabel_insert_word() in jpcommon_label.c: First mora should not be short pause.\n");
       }
       label->short_pause_flag = 0;
    }
@@ -444,7 +444,7 @@
       find = strtopcmp(pron, JPCOMMON_MORA_LONG_VOWEL);
       if (find != -1) {
          /* for long vowel */
-         if (label->phoneme_tail != NULL && is_first_word != 1) {
+         if (label->phoneme_tail != NULL) {
             JPCommonLabel_insert_pause(label);
             label->phoneme_tail->next =
                 (JPCommonLabelPhoneme *) calloc(1, sizeof(JPCommonLabelPhoneme));
@@ -724,7 +724,7 @@
       else
          a = p->up->up->up;
       if (a == NULL)
-         sprintf(label->feature[i], "%s/F:xx_xx#xx_xx@xx", label->feature[i]);
+         sprintf(label->feature[i], "%s/F:xx_xx#xx_xx@xx_xx|xx_xx", label->feature[i]);
       else {
          tmp1 = index_accent_phrase_in_breath_group(a);
          tmp2 = index_mora_in_breath_group(a->head->head);
diff -Nru open-jtalk-1.04/jpcommon/jpcommon_rule_euc_jp.h open-jtalk-1.05/jpcommon/jpcommon_rule_euc_jp.h
--- open-jtalk-1.04/jpcommon/jpcommon_rule_euc_jp.h	2011-07-07 11:14:54.000000000 +0900
+++ open-jtalk-1.05/jpcommon/jpcommon_rule_euc_jp.h	2011-12-20 13:25:07.000000000 +0900
@@ -83,6 +83,7 @@
    "\A5\F1", "e", NULL,
    "\A5\F0", "i", NULL,
    "\A5\EF", "w", "a",
+   "\A5\EE", "w", "a",
    "\A5\ED", "r", "o",
    "\A5\EC", "r", "e",
    "\A5\EB", "r", "u",
@@ -201,7 +202,10 @@
    "\A5\B3", "k", "o",
    "\A5\B2", "g", "e",
    "\A5\B1", "k", "e",
+   "\A5\F6", "k", "e",
+   "\A5\B0\A5\EE", "gw", "a",
    "\A5\B0", "g", "u",
+   "\A5\AF\A5\EE", "kw", "a",
    "\A5\AF", "k", "u",
    "\A5\AE\A5\E7", "gy", "o",
    "\A5\AE\A5\E5", "gy", "u",
diff -Nru open-jtalk-1.04/jpcommon/jpcommon_rule_shift_jis.h open-jtalk-1.05/jpcommon/jpcommon_rule_shift_jis.h
--- open-jtalk-1.04/jpcommon/jpcommon_rule_shift_jis.h	2011-07-07 11:14:54.000000000 +0900
+++ open-jtalk-1.05/jpcommon/jpcommon_rule_shift_jis.h	2011-12-20 13:25:07.000000000 +0900
@@ -83,6 +83,7 @@
    "\83\91", "e", NULL,
    "\83\90", "i", NULL,
    "\83\8F", "w", "a",
+   "\83\8E", "w", "a",
    "\83\8D", "r", "o",
    "\83\8C", "r", "e",
    "\83\8B", "r", "u",
@@ -201,7 +202,10 @@
    "\83R", "k", "o",
    "\83Q", "g", "e",
    "\83P", "k", "e",
+   "\83\96", "k", "e",
+   "\83O\83\8E", "gw", "a",
    "\83O", "g", "u",
+   "\83N\83\8E", "kw", "a",
    "\83N", "k", "u",
    "\83M\83\87", "gy", "o",
    "\83M\83\85", "gy", "u",
diff -Nru open-jtalk-1.04/jpcommon/jpcommon_rule_utf_8.h open-jtalk-1.05/jpcommon/jpcommon_rule_utf_8.h
--- open-jtalk-1.04/jpcommon/jpcommon_rule_utf_8.h	2011-07-07 11:14:54.000000000 +0900
+++ open-jtalk-1.05/jpcommon/jpcommon_rule_utf_8.h	2011-12-20 13:25:07.000000000 +0900
@@ -83,6 +83,7 @@
    "ヱ", "e", NULL,
    "ヰ", "i", NULL,
    "ワ", "w", "a",
+   "ヮ", "w", "a",
    "ロ", "r", "o",
    "レ", "r", "e",
    "ル", "r", "u",
@@ -201,7 +202,10 @@
    "コ", "k", "o",
    "ゲ", "g", "e",
    "ケ", "k", "e",
+   "ヶ", "k", "e",
+   "グヮ", "gw", "a",
    "グ", "g", "u",
+   "クヮ", "kw", "a",
    "ク", "k", "u",
    "ギョ", "gy", "o",
    "ギュ", "gy", "u",
diff -Nru open-jtalk-1.04/mecab-naist-jdic/naist-jdic.csv open-jtalk-1.05/mecab-naist-jdic/naist-jdic.csv
--- open-jtalk-1.04/mecab-naist-jdic/naist-jdic.csv	2011-12-25 11:52:30.000000000 +0900
+++ open-jtalk-1.05/mecab-naist-jdic/naist-jdic.csv	2011-12-25 11:53:36.000000000 +0900
@@ -237,6 +237,7 @@
 AMF,1348,1348,6850,名詞,固有名詞,一般,*,*,*,AMF,エイエムエフ,エイエムエフ,5/6,C1
 ANA,1352,1352,6774,名詞,固有名詞,組織,*,*,*,ANA,エイエヌエイ,エイエヌエイ,5/6,C1
 ANC,1352,1352,6690,名詞,固有名詞,組織,*,*,*,ANC,エイエヌシー,エイエヌシー,5/6,C1
+ANDROID,1348,1348,698,名詞,固有名詞,一般,*,*,*,ANDROID,アンドロイド,アンドロイド,4/6,C1
 ANNEX,1348,1348,6977,名詞,固有名詞,一般,*,*,*,ANNEX,アネックス,アネックス,2/5,C1
 AP,1352,1352,6880,名詞,固有名詞,組織,*,*,*,AP,エイピー,エイピー,3/4,C1
 APEC,1352,1352,6212,名詞,固有名詞,組織,*,*,*,APEC,エイペック,エイペック,1/5,C1
@@ -265,6 +266,7 @@
 AWACS,1348,1348,6978,名詞,固有名詞,一般,*,*,*,AWACS,エイダブリューエイシーエス,エイダブリューエイシーエス,11/12,C1
 AXiS寿屋,1352,1352,6774,名詞,固有名詞,組織,*,*,*,AXiS寿屋,アクシスコトブキヤ,アクシスコトブキヤ,1/4,C1
 AZT,1345,1345,6873,名詞,一般,*,*,*,*,AZT,エイゼットティー,エイゼットティー,6/7,C2
+Android,1348,1348,698,名詞,固有名詞,一般,*,*,*,Android,アンドロイド,アンドロイド,4/6,C1
 A子,1351,1351,5879,名詞,固有名詞,人名,名,*,*,A子,エイコ,エイコ,1/3,C1
 B,4,4,3662,記号,アルファベット,*,*,*,*,B,ビー,ビー,1/2,*
 B,4,4,4512,記号,アルファベット,*,*,*,*,B,ビー,ビー,1/2,*
@@ -303,6 +305,7 @@
 C,4,4,5552,記号,アルファベット,*,*,*,*,C,シー,シー,1/2,*
 C—NET,1352,1352,6769,名詞,固有名詞,組織,*,*,*,C—NET,シーネット,シーネット,3/5,C1
 C—SPAN,1352,1352,6772,名詞,固有名詞,組織,*,*,*,C—SPAN,シースパン,シースパン,0/5,C1
+C++,1348,1348,698,名詞,固有名詞,一般,*,*,*,C++,シープラスプラス,シープラスプラス,6/8,C1
 CAD,1345,1345,6911,名詞,一般,*,*,*,*,CAD,キャド,キャド,0/2,C2
 CAL,1345,1345,6876,名詞,一般,*,*,*,*,CAL,シーエイエル,シーエイエル,5/6,C1
 CALS,1348,1348,7006,名詞,固有名詞,一般,*,*,*,CALS,シーエイエルエス,シーエイエルエス,7/8,C1
@@ -699,6 +702,7 @@
 MF,1345,1345,11989,名詞,一般,*,*,*,*,MF,エムエフ,エムエフ,3/4,C1
 MFJ,1348,1348,6994,名詞,固有名詞,一般,*,*,*,MFJ,エムエフジェイ,エムエフジェイ,5/6,C1
 MIA,1352,1352,6770,名詞,固有名詞,組織,*,*,*,MIA,エムアイエイ,エムアイエイ,5/6,C1
+MICROSOFT,1348,1348,698,名詞,固有名詞,一般,*,*,*,MICROSOFT,マイクロソフト,マイクロソフト,5/7,C1
 MISUMI,1352,1352,6795,名詞,固有名詞,組織,*,*,*,MISUMI,ミスミ,ミスミ,0/3,C1
 MIT,1352,1352,6774,名詞,固有名詞,組織,*,*,*,MIT,エムアイティー,エムアイティー,2/6,C1
 MK,1352,1352,6704,名詞,固有名詞,組織,*,*,*,MK,エムケイ,エムケイ,3/4,C1
@@ -718,9 +722,12 @@
 MTB,1345,1345,8309,名詞,一般,*,*,*,*,MTB,エムティービー,エムティービー,5/6,C2
 MVP,1345,1345,6866,名詞,一般,*,*,*,*,MVP,エムブイピー,エムブイピー,5/6,C2
 Mb,1360,1360,13126,名詞,接尾,助数詞,*,*,*,Mb,メガバイト,メガバイト,3/5,C1
+MicroSoft,1348,1348,698,名詞,固有名詞,一般,*,*,*,MicroSoft,マイクロソフト,マイクロソフト,5/7,C1
+Microsoft,1348,1348,698,名詞,固有名詞,一般,*,*,*,Microsoft,マイクロソフト,マイクロソフト,5/7,C1
 MrJOHN,1352,1352,6774,名詞,固有名詞,組織,*,*,*,MrJOHN,ミスタージョン,ミスタージョン,1/4,C2
 MrMax,1352,1352,6774,名詞,固有名詞,組織,*,*,*,MrMax,ミスターマックス,ミスターマックス,5/8,C1
 Music,1345,1345,6710,名詞,一般,*,*,*,*,Music,ミュージック,ミュージック,1/5,C1
+MusicXML,1348,1348,698,名詞,固有名詞,一般,*,*,*,MusicXML,ミュージックエクスエムエル,ミュージックエクスエムエル,11/12,C1
 Myb,1348,1348,6924,名詞,固有名詞,一般,*,*,*,Myb,エムワイビー,エムワイビー,5/6,C1
 Mバイト,1360,1360,13126,名詞,接尾,助数詞,*,*,*,Mバイト,メガバイト,メガバイト,3/5,C1
 Mヘルツ,1360,1360,13125,名詞,接尾,助数詞,*,*,*,Mヘルツ,メガヘルツ,メガヘルツ,3/5,C1
@@ -995,6 +1002,8 @@
 TVh,1352,1352,6774,名詞,固有名詞,組織,*,*,*,TVh,ティーブイエッチ,ティーブイエッチ,5/7,C1
 TYK,1352,1352,6774,名詞,固有名詞,組織,*,*,*,TYK,ティーワイケイ,ティーワイケイ,5/6,C1
 TYS,1352,1352,6774,名詞,固有名詞,組織,*,*,*,TYS,ティーワイエス,ティーワイエス,5/6,C1
+Techno Speech,1348,1348,698,名詞,固有名詞,一般,*,*,*,Techno Speech,テクノスピーチ,テクノスピーチ,5/7,C1
+Techno−Speech,1348,1348,698,名詞,固有名詞,一般,*,*,*,Techno−Speech,テクノスピーチ,テクノスピーチ,5/7,C1
 The虎舞竜,1352,1352,6773,名詞,固有名詞,組織,*,*,*,The虎舞竜,ザトラブリュウ,ザトラブリュー,1/1,C1
 ThinkPad,1348,1348,7008,名詞,固有名詞,一般,*,*,*,ThinkPad,シンクパッド,シンクパッド,4/6,C1
 Tシャツ,1345,1345,6246,名詞,一般,*,*,*,*,Tシャツ,ティーシャツ,ティーシャツ,0/4,C2
@@ -1048,6 +1057,7 @@
 VSQ,1345,1345,49,名詞,一般,*,*,*,*,VSQ,ヴイエスキュー,ヴイエスキュー,5/6,C1
 VTR,1345,1345,6856,名詞,一般,*,*,*,*,VTR,ブイティーアール,ブイティーアール,5/7,C1
 VW,1352,1352,6749,名詞,固有名詞,組織,*,*,*,VW,フォルクスワーゲン,フォルクスワーゲン,5/8,C1
+Visual C++,1348,1348,698,名詞,固有名詞,一般,*,*,*,Visual C++,ヴィジュアルシープラスプラス,ヴィジュアルシープラスプラス,10/12,C1
 Vocaloid,1348,1348,698,名詞,固有名詞,一般,*,*,*,Vocaloid,ヴォーカロイド,ヴォーカロイド,4/6,C1
 Vリーグ,1352,1352,6609,名詞,固有名詞,組織,*,*,*,Vリーグ,ブイリーグ,ブイリーグ,3/5,C1
 W,4,4,4712,記号,アルファベット,*,*,*,*,W,ダブリュー,ダブリュー,1/4,*
@@ -1098,10 +1108,12 @@
 a,4,4,3924,記号,アルファベット,*,*,*,*,a,エイ,エイ,1/2,*
 a,4,4,4656,記号,アルファベット,*,*,*,*,a,エイ,エイ,1/2,*
 ams西武,1352,1352,6774,名詞,固有名詞,組織,*,*,*,ams西武,アムスセイブ,アムスセイブ,4/6,C1
+android,1348,1348,698,名詞,固有名詞,一般,*,*,*,android,アンドロイド,アンドロイド,4/6,C1
 b,4,4,4512,記号,アルファベット,*,*,*,*,b,ビー,ビー,1/2,*
 b,4,4,4521,記号,アルファベット,*,*,*,*,b,ビー,ビー,1/2,*
 c,4,4,4755,記号,アルファベット,*,*,*,*,c,シー,シー,1/2,*
 c,4,4,4778,記号,アルファベット,*,*,*,*,c,シー,シー,1/2,*
+c++,1348,1348,698,名詞,固有名詞,一般,*,*,*,c++,シープラスプラス,シープラスプラス,6/8,C1
 cal,1360,1360,13205,名詞,接尾,助数詞,*,*,*,cal,カロリー,カロリー,1/4,C1
 cc,1360,1360,13394,名詞,接尾,助数詞,*,*,*,cc,シーシー,シーシー,3/4,C2
 ceatec,1348,1348,698,名詞,固有名詞,一般,*,*,*,ceatec,シーテック,シーテック,1/5,C1
@@ -1178,6 +1190,7 @@
 mW,1360,1360,13126,名詞,接尾,助数詞,*,*,*,mW,ミリワット,ミリワット,3/5,C1
 mg,1360,1360,13124,名詞,接尾,助数詞,*,*,*,mg,ミリグラム,ミリグラム,3/5,C1
 mhz,1360,1360,13125,名詞,接尾,助数詞,*,*,*,mhz,メガヘルツ,メガヘルツ,3/5,C1
+microsoft,1348,1348,698,名詞,固有名詞,一般,*,*,*,microsoft,マイクロソフト,マイクロソフト,5/7,C1
 ml,1360,1360,13113,名詞,接尾,助数詞,*,*,*,ml,ミリリットル,ミリリットル,3/6,C1
 mm,1360,1360,13126,名詞,接尾,助数詞,*,*,*,mm,ミリメートル,ミリメートル,3/6,C1
 mmdagent,1348,1348,698,名詞,固有名詞,一般,*,*,*,mmdagent,エムエムディーエージェント,エムエムディーエージェント,7/11,C1
@@ -10261,7 +10274,7 @@
 い留守,1345,1345,7430,名詞,一般,*,*,*,*,い留守,イルス,イルス,1/3,C1
 う,12,12,7368,形容詞,自立,*,*,形容詞・アウオ段,ガル接続,うい,ウ,ウ,1/1,C3
 う,3,3,5562,感動詞,*,*,*,*,*,う,ウ,ウ,0/1,C3
-う,531,531,6484,助動詞,*,*,*,不変化型,基本形,う,ウ,ウ,0/1,動詞%F4@0/特殊助動詞%F2@0
+う,531,531,6484,助動詞,*,*,*,不変化型,基本形,う,ウ,ー,0/1,動詞%F4@0/特殊助動詞%F2@0
 う,811,811,9035,動詞,自立,*,*,五段・ラ行,体言接続特殊2,うる,ウ,ウ,0/1,C4
 うーむ,3,3,4772,感動詞,*,*,*,*,*,うーむ,ウーム,ウーム,1/3,C2
 うーろんちゃ,1345,1345,7433,名詞,一般,*,*,*,*,うーろんちゃ,ウーロンチャ,ウーロンチャ,0/5,C2
@@ -67688,8 +67701,6 @@
 でしゃばん,809,809,8251,動詞,自立,*,*,五段・ラ行,体言接続特殊,でしゃばる,デシャバン,デシャバン,2/4,C1
 でしゃばん,817,817,8251,動詞,自立,*,*,五段・ラ行,未然特殊,でしゃばる,デシャバン,デシャバン,2/4,C1
 でしょ,488,488,3623,助動詞,*,*,*,特殊・デス,未然形,です,デショ,デショ,0/3,形容詞%F2@-1/動詞%F2@0/動詞%F2@0
-でしょう,488,488,3623,助動詞,*,*,*,特殊・デス,未然形,です,デショウ,デショー,0/4,形容詞%F2@-1/動詞%F2@0/動詞%F2@0
-でしょう,488,488,3623,助動詞,*,*,*,特殊・デス,未然形,です,デショウ,デショー,2/3,形容詞%F2@-1/動詞%F2@0/動詞%F2@0
 です,485,485,3489,助動詞,*,*,*,特殊・デス,基本形,です,デス,デス,0/2,名詞%F2@1/動詞%F1/形容詞%F2@0
 ですから,580,580,4798,接続詞,*,*,*,*,*,ですから,デスカラ,デスカラ,1/4,*
 ですが,580,580,4735,接続詞,*,*,*,*,*,ですが,デスガ,デスガ,1/3,*
@@ -95652,7 +95663,6 @@
 ましょ,518,518,5052,助動詞,*,*,*,特殊・マス,未然ウ接続,ます,マショ,マショ,0/3,動詞%F4@1
 ましょ,610,610,8228,動詞,自立,*,*,サ変・−スル,未然ウ接続,まする,マショ,マショ,2/2,C1
 ましょう,1345,1345,7457,名詞,一般,*,*,*,*,ましょう,マショウ,マショー,0/3,C2
-ましょう,516,516,4383,助動詞,*,*,*,特殊・マス,基本形,ます,マショウ,マショー,2/3,動詞%F4@1
 ましよ,610,610,8292,動詞,自立,*,*,サ変・−スル,未然ウ接続,まする,マシヨ,マシヨ,3/3,C1
 ましら,1345,1345,7496,名詞,一般,*,*,*,*,ましら,マシラ,マシラ,0/3,C2
 ましろ,613,613,8292,動詞,自立,*,*,サ変・−スル,命令ro,まする,マシロ,マシロ,2/3,C1
@@ -127140,6 +127150,7 @@
 テクノエース,1352,1352,4841,名詞,固有名詞,組織,*,*,*,テクノエース,テクノエース,テクノエース,4/6,C1
 テクノエイト,1352,1352,4841,名詞,固有名詞,組織,*,*,*,テクノエイト,テクノエイト,テクノエイト,4/6,C1
 テクノクラート,1345,1345,3452,名詞,一般,*,*,*,*,テクノクラート,テクノクラート,テクノクラート,5/7,C1
+テクノスピーチ,1348,1348,698,名詞,固有名詞,一般,*,*,*,テクノスピーチ,テクノスピーチ,テクノスピーチ,5/7,C1
 テクノセンター,1352,1352,4841,名詞,固有名詞,組織,*,*,*,テクノセンター,テクノセンター,テクノセンター,4/7,C1
 テクノネット,1352,1352,4841,名詞,固有名詞,組織,*,*,*,テクノネット,テクノネット,テクノネット,4/6,C1
 テクノパーク,1353,1353,4350,名詞,固有名詞,地域,一般,*,*,テクノパーク,テクノパーク,テクノパーク,4/6,C1
@@ -139807,6 +139818,7 @@
 愛憐,1345,1345,5746,名詞,一般,*,*,*,*,愛憐,アイレン,アイレン,0/4,C2
 愛和産業,1352,1352,6973,名詞,固有名詞,組織,*,*,*,愛和産業,アイワサンギョウ,アイワサンギョー,4/7,C1
 愛嬌,1345,1345,5746,名詞,一般,*,*,*,*,愛嬌,アイキョウ,アイキョー,3/4,C2
+愛莉,1351,1351,2210,名詞,固有名詞,人名,名,*,*,愛莉,アイリ,アイリ,0/3,C1
 愛誦,1343,1343,4420,名詞,サ変接続,*,*,*,*,愛誦,アイショウ,アイショー,0/4,C2
 愛迪生,1349,1349,7464,名詞,固有名詞,人名,一般,*,*,愛迪生,アイテキセイ,アイテキセイ,3/6,C1
 挨拶,1343,1343,4397,名詞,サ変接続,*,*,*,*,挨拶,アイサツ,アイサツ,1/4,C1
@@ -154440,6 +154452,7 @@
 瑛一,1351,1351,8157,名詞,固有名詞,人名,名,*,*,瑛一,エイイチ,エイイチ,0/4,C1
 瑛子,1351,1351,7807,名詞,固有名詞,人名,名,*,*,瑛子,エイコ,エイコ,1/3,C1
 瑛世,1351,1351,8204,名詞,固有名詞,人名,名,*,*,瑛世,アキヨ,アキヨ,0/3,C1
+瑛太,1351,1351,2210,名詞,固有名詞,人名,名,*,*,瑛太,エイタ,エータ,1/3,C1
 瑛二,1351,1351,8103,名詞,固有名詞,人名,名,*,*,瑛二,エイジ,エイジ,1/3,C2
 瑛美,1351,1351,8255,名詞,固有名詞,人名,名,*,*,瑛美,エミ,エミ,1/2,C4
 盈,1351,1351,8213,名詞,固有名詞,人名,名,*,*,盈,ミツル,ミツル,0/3,C2
@@ -167538,6 +167551,7 @@
 花屋敷山手,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,花屋敷山手,ハナヤシキヤマテ,ハナヤシキヤマテ,3/5,C1
 花屋敷松ガ丘,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,花屋敷松ガ丘,ハナヤシキマツガオカ,ハナヤシキマツガオカ,8/10,C1
 花屋敷荘園,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,花屋敷荘園,ハナヤシキソウエン,ハナヤシキソーエン,6/9,C1
+花音,1351,1351,2210,名詞,固有名詞,人名,名,*,*,花音,カノン,カノン,1/3,C1
 花夏,1351,1351,8304,名詞,固有名詞,人名,名,*,*,花夏,カナツ,カナツ,0/3,C2
 花嫁,1345,1345,5316,名詞,一般,*,*,*,*,花嫁,ハナヨメ,ハナヨメ,2/4,C1
 花嫁御寮,1345,1345,5746,名詞,一般,*,*,*,*,花嫁御寮,ハナヨメゴリョウ,ハナヨメゴリョー,5/7,C1
@@ -170856,6 +170870,7 @@
 海田西,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,海田西,カイダニシ,カイダニシ,1/5,C1
 海田東,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,海田東,カイダヒガシ,カイダヒガシ,4/6,C1
 海田南,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,海田南,カイダミナミ,カイダミナミ,4/6,C1
+海斗,1351,1351,2210,名詞,固有名詞,人名,名,*,*,海斗,カイト,カイト,1/3,C1
 海渡,1353,1353,8491,名詞,固有名詞,地域,一般,*,*,海渡,ウト,ウト,0/2,C3
 海土路,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,海土路,ミドロ,ミドロ,1/3,C2
 海島,1350,1350,7521,名詞,固有名詞,人名,姓,*,*,海島,ウミシマ,ウミシマ,0/4,C2
@@ -186026,6 +186041,7 @@
 貴代子,1351,1351,8196,名詞,固有名詞,人名,名,*,*,貴代子,キヨコ,キヨコ,1/3,C1
 貴代美,1351,1351,8226,名詞,固有名詞,人名,名,*,*,貴代美,キヨミ,キヨミ,0/3,C2
 貴台,1345,1345,5747,名詞,一般,*,*,*,*,貴台,キダイ,キダイ,1/3,C1
+貴大,1351,1351,2210,名詞,固有名詞,人名,名,*,*,貴大,タカヒロ,タカヒロ,2/4,C1
 貴宅,1345,1345,5743,名詞,一般,*,*,*,*,貴宅,キタク,キタク,0/3,C1
 貴男,1351,1351,8178,名詞,固有名詞,人名,名,*,*,貴男,タカオ,タカオ,0/3,C2
 貴地,1345,1345,5760,名詞,一般,*,*,*,*,貴地,キチ,キチ,1/2,C3
@@ -198381,6 +198397,7 @@
 琴引鼻,1348,1348,8609,名詞,固有名詞,一般,*,*,*,琴引鼻,コトヒキノハナ,コトヒキノハナ,5/7,C1
 琴浦,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,琴浦,コトウラ,コトウラ,2/4,C1
 琴岡,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,琴岡,コトオカ,コトオカ,2/4,C1
+琴音,1351,1351,2210,名詞,固有名詞,人名,名,*,*,琴音,コトネ,コトネ,0/3,C1
 琴歌,1345,1345,5746,名詞,一般,*,*,*,*,琴歌,コトウタ,コトウタ,2/4,C1
 琴海,1351,1351,8310,名詞,固有名詞,人名,名,*,*,琴海,コトミ,コトミ,1/3,C1
 琴海,1353,1353,8557,名詞,固有名詞,地域,一般,*,*,琴海,キンカイ,キンカイ,0/4,C2
@@ -207708,6 +207725,7 @@
 結婚,1343,1343,5028,名詞,サ変接続,*,*,*,*,結婚,ケッコン,ケッコン,0/4,C2
 結婚式,1345,1345,5097,名詞,一般,*,*,*,*,結婚式,ケッコンシキ,ケッコンシキ,3/6,C1
 結佐,1353,1353,8571,名詞,固有名詞,地域,一般,*,*,結佐,ケッサ,ケッサ,1/3,C2
+結菜,1351,1351,2210,名詞,固有名詞,人名,名,*,*,結菜,ユナ,ユナ,1/2,C1
 結崎,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,結崎,ユウザキ,ユーザキ,1/4,C1
 結子,1351,1351,8085,名詞,固有名詞,人名,名,*,*,結子,ユウコ,ユーコ,1/3,C1
 結実,1343,1343,4406,名詞,サ変接続,*,*,*,*,結実,ケツジツ,ケツジツ,0/4,C2
@@ -297528,6 +297546,7 @@
 心無し,24,24,4452,形容詞,自立,*,*,形容詞・アウオ段,文語基本形,心無い,ココロナシ,ココロナシ,4/5,C1
 心木,1345,1345,5771,名詞,一般,*,*,*,*,心木,シンギ,シンギ,1/3,C1
 心野,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,心野,ココンノ,ココンノ,0/4,C2
+心優,1351,1351,2210,名詞,固有名詞,人名,名,*,*,心優,ミユ,ミユ,1/2,C1
 心友,1345,1345,5744,名詞,一般,*,*,*,*,心友,シンユウ,シンユー,0/4,C2
 心憂,12,12,5504,形容詞,自立,*,*,形容詞・アウオ段,ガル接続,心憂い,ココロウ,ココロウ,4/4,C1
 心憂い,20,20,4901,形容詞,自立,*,*,形容詞・アウオ段,基本形,心憂い,ココロウイ,ココロウイ,4/5,C1
@@ -312419,6 +312438,7 @@
 正崎,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,正崎,ショウザキ,ショーザキ,1/4,C1
 正策,1351,1351,8305,名詞,固有名詞,人名,名,*,*,正策,ショウサク,ショーサク,0/4,C2
 正札,1345,1345,5737,名詞,一般,*,*,*,*,正札,ショウフダ,ショーフダ,0/4,C2
+正三,1351,1351,2210,名詞,固有名詞,人名,名,*,*,正三,ショウゾウ,ショーゾー,0/4,C1
 正三,1351,1351,8551,名詞,固有名詞,人名,名,*,*,正三,ショウサン,ショーサン,0/4,C2
 正三角形,1345,1345,5746,名詞,一般,*,*,*,*,正三角形,セイサンカッケイ,セイサンカッケイ,5/8,C1
 正三郎,1351,1351,7896,名詞,固有名詞,人名,名,*,*,正三郎,ショウザブロウ,ショーザブロー,0/6,C1
@@ -312437,6 +312457,7 @@
 正字,1345,1345,4898,名詞,一般,*,*,*,*,正字,セイジ,セイジ,0/3,C2
 正時,1351,1351,8304,名詞,固有名詞,人名,名,*,*,正時,マサトキ,マサトキ,1/4,C1
 正次,1351,1351,8304,名詞,固有名詞,人名,名,*,*,正次,マサツグ,マサツグ,2/4,C1
+正治,1351,1351,2210,名詞,固有名詞,人名,名,*,*,正治,マサハル,マサハル,2/4,C1
 正治,1351,1351,7503,名詞,固有名詞,人名,名,*,*,正治,ショウジ,ショージ,1/3,C2
 正治,1351,1351,8789,名詞,固有名詞,人名,名,*,*,正治,マサハル,マサハル,0/4,C1
 正爾,1351,1351,7844,名詞,固有名詞,人名,名,*,*,正爾,ショウジ,ショージ,1/3,C2
@@ -336626,6 +336647,7 @@
 蒼海,1345,1345,5273,名詞,一般,*,*,*,*,蒼海,ソウカイ,ソーカイ,0/4,C2
 蒼久保,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,蒼久保,アオクボ,アオクボ,0/4,C2
 蒼空,1345,1345,5746,名詞,一般,*,*,*,*,蒼空,ソウクウ,ソークー,0/4,C2
+蒼空,1351,1351,2210,名詞,固有名詞,人名,名,*,*,蒼空,ソラ,ソラ,1/2,C1
 蒼古,1345,1345,5745,名詞,一般,*,*,*,*,蒼古,ソウコ,ソーコ,1/3,C1
 蒼枯,1345,1345,5745,名詞,一般,*,*,*,*,蒼枯,ソウコ,ソーコ,1/3,C1
 蒼梧,1351,1351,8304,名詞,固有名詞,人名,名,*,*,蒼梧,ソウゴ,ソーゴ,1/3,C1
@@ -345663,6 +345685,7 @@
 大気,1345,1345,5006,名詞,一般,*,*,*,*,大気,タイキ,タイキ,1/3,C1
 大気圏,1345,1345,5746,名詞,一般,*,*,*,*,大気圏,タイキケン,タイキケン,3/5,C1
 大紀アルミニウム工業所,1352,1352,6973,名詞,固有名詞,組織,*,*,*,大紀アルミニウム工業所,ダイキアルミニウムコウギョウショ,ダイキアルミニュームコーギョーショ,0/14,C1
+大貴,1351,1351,2210,名詞,固有名詞,人名,名,*,*,大貴,ダイキ,ダイキ,1/3,C1
 大起,1351,1351,8037,名詞,固有名詞,人名,名,*,*,大起,ダイキ,ダイキ,1/3,C2
 大輝,1351,1351,7537,名詞,固有名詞,人名,名,*,*,大輝,ダイキ,ダイキ,1/3,C2
 大輝,1351,1351,8633,名詞,固有名詞,人名,名,*,*,大輝,オオテル,オーテル,1/4,C2
@@ -349827,6 +349850,7 @@
 大籠,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,大籠,オオゴモリ,オーゴモリ,3/5,C1
 大簗,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,大簗,オオヤナ,オーヤナ,0/4,C2
 大籏屋,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,大籏屋,オオハタヤ,オーハタヤ,0/5,C1
+大翔,1351,1351,2210,名詞,固有名詞,人名,名,*,*,大翔,ヒロト,ヒロト,1/3,C1
 大薊山,1348,1348,8609,名詞,固有名詞,一般,*,*,*,大薊山,オオアザミヤマ,オーアザミヤマ,0/7,C1
 大藪,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,大藪,オオヤブ,オーヤブ,0/4,C1
 大藏,1353,1353,8465,名詞,固有名詞,地域,一般,*,*,大藏,オオクラ,オークラ,0/4,C2
@@ -350617,6 +350641,7 @@
 拓ろ,650,650,6963,動詞,自立,*,*,一段,命令ro,拓る,ヒラケロ,ヒラケロ,3/4,C1
 拓ん,647,647,6963,動詞,自立,*,*,一段,体言接続特殊,拓る,ヒラケン,ヒラケン,3/4,C1
 拓栄,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,拓栄,タクエイ,タクエイ,0/4,C2
+拓海,1351,1351,2210,名詞,固有名詞,人名,名,*,*,拓海,タクミ,タクミ,0/3,C1
 拓海,1353,1353,9057,名詞,固有名詞,地域,一般,*,*,拓海,タクミ,タクミ,0/3,C2
 拓哉,1351,1351,8304,名詞,固有名詞,人名,名,*,*,拓哉,タクヤ,タクヤ,1/3,C2
 拓三,1351,1351,8303,名詞,固有名詞,人名,名,*,*,拓三,タクゾウ,タクゾー,0/4,C2
@@ -413899,6 +413924,7 @@
 美弥妃,1351,1351,8330,名詞,固有名詞,人名,名,*,*,美弥妃,ミヤビ,ミヤビ,1/3,C2
 美矢子,1351,1351,8882,名詞,固有名詞,人名,名,*,*,美矢子,ミヤコ,ミヤコ,1/3,C2
 美佑,1351,1351,8304,名詞,固有名詞,人名,名,*,*,美佑,ミユ,ミユ,1/2,C3
+美優,1351,1351,2210,名詞,固有名詞,人名,名,*,*,美優,ミユ,ミユ,1/2,C1
 美優,1351,1351,8304,名詞,固有名詞,人名,名,*,*,美優,ミユ,ミユ,1/2,C3
 美優,1351,1351,8304,名詞,固有名詞,人名,名,*,*,美優,ミユウ,ミユー,1/3,C2
 美憂,1351,1351,8304,名詞,固有名詞,人名,名,*,*,美憂,ミユ,ミユ,1/2,C3
@@ -414643,6 +414669,7 @@
 百科全書,1345,1345,4908,名詞,一般,*,*,*,*,百科全書,ヒャッカゼンショ,ヒャッカゼンショ,4/6,C1
 百箇日,1345,1345,4908,名詞,一般,*,*,*,*,百箇日,ヒャッカニチ,ヒャッカニチ,3/5,C1
 百花,1345,1345,4743,名詞,一般,*,*,*,*,百花,ヒャッカ,ヒャッカ,1/3,C1
+百花,1351,1351,2210,名詞,固有名詞,人名,名,*,*,百花,モモカ,モモカ,1/3,C1
 百花りょう乱,1345,1345,4908,名詞,一般,*,*,*,*,百花りょう乱,ヒャッカリョウラン,ヒャッカリョーラン,1/7,C1
 百花繚乱,1345,1345,4908,名詞,一般,*,*,*,*,百花繚乱,ヒャッカリョウラン,ヒャッカリョーラン,1/7,C1
 百貨,1345,1345,4889,名詞,一般,*,*,*,*,百貨,ヒャッカ,ヒャッカ,1/3,C1
@@ -430613,6 +430640,7 @@
 歩幅,1345,1345,5727,名詞,一般,*,*,*,*,歩幅,ホハバ,ホハバ,0/3,C2
 歩兵,1345,1345,5746,名詞,一般,*,*,*,*,歩兵,ホヘイ,ホヘイ,0/3,C2
 歩歩,1341,1341,5175,副詞,一般,*,*,*,*,歩歩,ホホ,ホホ,1/2,*
+歩夢,1351,1351,2210,名詞,固有名詞,人名,名,*,*,歩夢,アユム,アユム,0/3,C1
 歩留まり,1345,1345,5746,名詞,一般,*,*,*,*,歩留まり,ブドマリ,ブドマリ,2/4,C1
 歩留り,1345,1345,5746,名詞,一般,*,*,*,*,歩留り,ブドマリ,ブドマリ,2/4,C1
 歩廊,1345,1345,5746,名詞,一般,*,*,*,*,歩廊,ホロウ,ホロー,0/3,C2
@@ -451700,6 +451728,7 @@
 悠遠,1347,1347,4640,名詞,形容動詞語幹,*,*,*,*,悠遠,ユウエン,ユーエン,0/4,C2
 悠花,1351,1351,8443,名詞,固有名詞,人名,名,*,*,悠花,ユウカ,ユーカ,1/3,C1
 悠閑堂,1352,1352,6973,名詞,固有名詞,組織,*,*,*,悠閑堂,ユウカンドウ,ユーカンドー,0/6,C1
+悠希,1351,1351,2210,名詞,固有名詞,人名,名,*,*,悠希,ユウキ,ユーキ,1/3,C1
 悠紀,1351,1351,8402,名詞,固有名詞,人名,名,*,*,悠紀,ユキ,ユキ,1/2,C3
 悠紀子,1351,1351,8393,名詞,固有名詞,人名,名,*,*,悠紀子,ユキコ,ユキコ,1/3,C1
 悠紀雄,1351,1351,7949,名詞,固有名詞,人名,名,*,*,悠紀雄,ユキオ,ユキオ,0/3,C1
@@ -451711,6 +451740,8 @@
 悠作,1351,1351,8296,名詞,固有名詞,人名,名,*,*,悠作,ユウサク,ユーサク,0/4,C2
 悠司,1351,1351,8304,名詞,固有名詞,人名,名,*,*,悠司,ユウジ,ユージ,1/3,C1
 悠子,1351,1351,8085,名詞,固有名詞,人名,名,*,*,悠子,ユウコ,ユーコ,1/3,C1
+悠真,1351,1351,2210,名詞,固有名詞,人名,名,*,*,悠真,ユウマ,ユーマ,1/3,C1
+悠人,1351,1351,2210,名詞,固有名詞,人名,名,*,*,悠人,ユウト,ユート,1/3,C1
 悠然,1345,1345,5746,名詞,一般,*,*,*,*,悠然,ユウゼン,ユーゼン,0/4,C2
 悠然と,1341,1341,5066,副詞,一般,*,*,*,*,悠然と,ユウゼント,ユーゼント,0/5,*
 悠太,1351,1351,8303,名詞,固有名詞,人名,名,*,*,悠太,ユウタ,ユータ,1/3,C1
@@ -455992,9 +456023,11 @@
 陽光園,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,陽光園,ヨウコウエン,ヨーコーエン,3/6,C1
 陽光太上天皇,1349,1349,7464,名詞,固有名詞,人名,一般,*,*,陽光太上天皇,ヨウコウダイジョウテンノウ,ヨーコーダイジョーテンノー,11/12,C1
 陽光台,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,陽光台,ヨウコウダイ,ヨーコーダイ,3/6,C1
+陽向,1351,1351,2210,名詞,固有名詞,人名,名,*,*,陽向,ヒナタ,ヒナタ,1/3,C1
 陽香,1351,1351,8304,名詞,固有名詞,人名,名,*,*,陽香,ヒロカ,ヒロカ,1/3,C1
 陽香,1351,1351,8373,名詞,固有名詞,人名,名,*,*,陽香,ヨウカ,ヨーカ,1/3,C1
 陽刻,1345,1345,5746,名詞,一般,*,*,*,*,陽刻,ヨウコク,ヨーコク,0/4,C2
+陽菜,1351,1351,2210,名詞,固有名詞,人名,名,*,*,陽菜,ヒナ,ヒナ,1/2,C1
 陽皐,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,陽皐,ヒサワ,ヒサワ,0/3,C1
 陽三,1351,1351,8494,名詞,固有名詞,人名,名,*,*,陽三,ヨウゾウ,ヨーゾー,0/4,C2
 陽司,1351,1351,8276,名詞,固有名詞,人名,名,*,*,陽司,ヨウジ,ヨージ,1/3,C2
@@ -456018,6 +456051,7 @@
 陽田,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,陽田,ヨウデン,ヨーデン,1/4,C2
 陽電気,1345,1345,5746,名詞,一般,*,*,*,*,陽電気,ヨウデンキ,ヨーデンキ,3/5,C1
 陽電子,1345,1345,5745,名詞,一般,*,*,*,*,陽電子,ヨウデンシ,ヨーデンシ,3/5,C1
+陽斗,1351,1351,2210,名詞,固有名詞,人名,名,*,*,陽斗,ハルト,ハルト,1/3,C1
 陽東,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,陽東,ヨウトウ,ヨートー,0/4,C2
 陽動,1345,1345,5746,名詞,一般,*,*,*,*,陽動,ヨウドウ,ヨードー,0/4,C2
 陽南,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,陽南,ヨウナン,ヨーナン,0/4,C2
@@ -466238,6 +466272,7 @@
 聯立,1343,1343,4396,名詞,サ変接続,*,*,*,*,聯立,レンリツ,レンリツ,0/4,C2
 蓮,1345,1345,5747,名詞,一般,*,*,*,*,蓮,ハチス,ハチス,0/3,C2
 蓮,1345,1345,5768,名詞,一般,*,*,*,*,蓮,ハス,ハス,0/2,C3
+蓮,1351,1351,2210,名詞,固有名詞,人名,名,*,*,蓮,レン,レン,1/2,C1
 蓮,1351,1351,8502,名詞,固有名詞,人名,名,*,*,蓮,レン,レン,0/2,C3
 蓮,1353,1353,8563,名詞,固有名詞,地域,一般,*,*,蓮,ハチス,ハチス,0/3,C2
 蓮,1353,1353,8583,名詞,固有名詞,地域,一般,*,*,蓮,ハス,ハス,0/2,C3
@@ -478085,6 +478120,7 @@
 翔子,1351,1351,8619,名詞,固有名詞,人名,名,*,*,翔子,ショウコ,ショーコ,1/3,C1
 翔太,1351,1351,8303,名詞,固有名詞,人名,名,*,*,翔太,ショウタ,ショータ,1/3,C1
 翔破,1343,1343,4420,名詞,サ変接続,*,*,*,*,翔破,ショウハ,ショーハ,1/3,C1
+翔平,1351,1351,2210,名詞,固有名詞,人名,名,*,*,翔平,ショウヘイ,ショーヘー,1/2,C1
 翡翠,1345,1345,5746,名詞,一般,*,*,*,*,翡翠,カワセミ,カワセミ,0/4,C2
 翡翠,1345,1345,5746,名詞,一般,*,*,*,*,翡翠,ヒスイ,ヒスイ,0/3,C2
 翩ぽん,1345,1345,5746,名詞,一般,*,*,*,*,翩ぽん,ヘンポン,ヘンポン,0/4,C2
@@ -480670,9 +480706,12 @@
 顴骨,1345,1345,5746,名詞,一般,*,*,*,*,顴骨,ケンコツ,ケンコツ,1/4,C2
 顳,1345,1345,5746,名詞,一般,*,*,*,*,顳,コメカミ,コメカミ,0/4,C2
 颪,1345,1345,6018,名詞,一般,*,*,*,*,颪,オロシ,オロシ,3/3,C1
+颯,1351,1351,2210,名詞,固有名詞,人名,名,*,*,颯,ハヤテ,ハヤテ,1/3,C1
 颯々,1345,1345,5746,名詞,一般,*,*,*,*,颯々,サッサツ,サッサツ,0/4,C2
 颯と,1341,1341,4979,副詞,一般,*,*,*,*,颯と,サット,サット,1/3,*
+颯真,1351,1351,2210,名詞,固有名詞,人名,名,*,*,颯真,ソウマ,ソーマ,1/3,C1
 颯爽,1345,1345,5746,名詞,一般,*,*,*,*,颯爽,サッソウ,サッソー,0/4,C2
+颯太,1351,1351,2210,名詞,固有名詞,人名,名,*,*,颯太,ソウタ,ソータ,1/3,C1
 颯颯,1345,1345,5746,名詞,一般,*,*,*,*,颯颯,サッサツ,サッサツ,0/4,C2
 颱風,1345,1345,5712,名詞,一般,*,*,*,*,颱風,タイフウ,タイフー,3/4,C2
 颶風,1345,1345,5746,名詞,一般,*,*,*,*,颶風,グフウ,グフー,0/3,C2
@@ -481367,3 +481406,4 @@
 槇野地,1353,1353,8562,名詞,固有名詞,地域,一般,*,*,槇野地,マギノチ,マギノチ,2/4,C1
 遙堪,1353,1353,8565,名詞,固有名詞,地域,一般,*,*,遙堪,ヨウカン,ヨーカン,1/4,C1
 瑤泉院,1349,1349,7464,名詞,固有名詞,人名,一般,*,*,瑤泉院,ヨウゼイイン,ヨーゼイイン,3/6,C1
+凜,1351,1351,2210,名詞,固有名詞,人名,名,*,*,凜,リン,リン,1/2,C1
diff -Nru open-jtalk-1.04/njd_set_accent_type/njd_set_accent_type.c open-jtalk-1.05/njd_set_accent_type/njd_set_accent_type.c
--- open-jtalk-1.04/njd_set_accent_type/njd_set_accent_type.c	2011-07-07 11:14:54.000000000 +0900
+++ open-jtalk-1.05/njd_set_accent_type/njd_set_accent_type.c	2011-12-20 13:25:06.000000000 +0900
@@ -95,25 +95,27 @@
    char buff[MAXBUFLEN];
    char c = ' ';
 
-   while (c != '\0') {
-      c = get_token_from_string(input_rule, &index, buff);
-      if ((c == '%' && strstr(prev_pos, buff) != NULL) || c == '@' || c == '/' || c == '\0') {
-         /* find */
-         if (c == '%')
-            c = get_token_from_string(input_rule, &index, rule);
-         else
-            strcpy(rule, buff);
-         if (c == '@') {
-            c = get_token_from_string(input_rule, &index, buff);
-            (*add_type) = atoi(buff);
+   if (input_rule) {
+      while (c != '\0') {
+         c = get_token_from_string(input_rule, &index, buff);
+         if ((c == '%' && strstr(prev_pos, buff) != NULL) || c == '@' || c == '/' || c == '\0') {
+            /* find */
+            if (c == '%')
+               c = get_token_from_string(input_rule, &index, rule);
+            else
+               strcpy(rule, buff);
+            if (c == '@') {
+               c = get_token_from_string(input_rule, &index, buff);
+               (*add_type) = atoi(buff);
+            } else {
+               (*add_type) = 0;
+            }
+            return;
          } else {
-            (*add_type) = 0;
+            /* skip */
+            while (c == '%' || c == '@')
+               c = get_token_from_string(input_rule, &index, buff);
          }
-         return;
-      } else {
-         /* skip */
-         while (c == '%' || c == '@')
-            c = get_token_from_string(input_rule, &index, buff);
       }
    }
 
@@ -235,6 +237,7 @@
                 (strcmp(NJDNode_get_string(node->prev), NJD_SET_ACCENT_TYPE_ICHI) == 0 ||
                  strcmp(NJDNode_get_string(node->prev), NJD_SET_ACCENT_TYPE_ROKU) == 0 ||
                  strcmp(NJDNode_get_string(node->prev), NJD_SET_ACCENT_TYPE_NANA) == 0 ||
+                 strcmp(NJDNode_get_string(node->prev), NJD_SET_ACCENT_TYPE_HACHI) == 0 ||
                  strcmp(NJDNode_get_string(node->prev), NJD_SET_ACCENT_TYPE_IKU) == 0)) {
                NJDNode_set_acc(node->prev, 2);
             } else {
diff -Nru open-jtalk-1.04/njd_set_digit/njd_set_digit.c open-jtalk-1.05/njd_set_digit/njd_set_digit.c
--- open-jtalk-1.04/njd_set_digit/njd_set_digit.c	2011-07-07 11:14:54.000000000 +0900
+++ open-jtalk-1.05/njd_set_digit/njd_set_digit.c	2011-12-20 13:25:06.000000000 +0900
@@ -183,13 +183,35 @@
    int size = 0;
    int have = 0;
 
-   if (get_digit_sequence_score(start, end) < 0)
-      return;
-
    for (node = start; node != end->next; node = node->next)
       size++;
    if (size <= 1)
       return;
+
+   if (get_digit_sequence_score(start, end) < 0) {
+      for (node = start, size = 0; node != end->next; node = node->next) {
+         if (strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_ZERO) == 0) {
+            NJDNode_set_pron(node, NJD_SET_DIGIT_ZERO_AFTER_DP);
+            NJDNode_set_mora_size(node, 2);
+         } else if (strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_TWO) == 0) {
+            NJDNode_set_pron(node, NJD_SET_DIGIT_TWO_AFTER_DP);
+            NJDNode_set_mora_size(node, 2);
+         } else if (strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_FIVE) == 0) {
+            NJDNode_set_pron(node, NJD_SET_DIGIT_FIVE_AFTER_DP);
+            NJDNode_set_mora_size(node, 2);
+         }
+         NJDNode_set_chain_rule(node, NULL);
+         if (size % 2 == 0) {
+            NJDNode_set_chain_flag(node, 0);
+         } else {
+            NJDNode_set_chain_flag(node, 1);
+            NJDNode_set_acc(node->prev, 3);
+         }
+         size++;
+      }
+      return;
+   }
+
    index = size % 4;
    if (index == 0)
       index = 4;
@@ -341,55 +363,23 @@
    if (njd->head == NULL)
       return;
 
-   /* convert feature of a decimal point */
-   find = 0;
-   for (node = njd->head->next; node != NULL; node = node->next) {
-      if (NJDNode_get_string(node) != NULL) {
-         if (node->next != NULL &&
-             (strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_TEN1) == 0 ||
-              strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_TEN2) == 0) &&
-             strcmp(NJDNode_get_pos_group1(node->prev), NJD_SET_DIGIT_KAZU) == 0 &&
-             strcmp(NJDNode_get_pos_group1(node->next), NJD_SET_DIGIT_KAZU) == 0) {
-            NJDNode_load(node, NJD_SET_DIGIT_TEN_FEATURE);
-            NJDNode_set_chain_flag(node, 1);
-            find = 1;
-            if (NJDNode_get_string(node->prev) != NULL) {
-               if (strcmp(NJDNode_get_string(node->prev), NJD_SET_DIGIT_ZERO) == 0) {
-                  NJDNode_set_pron(node->prev, NJD_SET_DIGIT_ZERO_BEFORE_DP);
-                  NJDNode_set_mora_size(node->prev, 2);
-               } else if (strcmp(NJDNode_get_string(node->prev), NJD_SET_DIGIT_TWO) == 0) {
-                  NJDNode_set_pron(node->prev, NJD_SET_DIGIT_TWO_BEFORE_DP);
-                  NJDNode_set_mora_size(node->prev, 2);
-               } else if (strcmp(NJDNode_get_string(node->prev), NJD_SET_DIGIT_FIVE) == 0) {
-                  NJDNode_set_pron(node->prev, NJD_SET_DIGIT_FIVE_BEFORE_DP);
-                  NJDNode_set_mora_size(node->prev, 2);
-               }
-            }
-         } else if (find > 0) {
-            if (strcmp(NJDNode_get_pos_group1(node), NJD_SET_DIGIT_KAZU) == 0) {
-               if (strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_ZERO) == 0) {
-                  NJDNode_set_pron(node, NJD_SET_DIGIT_ZERO_AFTER_DP);
-                  NJDNode_set_mora_size(node, 2);
-               } else if (node->next == NULL ||
-                          (node->next != NULL &&
-                           strcmp(NJDNode_get_pos_group2(node->next),
-                                  NJD_SET_DIGIT_JOSUUSHI) != 0)) {
-                  if (strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_TWO) == 0) {
-                     NJDNode_set_pron(node, NJD_SET_DIGIT_TWO_AFTER_DP);
-                     NJDNode_set_mora_size(node, 2);
-                  } else if (strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_FIVE) == 0) {
-                     NJDNode_set_pron(node, NJD_SET_DIGIT_FIVE_AFTER_DP);
-                     NJDNode_set_mora_size(node, 2);
-                  }
-               }
-               if (find % 2 == 1)
-                  NJDNode_set_chain_flag(node, 0);
-               else
-                  NJDNode_set_chain_flag(node, 1);
-               find++;
-            } else {
-               find = 0;
-            }
+   for (node = njd->head->next; node != NULL && node->next != NULL; node = node->next) {
+      if (NJDNode_get_string(node) != NULL && NJDNode_get_string(node->prev) != NULL
+          && (strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_TEN1) == 0
+              || strcmp(NJDNode_get_string(node), NJD_SET_DIGIT_TEN2) == 0)
+          && strcmp(NJDNode_get_pos_group1(node->prev), NJD_SET_DIGIT_KAZU) == 0
+          && strcmp(NJDNode_get_pos_group1(node->next), NJD_SET_DIGIT_KAZU) == 0) {
+         NJDNode_load(node, NJD_SET_DIGIT_TEN_FEATURE);
+         NJDNode_set_chain_flag(node, 1);
+         if (strcmp(NJDNode_get_string(node->prev), NJD_SET_DIGIT_ZERO) == 0) {
+            NJDNode_set_pron(node->prev, NJD_SET_DIGIT_ZERO_BEFORE_DP);
+            NJDNode_set_mora_size(node->prev, 2);
+         } else if (strcmp(NJDNode_get_string(node->prev), NJD_SET_DIGIT_TWO) == 0) {
+            NJDNode_set_pron(node->prev, NJD_SET_DIGIT_TWO_BEFORE_DP);
+            NJDNode_set_mora_size(node->prev, 2);
+         } else if (strcmp(NJDNode_get_string(node->prev), NJD_SET_DIGIT_FIVE) == 0) {
+            NJDNode_set_pron(node->prev, NJD_SET_DIGIT_FIVE_BEFORE_DP);
+            NJDNode_set_mora_size(node->prev, 2);
          }
       }
    }
diff -Nru open-jtalk-1.04/njd_set_digit/njd_set_digit_rule_euc_jp.h open-jtalk-1.05/njd_set_digit/njd_set_digit_rule_euc_jp.h
--- open-jtalk-1.04/njd_set_digit/njd_set_digit_rule_euc_jp.h	2011-07-07 11:14:54.000000000 +0900
+++ open-jtalk-1.05/njd_set_digit/njd_set_digit_rule_euc_jp.h	2011-12-20 13:25:06.000000000 +0900
@@ -60,9 +60,9 @@
 #define NJD_SET_DIGIT_KAKKO1 "\A1\CA"
 #define NJD_SET_DIGIT_KAKKO2 "\A1\CB"
 #define NJD_SET_DIGIT_BANGOU "\C8ֹ\E6"
-#define NJD_SET_DIGIT_TEN1 "\A1\A6"
-#define NJD_SET_DIGIT_TEN2 "\A1\A5"
-#define NJD_SET_DIGIT_TEN_FEATURE "\A1\A5,̾\BB\EC,\C0\DC\C8\F8,\BD\F5\BF\F4\BB\EC,*,*,*,\A1\A5,\A5ƥ\F3,\A5ƥ\F3,1/2,*,-1"
+#define NJD_SET_DIGIT_TEN1 "\A1\A5"
+#define NJD_SET_DIGIT_TEN2 "\A1\A6"
+#define NJD_SET_DIGIT_TEN_FEATURE "\A1\A5,̾\BB\EC,\C0\DC\C8\F8,\BD\F5\BF\F4\BB\EC,*,*,*,\A1\A5,\A5ƥ\F3,\A5ƥ\F3,0/2,*,-1"
 #define NJD_SET_DIGIT_ZERO "\A1\BB"
 #define NJD_SET_DIGIT_ZERO_BEFORE_DP "\A5졼"
 #define NJD_SET_DIGIT_ZERO_AFTER_DP "\A5\BC\A5\ED"
diff -Nru open-jtalk-1.04/njd_set_digit/njd_set_digit_rule_shift_jis.h open-jtalk-1.05/njd_set_digit/njd_set_digit_rule_shift_jis.h
--- open-jtalk-1.04/njd_set_digit/njd_set_digit_rule_shift_jis.h	2011-07-07 11:14:54.000000000 +0900
+++ open-jtalk-1.05/njd_set_digit/njd_set_digit_rule_shift_jis.h	2011-12-20 13:25:07.000000000 +0900
@@ -60,9 +60,9 @@
 #define NJD_SET_DIGIT_KAKKO1 "\81i"
 #define NJD_SET_DIGIT_KAKKO2 "\81j"
 #define NJD_SET_DIGIT_BANGOU "\94ԍ\86"
-#define NJD_SET_DIGIT_TEN1 "\81E"
-#define NJD_SET_DIGIT_TEN2 "\81D"
-#define NJD_SET_DIGIT_TEN_FEATURE "\81D,\96\BC\8E\8C,\90ڔ\F6,\8F\95\90\94\8E\8C,*,*,*,\81D,\83e\83\93,\83e\83\93,1/2,*,-1"
+#define NJD_SET_DIGIT_TEN1 "\81D"
+#define NJD_SET_DIGIT_TEN2 "\81E"
+#define NJD_SET_DIGIT_TEN_FEATURE "\81D,\96\BC\8E\8C,\90ڔ\F6,\8F\95\90\94\8E\8C,*,*,*,\81D,\83e\83\93,\83e\83\93,0/2,*,-1"
 #define NJD_SET_DIGIT_ZERO "\81Z"
 #define NJD_SET_DIGIT_ZERO_BEFORE_DP "\83\8C\81["
 #define NJD_SET_DIGIT_ZERO_AFTER_DP "\83[\83\8D"
diff -Nru open-jtalk-1.04/njd_set_digit/njd_set_digit_rule_utf_8.h open-jtalk-1.05/njd_set_digit/njd_set_digit_rule_utf_8.h
--- open-jtalk-1.04/njd_set_digit/njd_set_digit_rule_utf_8.h	2011-07-07 11:14:54.000000000 +0900
+++ open-jtalk-1.05/njd_set_digit/njd_set_digit_rule_utf_8.h	2011-12-20 13:25:07.000000000 +0900
@@ -60,9 +60,9 @@
 #define NJD_SET_DIGIT_KAKKO1 "("
 #define NJD_SET_DIGIT_KAKKO2 ")"
 #define NJD_SET_DIGIT_BANGOU "番号"
-#define NJD_SET_DIGIT_TEN1 "・"
-#define NJD_SET_DIGIT_TEN2 "."
-#define NJD_SET_DIGIT_TEN_FEATURE ".,名詞,接尾,助数詞,*,*,*,.,テン,テン,1/2,*,-1"
+#define NJD_SET_DIGIT_TEN1 "."
+#define NJD_SET_DIGIT_TEN2 "・"
+#define NJD_SET_DIGIT_TEN_FEATURE ".,名詞,接尾,助数詞,*,*,*,.,テン,テン,0/2,*,-1"
 #define NJD_SET_DIGIT_ZERO "〇"
 #define NJD_SET_DIGIT_ZERO_BEFORE_DP "レー"
 #define NJD_SET_DIGIT_ZERO_AFTER_DP "ゼロ"