[gtalk-dev 0024] CVS update: gtalk

Zurück zum Archiv-Index

galat****@lists***** galat****@lists*****
2009年 2月 13日 (金) 02:43:42 JST


Index: gtalk/Changelog
diff -u gtalk/Changelog:1.42 gtalk/Changelog:1.43
--- gtalk/Changelog:1.42	Thu Jul 12 16:47:53 2007
+++ gtalk/Changelog	Fri Feb 13 02:43:42 2009
@@ -1,8 +1,27 @@
-変更点 gtalk-061010 -> gtalk-070712
+変更点 gtalk-070712 -> gtalk-080731
+・APBのタグに対応 ("Unknown tag ... 'APB'" が表示されるバグをフィックス)
+・Windows版で "Tag error ... /W1" が表示されるバグをフィックス
+・WAV形式でのファイルの書き出し・読み込みの機能を追加
+	Set SaveWAV = ファイル名
+	Set LoadWAV = ファイル名
+・RAW形式でのファイルの書き出し・読み込みのスロット名を以下に変更
+	Set SaveRAW = ファイル名
+	Set LoadRAW = ファイル名
+  ただし,従来の
+	Set Save = ファイル名
+	Set SpeechFile = ファイル名
+  も使えるよう,残してある。
+・韻律情報ファイルの読み込みのスロット名を以下に変更
+	Set LoadPros = ファイル名
+  ただし,従来の
+	Set ProsFile = ファイル名
+  も使えるよう,残してある。
+===============================================================================
+変更点 gtalk-070216 -> gtalk-070712
 ・unidic-1.3.0(公開版)に対応
 ・ProsEditの音素時間長修正に対応
 ===============================================================================
-変更点 gtalk-061010 -> gtalk-070216
+変更点 gtalk-061013 -> gtalk-070216
 ・unidic-1.3.0に対応
 ・(指定した範囲からずれてしまう)タグ処理の修正
 ===============================================================================
Index: gtalk/README
diff -u gtalk/README:1.39 gtalk/README:1.40
--- gtalk/README:1.39	Fri Oct 13 18:44:44 2006
+++ gtalk/README	Fri Feb 13 02:43:42 2009
@@ -1,6 +1,6 @@
 
 GalateaTalk: Speech synthesis module for Galatea
-                                                               2006.10.13
+                                                               2008.7.31
 ------------------------------------------------------------------------
 
 GalateaTalk は Galetea システムの音声合成モジュール (SSM) として動作します。
@@ -10,8 +10,8 @@
 =============
 
 音声合成システムのソースパッケージを適当なディレクトリにコピーし、
-    tar zxfv gtalk-061013.tar.gz
-    cd gtalk-061013
+    tar zxfv gtalk-080731.tar.gz
+    cd gtalk-080731
     ./configure
     make
 でコンパイルし、合成モジュールの実行プログラム gtalk を作成する。
@@ -35,7 +35,7 @@
 2.2.1 形態素解析プログラム chasen [CHASEN]
   音声合成プログラムが内部でテキスト解析を行なうために、形態素解析
 システム chasen を内部で呼び出して用いている。chasen-2.3.3 以上が
-必要である。さらに辞書データとして unidic-1.1.2 以上が必要である。
+必要である。さらに辞書データとして unidic-1.3.0 以上が必要である。
   [ ] 内は、設定ファイル中での変数名で、以下同様。
 
 2.2.2 chasen のライブラリ [CHASEN-DLL] (Windows版のみ有効)
@@ -48,7 +48,7 @@
 
 2.3.1 ChaOne [CHAONE]
   複合語・音韻交替処理プログラム chaone のパスを指定する。
- アクセント句の生成を行う chaone-1.2.0 以上の ChaOne が必要である。
+ アクセント句の生成を行う chaone-1.3.2 以上の ChaOne が必要である。
 
 2.3.2 XML ファイルへのパス [CHAONE-XSL-FILE] (chaone組み込み版のみ有効)
  chaone が用いる XML ファイルを指定する。
@@ -100,17 +100,16 @@
     CHASEN: /usr/local/bin/chasen
 
     # path name of 'libchasen.dll' (only for Windows)
-    CHASEN-DLL:  ../chasen-2.3.3/lib/libchasen.dll
+    CHASEN-DLL:  ../chasen-2.4.1/lib/libchasen.dll
 
     # configuration file for 'chasen'
     CHASEN-RC: ./chasenrc
 
     # command of running 'chaone'
-    CHAONE: ../morph/chaone-1.2.0/chaone
-    #CHAONE: 
+    CHAONE: ../morph/chaone-1.3.2/chaone
 
     # path name of 'chaone.xsl' (only for Windows)
-    CHAONE-XSL-FILE: ../chaone-win-1.2.0/chaone_t_Shift_JIS.xsl
+	CHAONE-XSL-FILE: ../chaone-win-1.3.2/chaone4gtalk_win.xsl
 
     # default for numbers and alphabets
     NUMBER: DECIMAL
@@ -403,6 +402,16 @@
   なければALPHABETとして読み上げられる。
   ただし、設定ファイルの既述によりこれをかえることができる。
 
+5.11 APB タグ 
+  アクセント句境界を明示的に指定する。(このタグは,JEIDA規格にはない,
+独自に追加したタグである。)
+
+  例)
+    set Text = 草津<APB/>太郎
+  とすることにより、「草津」と「太郎」の間に強制的にアクセント句境界が
+  置かれる。
+
+
 =========
 6. 実行例
 =========
@@ -418,13 +427,27 @@
 とすると合成音声を出力する(-DLINUXでコンパイルした場合)。
 
 最後に合成した合成音声波形を
-    set Save = <filename>
+    set SaveRAW = <filename>
+    (あるいは set Save = <filename> )
 で <filename> に出力することができる。
 ファイル形式は 16kHz, 16bit, signed linear raw file, Big Endian である。
 同時に、音素時間長などの情報が <filename>.info のファイルに
 書き出される。
 このようにファイルにセーブした合成音声波形は
-    set SpeechFile = <filename>
+    set LoadRAW = <filename>
+    (あるいは set SpeechFile = <filename>)
+によってデータが読み込まれ、
+    set Speak = NOW
+などによって合成音声が出力される。
+
+また,最後に合成した合成音声波形を
+    set SaveWAV = <filename>
+で <filename> に WAV 形式で出力することができる。
+ファイル形式は 16kHz, 16bit である。
+同時に、音素時間長などの情報が <filename>.info のファイルに
+書き出される。
+このようにファイルにセーブした合成音声波形は
+    set LoadWAV = <filename>
 によってデータが読み込まれ、
     set Speak = NOW
 などによって合成音声が出力される。
@@ -472,7 +495,8 @@
 
 となっている。
 このようにファイルにセーブした韻律情報は
-    set ProsFile = <filename>
+    set LoadFile = <filename>
+    ( あるいは set ProsFile = <filename> )
 によってデータが読み込まれ、音声波形が生成され
     set Speak = NOW
 などによって合成音声が出力される。
@@ -512,8 +536,6 @@
     ModuleVersion : プログラムのバージョン
     SpeakerSet : 利用可能な話者ID
     Speaker : 現在の話者ID
-    SpeechFile : 再生する合成音声波形ファイル
-    ProsFile : 音声データの韻律情報ファイル
     Text.text : 発話内容 ( 4. で述べた set Text = ... でセットされる)
     Text.pho : 音素系列と音素時間長
     Text.dur : 総発話時間
Index: gtalk/chasenrc-win
diff -u gtalk/chasenrc-win:1.3 gtalk/chasenrc-win:1.4
--- gtalk/chasenrc-win:1.3	Fri Oct 13 19:16:11 2006
+++ gtalk/chasenrc-win	Fri Feb 13 02:43:42 2009
@@ -7,7 +7,8 @@
 ;;;
 ;(•¶–@ƒtƒ@ƒCƒ‹  /usr/local/lib/chasen/dic/unidic)
 ;(GRAMMAR  /usr/local/lib/chasen/dic/unidic)
-(GRAMMAR  ../morph/unidic-sjis-1.2.0)
+;(GRAMMAR  ../morph/unidic-sjis-1.3.5)
+(GRAMMAR  ../morph/unidic-chasen139_sjis)
 
 ;;;
 ;;;  dictionary /Ž«‘
Index: gtalk/fileIO.c
diff -u gtalk/fileIO.c:1.7 gtalk/fileIO.c:1.8
--- gtalk/fileIO.c:1.7	Thu Oct 19 12:27:08 2006
+++ gtalk/fileIO.c	Fri Feb 13 02:43:42 2009
@@ -1,297 +1,357 @@
-/* Copyright (c) 2000-2006                  */
-/*   Yamashita Lab., Ritsumeikan University */
-/*   All rights reserved                    */
-/*                                          */
-/*   $Id: fileIO.c,v 1.7 2006/10/19 03:27:08 sako Exp $                                   */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "synthesis.h"
-#include "defaults.h"
-#include "slot.h"
-#include "misc.h"
-#include "model.h"
-
-extern int totalframe;
-
-int ErrMsg(char *,...);
-int TmpMsg(char *,...);
-void restart(int);
-int xfwrite( void *, int, int, FILE *);
-int xfread( void *, int, int, FILE *);
-PHONEME *new_phoneme();
-char *get_phoneme(char *);
-
-/*---------------------------------------------------------------------*/
-
-void do_output_info(char *sfile)
-{
-	FILE *fp;
-	char dfile[256];
-	int dur;
-	PHONEME *phoneme;
-	MORPH *morph;
-
-	sprintf( dfile, "%s.info", sfile );
-	fp = fopen( dfile, "w" );
-	if( fp == NULL )  {
-		ErrMsg( "* File Open Error ... %s\n", dfile );
-		return;
-	}
-	if( input_text[0] )  {
-		fprintf( fp, "input_text: %s\n", input_text );
-		fprintf( fp, "spoken_text: %s\n", spoken_text );
-	} else {
-		/* ParsedText での入力のとき */
-		for( morph=mphead; morph; morph=morph->next )  {
-			if( strncmp(morph->kanji,"sil",3)==0 )  continue;
-			fprintf( fp, "%s", morph->kanji );
-		}
-		fprintf( fp, "\n" );
-	}
-	fprintf( fp, "-----\n" );
-	phoneme = phhead;
-	while( phoneme )  {
-		dur = (int)(phoneme->time);
-		fprintf( fp, "%s [%d]\n", phoneme->phoneme, dur );
-		phoneme = phoneme->next;
-	}
-	fprintf( fp, "-----\n" );
-	fclose( fp );
-}
-
-void do_output_file(char *sfile)
-{
-	FILE *fp;
-
-	fp = fopen( sfile, "wb" );
-	if( fp == NULL )  {
-		ErrMsg( "* File Open Error ... %s\n", sfile );
-		return;
-	}
-	xfwrite( wave.data, sizeof(short), wave.nsample, fp );
-	fclose( fp );
-
-	do_output_info(sfile);
-}
-
-/*---------------------------------------------------------------------*/
-
-void read_speech_file( char *sfile )
-{
-	FILE *fp;
-	struct stat buf;
-	static int nsample;
-	char dfile[256], tbuf[MAX_TEXT_LEN];
-	int dur;
-	PHONEME *phoneme;
-
-	if( stat( sfile, &buf ) != 0 )  {
-		ErrMsg( "* File Open Error ... %s\n", sfile );
-		return;
-	}
-	nsample = buf.st_size / sizeof(short);
-	free( wave.data );
-	wave.data = (short *) calloc( nsample, sizeof(short) );
-	if( wave.data == NULL )  {
-		ErrMsg( "Memory allocation error !\n" );
-		restart(1);
-	}
-
-	fp = fopen( sfile, "rb" );
-	if( fp == NULL )  {
-		ErrMsg( "* File Open Error ... %s\n", sfile );
-		return;
-	}
-	xfread( wave.data, sizeof(short), nsample, fp );
-	fclose( fp );
-
-	wave.nsample = nsample;
-	wave.rate = SAMPLE_RATE;
-
-	sprintf( dfile, "%s.info", sfile );
-	fp = fopen( dfile, "r" );
-	if( fp == NULL )  {
-		ErrMsg( "* File Open Error ... %s\n", dfile );
-		return;
-	}
-	fscanf( fp, "input_text: %s\n", input_text );
-	fscanf( fp, "spoken_text: %s\n", spoken_text );
-	do {
-		fscanf( fp, "%s\n", tbuf );
-	} while( tbuf[0] != '-' );
-	while( 1 )  {
-		fscanf( fp, "%s [%d]\n", tbuf, &dur );
-		if( tbuf[0] == '-' )  break;
-		phoneme = new_phoneme();
-		phoneme->phoneme = get_phoneme( tbuf );
-		phoneme->time = dur;
-	}
-	fclose( fp );
-}
-
-/*---------------------------------------------------------------------*/
-
-void do_output_pros(char *ffile)
-{
-	FILE *fp;
-	int dur;
-	PHONEME *phoneme;
-	MORPH *morph;
-	int i;
-	int shift_start;
-	
-	shift_start = mhead->totalduration - 
-	  ((int )(SILENCE_LENGTH / FRAME_RATE));
-	
-	fp = fopen( ffile, "w" );
-	if( fp == NULL )  {
-		ErrMsg( "* File Open Error ... %s\n", ffile );
-		return;
-	}
-	if( input_text[0] )  {
-		fprintf( fp, "input_text: %s\n", input_text );
-		fprintf( fp, "spoken_text: %s\n", spoken_text );
-	} else {
-		/* ParsedText での入力のとき */
-		for( morph=mphead; morph; morph=morph->next )  {
-			if( strncmp(morph->kanji,"sil",3)==0 )  continue;
-			fprintf( fp, "%s", morph->kanji );
-		}
-		fprintf( fp, "\n" );
-	}
-	fprintf( fp, "number_of_phonemes: %d\n", slot_n_phonemes );
-	fprintf( fp, "total_duration: %d\n", slot_total_dur );
-	fprintf( fp, "-----\n" );
-	phoneme = phhead;
-	while( phoneme )  {
-		dur = (int)(phoneme->time);
-		fprintf( fp, "%s [%d]\n", phoneme->phoneme, dur );
-		phoneme = phoneme->next;
-	}
-	fprintf( fp, "-----\n" );
-	fprintf( fp, "total_frame: %d\n", totalframe );
-	fprintf( fp, "-----\n" );
-	for( i=0; i<totalframe; ++i )  {
-		fprintf( fp, "%d: %lf %lf\n", i, f0.data[i+shift_start], power.data[i+shift_start] );
-	}
-	fprintf( fp, "-----\n" );
-	fclose( fp );
-}
-
-/*---------------------------------------------------------------------*/
-
-int read_pros_file( char *ffile )
-{
-	FILE *fp;
-	char tbuf[MAX_TEXT_LEN], phname[128];
-	int i, j, nph, nfr;
-
-	fp = fopen( ffile, "r" );
-	if( fp == NULL )  {
-		ErrMsg( "* File Open Error ... %s\n", ffile );
-		return -1;
-	}
-	fscanf( fp, "input_text: %s\n", input_text );
-	fscanf( fp, "spoken_text: %s\n", spoken_text );
-	fscanf( fp, "number_of_phonemes: %d\n", &nph );
-	do {
-		fscanf( fp, "%s\n", tbuf );
-	} while( tbuf[0] != '-' );
-
-	prosBuf.ph_name = (char **)malloc( nph * sizeof(char *));
-	if( prosBuf.ph_name == NULL )  {
-		ErrMsg( "* malloc error in 'prosBuf.ph_name'\n" );
-		restart(1);
-	}
-	prosBuf.ph_dur = (int *)malloc( nph * sizeof(int));
-	if( prosBuf.ph_dur == NULL )  {
-		ErrMsg( "* malloc error in 'prosBuf.ph_dur'\n" );
-		restart(1);
-	}
-
-	for( i=0; i<nph; ++i )  {
-		fscanf( fp, "%s [%d]\n", phname, &(prosBuf.ph_dur[i]) );
-		prosBuf.ph_name[i] = get_phoneme( phname );
-	}
-
-	fscanf( fp, "%s\n", tbuf );  /* to skip '----' */
-	fscanf( fp, "total_frame: %d\n", &nfr );
-	do {
-		fscanf( fp, "%s\n", tbuf );
-	} while( tbuf[0] != '-' );
-
-	prosBuf.fr_power = (double *)malloc( (nfr+1) * sizeof(double));
-	if( prosBuf.fr_power == NULL )  {
-		ErrMsg( "* malloc error in 'prosBuf.fr_power'\n" );
-		restart(1);
-	}
-	prosBuf.fr_f0 = (double *)malloc( (nfr+1) * sizeof(double));
-	if( prosBuf.fr_f0 == NULL )  {
-		ErrMsg( "* malloc error in 'prosBuf.fr_f0'\n" );
-		restart(1);
-	}
-
-	for( i=0; i<=nfr; ++i )  {
-		fscanf( fp, "%d: %lf %lf\n", 
-			&j, &(prosBuf.fr_f0[i]), &(prosBuf.fr_power[i]) );
-	}
-	fclose( fp );
-
-/* エラーがなければ、音素数、フレー無数をセット */
-	prosBuf.nPhoneme = slot_n_phonemes = nph;
-	prosBuf.nFrame = nfr;
-
-	return 0;
-}
-
-int set_f0_and_power( char *ffile )
-{
-	PHONEME *phoneme;
-	int i;
-	int shift_start;
-
-	/* 長さをそろえる */
-	shift_start = mhead->totalduration - 
-	  ((int )(SILENCE_LENGTH / FRAME_RATE));
-
-	phoneme = phhead;
-	i = 0;
-	while( phoneme )  {
-		if( phoneme->phoneme != prosBuf.ph_name[i] )  {
-			ErrMsg( "* Phoneme sequence does not match ... %s\n", ffile );
-			return -1;
-		}
-		phoneme->time = prosBuf.ph_dur[i];
-		phoneme = phoneme->next;
-		++i;
-	}
-
-	if( prosBuf.nFrame > totalframe )  {
-		f0.data = realloc( f0.data, (prosBuf.nFrame+1)*sizeof(double) );
-		if( f0.data == NULL )  {
-			ErrMsg("Memory allocation error !  (in read_pros_file)\n");
-			restart(1);
-		}
-		power.data = realloc( power.data, (prosBuf.nFrame+1)*sizeof(double) );
-		if( power.data == NULL )  {
-			ErrMsg("Memory allocation error !  (in read_pros_file)\n");
-			restart(1);
-		}
-	}
-	for( i=0; i<=prosBuf.nFrame; ++i )  {
-		f0.data[i+shift_start] = prosBuf.fr_f0[i];
-		power.data[i+shift_start] = prosBuf.fr_power[i];
-	}
-/*
-	printf( "totalframe: %d\n", prosBuf.nFrame );
-	for( i=0; i<=10; ++i )  {
-		printf( "%d: %lf %lf\n", i, f0.data[i], power.data[i] );
-	}
-*/
-	return 0;
-}
-
+/* Copyright (c) 2000-2006                  */
+/*   Yamashita Lab., Ritsumeikan University */
+/*   All rights reserved                    */
+/*                                          */
+/*   $Id: fileIO.c,v 1.8 2009/02/12 17:43:42 sako Exp $                                   */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "synthesis.h"
+#include "defaults.h"
+#include "slot.h"
+#include "misc.h"
+#include "model.h"
+
+extern int totalframe;
+
+int ErrMsg(char *,...);
+int TmpMsg(char *,...);
+void restart(int);
+int xfwrite( void *, int, int, FILE *);
+int xfwrite_LE( void *, int, int, FILE *);
+int xfread( void *, int, int, FILE *);
+int xfread_LE( void *, int, int, FILE *);
+PHONEME *new_phoneme();
+char *get_phoneme(char *);
+
+/*---------------------------------------------------------------------*/
+
+void do_output_info(char *sfile)
+{
+	FILE *fp;
+	char dfile[256];
+	int dur;
+	PHONEME *phoneme;
+	MORPH *morph;
+
+	sprintf( dfile, "%s.info", sfile );
+	fp = fopen( dfile, "w" );
+	if( fp == NULL )  {
+		ErrMsg( "* File Open Error ... %s\n", dfile );
+		return;
+	}
+	if( input_text[0] )  {
+		fprintf( fp, "input_text: %s\n", input_text );
+		fprintf( fp, "spoken_text: %s\n", spoken_text );
+	} else {
+		/* ParsedText での入力のとき */
+		for( morph=mphead; morph; morph=morph->next )  {
+			if( strncmp(morph->kanji,"sil",3)==0 )  continue;
+			fprintf( fp, "%s", morph->kanji );
+		}
+		fprintf( fp, "\n" );
+	}
+	fprintf( fp, "-----\n" );
+	phoneme = phhead;
+	while( phoneme )  {
+		dur = (int)(phoneme->time);
+		fprintf( fp, "%s [%d]\n", phoneme->phoneme, dur );
+		phoneme = phoneme->next;
+	}
+	fprintf( fp, "-----\n" );
+	fclose( fp );
+}
+
+void do_output_file(char *sfile)
+{
+	FILE *fp;
+
+	fp = fopen( sfile, "wb" );
+	if( fp == NULL )  {
+		ErrMsg( "* File Open Error ... %s\n", sfile );
+		return;
+	}
+	xfwrite( wave.data, sizeof(short), wave.nsample, fp );
+	fclose( fp );
+
+	do_output_info(sfile);
+}
+
+void do_output_WAVfile(char *sfile)
+{
+	FILE *fp;
+	char s[4];
+	long var_long;
+	short var_short;
+
+	fp = fopen( sfile, "wb" );
+	if( fp == NULL )  {
+		ErrMsg( "* File Open Error ... %s\n", sfile );
+		return;
+	}
+	strncpy( s, "RIFF", 4 );
+	xfwrite_LE( s, 1, 4, fp );
+	var_long = wave.nsample*2 + 36;
+	xfwrite_LE( &var_long, 4, 1, fp );
+	strncpy( s, "WAVE", 4 );
+	xfwrite_LE( s, 1, 4, fp );
+	strncpy( s, "fmt ", 4 );
+	xfwrite_LE( s, 1, 4, fp );
+	var_long = 16;
+	xfwrite_LE( &var_long, 4, 1, fp );
+	var_short = 1;  /* PCM */
+	xfwrite_LE( &var_short, 2, 1, fp );
+	var_short = 1;  /* monoral */
+	xfwrite_LE( &var_short, 2, 1, fp );
+	var_long = 16000;	/* sampling rate (16kHz) */
+	xfwrite_LE( &var_long, 4, 1, fp );
+	var_long = 16000*2;	/* byte/sec (monoral, 16kHz, 2byte/sample) */
+	xfwrite_LE( &var_long, 4, 1, fp );
+	var_short = 2;  /* channel*byte/sample (16bit, monoral) */
+	xfwrite_LE( &var_short, 2, 1, fp );
+	var_short = 16;  /* bit/sample (16bit) */
+	xfwrite_LE( &var_short, 2, 1, fp );
+	strncpy( s, "data", 4 );
+	xfwrite_LE( s, 1, 4, fp );
+	var_long = wave.nsample*2;
+	xfwrite_LE( &var_long, 4, 1, fp );
+
+	xfwrite_LE( wave.data, sizeof(short), wave.nsample, fp );
+	fclose( fp );
+
+	do_output_info(sfile);
+}
+
+
+/*---------------------------------------------------------------------*/
+
+#define WAVE_HEADER  44  /* byte */
+
+void read_speech_file( char *sfile, SPEECHFILETYPE type )
+{
+	FILE *fp;
+	struct stat buf;
+	static int nsample;
+	char dfile[256], tbuf[MAX_TEXT_LEN];
+	int dur;
+	PHONEME *phoneme;
+
+	if( stat( sfile, &buf ) != 0 )  {
+		ErrMsg( "* File Open Error ... %s\n", sfile );
+		return;
+	}
+	if( type == WAV )  {
+		nsample = ( buf.st_size - WAVE_HEADER ) / sizeof(short);
+	} else {
+		nsample = buf.st_size / sizeof(short);
+	}
+	free( wave.data );
+	wave.data = (short *) calloc( nsample, sizeof(short) );
+	if( wave.data == NULL )  {
+		ErrMsg( "Memory allocation error !\n" );
+		restart(1);
+	}
+
+	fp = fopen( sfile, "rb" );
+	if( fp == NULL )  {
+		ErrMsg( "* File Open Error ... %s\n", sfile );
+		return;
+	}
+	if( type == WAV )  {
+		fseek( fp, WAVE_HEADER, SEEK_SET );
+		xfread_LE( wave.data, sizeof(short), nsample, fp );
+	} else {
+		xfread( wave.data, sizeof(short), nsample, fp );
+	}
+	fclose( fp );
+
+	wave.nsample = nsample;
+	wave.rate = SAMPLE_RATE;
+
+	sprintf( dfile, "%s.info", sfile );
+	fp = fopen( dfile, "r" );
+	if( fp == NULL )  {
+		ErrMsg( "* File Open Error ... %s\n", dfile );
+		return;
+	}
+	fscanf( fp, "input_text: %s\n", input_text );
+	fscanf( fp, "spoken_text: %s\n", spoken_text );
+	do {
+		fscanf( fp, "%s\n", tbuf );
+	} while( tbuf[0] != '-' );
+	while( 1 )  {
+		fscanf( fp, "%s [%d]\n", tbuf, &dur );
+		if( tbuf[0] == '-' )  break;
+		phoneme = new_phoneme();
+		phoneme->phoneme = get_phoneme( tbuf );
+		phoneme->time = dur;
+	}
+	fclose( fp );
+}
+
+
+/*---------------------------------------------------------------------*/
+
+void do_output_pros(char *ffile)
+{
+	FILE *fp;
+	int dur;
+	PHONEME *phoneme;
+	MORPH *morph;
+	int i;
+	int shift_start;
+	
+	shift_start = mhead->totalduration - 
+	  ((int )(SILENCE_LENGTH / FRAME_RATE));
+	
+	fp = fopen( ffile, "w" );
+	if( fp == NULL )  {
+		ErrMsg( "* File Open Error ... %s\n", ffile );
+		return;
+	}
+	if( input_text[0] )  {
+		fprintf( fp, "input_text: %s\n", input_text );
+		fprintf( fp, "spoken_text: %s\n", spoken_text );
+	} else {
+		/* ParsedText での入力のとき */
+		for( morph=mphead; morph; morph=morph->next )  {
+			if( strncmp(morph->kanji,"sil",3)==0 )  continue;
+			fprintf( fp, "%s", morph->kanji );
+		}
+		fprintf( fp, "\n" );
+	}
+	fprintf( fp, "number_of_phonemes: %d\n", slot_n_phonemes );
+	fprintf( fp, "total_duration: %d\n", slot_total_dur );
+	fprintf( fp, "-----\n" );
+	phoneme = phhead;
+	while( phoneme )  {
+		dur = (int)(phoneme->time);
+		fprintf( fp, "%s [%d]\n", phoneme->phoneme, dur );
+		phoneme = phoneme->next;
+	}
+	fprintf( fp, "-----\n" );
+	fprintf( fp, "total_frame: %d\n", totalframe );
+	fprintf( fp, "-----\n" );
+	for( i=0; i<totalframe; ++i )  {
+		fprintf( fp, "%d: %lf %lf\n", i, f0.data[i+shift_start], power.data[i+shift_start] );
+	}
+	fprintf( fp, "-----\n" );
+	fclose( fp );
+}
+
+/*---------------------------------------------------------------------*/
+
+int read_pros_file( char *ffile )
+{
+	FILE *fp;
+	char tbuf[MAX_TEXT_LEN], phname[128];
+	int i, j, nph, nfr;
+
+	fp = fopen( ffile, "r" );
+	if( fp == NULL )  {
+		ErrMsg( "* File Open Error ... %s\n", ffile );
+		return -1;
+	}
+	fscanf( fp, "input_text: %s\n", input_text );
+	fscanf( fp, "spoken_text: %s\n", spoken_text );
+	fscanf( fp, "number_of_phonemes: %d\n", &nph );
+	do {
+		fscanf( fp, "%s\n", tbuf );
+	} while( tbuf[0] != '-' );
+
+	prosBuf.ph_name = (char **)malloc( nph * sizeof(char *));
+	if( prosBuf.ph_name == NULL )  {
+		ErrMsg( "* malloc error in 'prosBuf.ph_name'\n" );
+		restart(1);
+	}
+	prosBuf.ph_dur = (int *)malloc( nph * sizeof(int));
+	if( prosBuf.ph_dur == NULL )  {
+		ErrMsg( "* malloc error in 'prosBuf.ph_dur'\n" );
+		restart(1);
+	}
+
+	for( i=0; i<nph; ++i )  {
+		fscanf( fp, "%s [%d]\n", phname, &(prosBuf.ph_dur[i]) );
+		prosBuf.ph_name[i] = get_phoneme( phname );
+	}
+
+	fscanf( fp, "%s\n", tbuf );  /* to skip '----' */
+	fscanf( fp, "total_frame: %d\n", &nfr );
+	do {
+		fscanf( fp, "%s\n", tbuf );
+	} while( tbuf[0] != '-' );
+
+	prosBuf.fr_power = (double *)malloc( (nfr+1) * sizeof(double));
+	if( prosBuf.fr_power == NULL )  {
+		ErrMsg( "* malloc error in 'prosBuf.fr_power'\n" );
+		restart(1);
+	}
+	prosBuf.fr_f0 = (double *)malloc( (nfr+1) * sizeof(double));
+	if( prosBuf.fr_f0 == NULL )  {
+		ErrMsg( "* malloc error in 'prosBuf.fr_f0'\n" );
+		restart(1);
+	}
+
+	for( i=0; i<=nfr; ++i )  {
+		fscanf( fp, "%d: %lf %lf\n", 
+			&j, &(prosBuf.fr_f0[i]), &(prosBuf.fr_power[i]) );
+	}
+	fclose( fp );
+
+/* エラーがなければ、音素数、フレー無数をセット */
+	prosBuf.nPhoneme = slot_n_phonemes = nph;
+	prosBuf.nFrame = nfr;
+
+	return 0;
+}
+
+int set_f0_and_power( char *ffile )
+{
+	PHONEME *phoneme;
+	int i;
+	int shift_start;
+
+	/* 長さをそろえる */
+	shift_start = mhead->totalduration - 
+	  ((int )(SILENCE_LENGTH / FRAME_RATE));
+
+	phoneme = phhead;
+	i = 0;
+	while( phoneme )  {
+		if( phoneme->phoneme != prosBuf.ph_name[i] )  {
+			ErrMsg( "* Phoneme sequence does not match ... %s\n", ffile );
+			return -1;
+		}
+		phoneme->time = prosBuf.ph_dur[i];
+		phoneme = phoneme->next;
+		++i;
+	}
+
+	if( prosBuf.nFrame > totalframe )  {
+		f0.data = realloc( f0.data, (prosBuf.nFrame+1)*sizeof(double) );
+		if( f0.data == NULL )  {
+			ErrMsg("Memory allocation error !  (in read_pros_file)\n");
+			restart(1);
+		}
+		power.data = realloc( power.data, (prosBuf.nFrame+1)*sizeof(double) );
+		if( power.data == NULL )  {
+			ErrMsg("Memory allocation error !  (in read_pros_file)\n");
+			restart(1);
+		}
+	}
+	for( i=0; i<=prosBuf.nFrame; ++i )  {
+		f0.data[i+shift_start] = prosBuf.fr_f0[i];
+		power.data[i+shift_start] = prosBuf.fr_power[i];
+	}
+/*
+	printf( "totalframe: %d\n", prosBuf.nFrame );
+	for( i=0; i<=10; ++i )  {
+		printf( "%d: %lf %lf\n", i, f0.data[i], power.data[i] );
+	}
+*/
+	return 0;
+}
+
Index: gtalk/main.c
diff -u gtalk/main.c:1.30 gtalk/main.c:1.31
--- gtalk/main.c:1.30	Thu Jul 12 15:10:45 2007
+++ gtalk/main.c	Fri Feb 13 02:43:42 2009
@@ -1,1111 +1,1131 @@
-/* Copyright (c) 2003-2006                                           */
-/*   Interactive Speech Technology Consortium (ISTC)                 */
-/*   All rights reserved                                             */
-/*                                                                   */
-/*   The code is developed by Yamashita-lab, Ritsumeikan University  */
-/*                                                                   */
-/* $Id: main.c,v 1.30 2007/07/12 06:10:45 sako Exp $                                                              */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef WIN32
-#include <windows.h>
-#else
-#include <unistd.h>
-#include <sys/wait.h>
-#endif
-#include <setjmp.h>
-#include "synthesis.h"
-#include "command.h"
-#include "confpara.h"
-
-#include "misc.h"
-#include "model.h"
-#include "tree.h"
-#include "defaults.h"
-#include "hmmsynth.h"
-#include "mlpg.h"
-#include "tag.h"
-
-#define INIT_SLOT_TABLE
-#include "slot.h"
-
-#define YesNoSlot(s)  ( ( (s==1) ? "YES" : "NO" ) )
-
-char *moduleVersion = "GalateaTalk Ver. 1.4.0 (gtalk-061013)";
-char *protocolVersion = "Protocol Ver. 1.0";
-
-/* synthesis.h グローバル変数の定義 */
-MORPH *mphead;
-MORPH *mptail;
-PHONEME *phhead;
-PHONEME *phtail;
-MORA *mrhead;
-MORA *mrtail;
-APHRASE *ahead;
-APHRASE *atail;
-BREATH *bhead;
-BREATH *btail;
-SENTENCE *shead;
-SENTENCE *stail;
-SENTENCE *sentence;
-WAVE wave;
-PARAM power;
-PARAM f0;
-PARAM alpha;
-/*******↓for server mode ********/
-int s_mode = 0;
-int nPort = 10600;
-/********↑***********************/
-
-PROS prosBuf;	/* 韻律データの一時格納用 */
-
-/* confpara.h グローバル変数の定義 */
-char *phlist_file;
-char *chasen_bin;
-char *chasen_dll;
-char *chaone_xsl;
-char *chasen_rc;
-char *chaone_bin;
-char *chaone_xsl;
-char *read_number;
-char *read_alphabet;
-char *read_date;
-char *read_time;
-int n_speaker;	/* 登録された話者数 */
-int spid;	/* 現在の話者ID */
-FILE *logfp;
-SPEAKER speaker[MAX_SPEAKER];
-char *dic_file;
-
-/* hmmsynth.h グローバル変数定義 */
-int nstate;
-int pitchstream;
-int mcepvsize;
-ModelSet mset[MAX_SPEAKER];
-double **mcep;  /* generated mel-cepstrum */
-double **coeff; /* mlsa filter coefficients */
-int totalframe;
-
-/* mlpg.h */
-PStream pitchpst;
-PStream mceppst;
-Boolean *voiced;
-
-/* model.h */
-Model *mhead;
-Model *mtail;
-FILE *durmodel;
-FILE *pitchmodel;
-FILE *mcepmodel;
-
-/* tag.h */
-TAG *tag[MAX_TAG];
-int n_tag;
-
-/* slot.h */
-SlotProp prop_Run;
-SlotProp prop_ModuleVersion;
-SlotProp prop_ProtocolVersion;
-SlotProp prop_SpeakerSet;
-SlotProp prop_Speaker;
-SlotProp prop_SpeechFile;
-SlotProp prop_ProsFile;
-SlotProp prop_Text;
-SlotProp prop_Text_text;
-SlotProp prop_Text_pho;
-SlotProp prop_Text_dur;
-SlotProp prop_Speak;
-SlotProp prop_Speak_text;
-SlotProp prop_Speak_pho;
-SlotProp prop_Speak_dur;
-SlotProp prop_Speak_utt;
-SlotProp prop_Speak_len;
-SlotProp prop_Speak_stat;
-SlotProp prop_Speak_syncinterval;
-
-/* slots */
-char slot_Run[20];
-char slot_Speak_stat[20];
-char input_text[MAX_TEXT_LEN];  /* 入力されたテキスト(タグつき) */
-char spoken_text[MAX_TEXT_LEN]; /* 音声出力された発話のテキスト */
-char slot_Log_file[256];
-char slot_Err_file[256];
-char slot_Speech_file[512];
-char slot_Pros_file[512];
-int slot_Auto_play;
-int slot_Auto_play_delay;
-int slot_n_phonemes;
-int slot_total_dur;
-int slot_Log_chasen;
-int slot_Log_tag;
-int slot_Log_phoneme;
-int slot_Log_mora;
-int slot_Log_morph;
-int slot_Log_aphrase;
-int slot_Log_breath;
-int slot_Log_conf;
-int slot_Log_text;
-int slot_Log_arranged_text;
-int slot_Log_sentence;
-int slot_Speak_syncinterval;
-
-/* chaone */
-#ifdef WIN32
-#include "chaone.h"
-#endif
-
-void init_conf();
-void read_conf(char *);
-int speakerID(char *);
-void set_default_conf();
-void init_text_analysis();
-void init_hmmsynth();
-void set_da_signal();
-void read_phonemes(char *);
-void read_dic(char *);
-void init_tag();
-void init_mora();
-void init_morph();
-void init_aphrase();
-void init_breath();
-void init_phoneme();
-void init_sentence();
-void refresh_text_analysis();
-void refresh_tag();
-void refresh_mora();
-void refresh_morph();
-void refresh_aphrase();
-void refresh_breath();
-void refresh_phoneme();
-void refresh_sentence();
-void refresh_hmmsynth();
-void refresh_vocoder();
-int RepMsg(char *, ...);
-int TmpMsg(char *, ...);
-int ErrMsg(char *, ...);
-void init_parameter();
-void make_duration();
-void make_parameter();
-void unknown_com();
-void restart(int);
-void text_analysis();
-void send_speakerset();
-void send_speaker();
-void send_text(char *);
-void send_phonemes(char *);
-void send_duration(char *);
-void send_talked_phonemes();
-void send_talked_duration();
-void do_synthesis();
-void do_output(char *);
-void do_output_pros(char *);
-void read_speech_file(char *);
-int read_pros_file(char *);
-int set_f0_and_power(char *);
-void update_duration();
-void abort_output();
-void text_analysis_file();
-void reset_output();
-void parameter_generation();
-void modify_duration();
-void make_cumul_time();
-void modify_f0();
-void modify_power();
-void modify_voice();
-int make_sleep_time(char *, long *);
-void sig_wait_da();
-int getline( char *buf, int MAX_LENGTH );
-/*******↓for server mode ********/
-void refresh_server ( void );
-int server_init ( int port );
-void server_close_client ( void );
-int server_getline ( char *buf, int buf_size );
-void server_destroy ( void );
-/********↑***********************/
-void SetRun( char *rel, char *val);
-
-extern FILE *fp_err;
-
-void init_slot_prop()
-{
-	prop_Run = AutoOutput;
-	prop_ModuleVersion = AutoOutput;
-	prop_ProtocolVersion = AutoOutput;
-	prop_SpeakerSet = AutoOutput;
-	prop_Speaker = AutoOutput;
-	prop_SpeechFile = AutoOutput;
-	prop_ProsFile = AutoOutput;
-	prop_Text = AutoOutput;
-	prop_Text_text = AutoOutput;
-	prop_Text_pho = AutoOutput;
-	prop_Text_dur = AutoOutput;
-	prop_Speak = AutoOutput;
-	prop_Speak_text = AutoOutput;
-	prop_Speak_pho = AutoOutput;
-	prop_Speak_dur = AutoOutput;
-	prop_Speak_utt = AutoOutput;
-	prop_Speak_len = AutoOutput;
-	prop_Speak_stat = AutoOutput;
-	prop_Speak_syncinterval = AutoOutput;
-}
-
-/* 初期化: プログラム起動時に一度だけ実行 */
-void initialize()
-{
-	void setRun();
-
-	/*******↓for server mode *******/
-	if (s_mode) {
-	        server_init( nPort );
-	}
-	/*******↑***********************/
-	
-#ifndef WIN32
-	setpgrp();
-#endif
-	set_da_signal();
-
-	init_slot_prop();
-	init_text_analysis();
-	init_hmmsynth();
-	read_phonemes( phlist_file );
-	read_dic( dic_file );
-	init_tag();
-	init_mora();
-	init_morph();
-	init_aphrase();
-	init_breath();
-	init_phoneme();
-	init_sentence();
-	strcpy( slot_Speak_stat, "IDLE" );
-	setRun( "=", "LIVE" );
-	strcpy( slot_Log_file, "NO" );   logfp = NULL;
-	slot_Log_chasen= slot_Log_tag = slot_Log_phoneme = 0;
-	slot_Log_mora = slot_Log_morph = slot_Log_aphrase = 0;
-	slot_Log_breath = slot_Log_sentence = 0;
-	strcpy( slot_Err_file, "CONSOLE" );
-	slot_Speech_file[0] = '\0';
-	slot_Pros_file[0] = '\0';
-	prosBuf.nPhoneme = 0;
-	slot_Speak_syncinterval = 1000;
-}
-
-void refresh_prosBuf()
-{
-	if( prosBuf.nPhoneme == 0 )  return;
-
-	free( prosBuf.ph_name );
-	free( prosBuf.ph_dur );
-	free( prosBuf.fr_power );
-	free( prosBuf.fr_f0 );
-	prosBuf.nPhoneme = prosBuf.nFrame = 0;
-}
-
-/* 初期化: 合成を行うたびに実行 */
-void refresh()
-{
-	refresh_text_analysis();
-	refresh_tag();
-	refresh_mora();
-	refresh_morph();
-	refresh_aphrase();
-	refresh_breath();
-	refresh_phoneme();
-	refresh_sentence();
-	refresh_hmmsynth();
-	refresh_prosBuf();
-	refresh_server();
-}
-
-int commandID( char *com )
-{
-	int 	i;
-	for( i=0; i<NUM_COMMAND; ++i )  {
-		if( strcmp(com,commandTable[i].name)==0 )  return commandTable[i].id;
-	}
-	return -1;
-}
-
-int slotID( char *slot )
-{
-	int 	i;
-	for( i=0; i<NUM_SLOT; ++i )  {
-		if( strcmp(slot,slotTable[i].name)==0 )  return slotTable[i].id;
-	}
-	return -1;
-}
-
-#define MAX_COMMAND_LEN 8192  /* 入力コマンドの最大文字数 */
-static char cline[MAX_COMMAND_LEN];
-
-int read_command( char **args )
-{
-	int 	n=0, p=0;
-	char	*c;
-
-	if( s_mode ) {
-	        if (server_getline( cline, MAX_COMMAND_LEN ) <= 0) {
-  		        args[0] = "";
-   		        return 0;
-		}
-	} else {
-	        if( getline( cline, MAX_COMMAND_LEN ) < 0)
-		        setRun( "=", "EXIT" );
-		if( ! strlen( cline) > 0) return 0;
-	}
-	c = cline;
-
-/* to skip space */
-	while( *c==' ' || *c=='\t' )  { ++c; };
-
-/* to get a command name */
-	*(args++) = c;
-	while( *c!=' ' && *c!='\t' && *c!='\n' && *c!= EOF )  {
-		c++;
-	}
-	*(c++) = '\0';  ++n;
-
-/* to skip space */
-	while( *c==' ' || *c=='\t' )  { ++c; };
-
-/* to get a slot name */
-	*(args++) = c;
-	while( *c!=' ' && *c!='\t' && *c!='=' && *c!='<' && *c!='\n' && *c!= EOF )  {
-		c++;
-	};
-	*(c++) = '\0';  ++n;
-
-/* to skip space */
-	while( *c==' ' || *c=='\t' )  { ++c; };
-
-/* to get relation */
-	*(args++) = c;
-	if( *c=='=' || *c=='<' )  {
-		c++;
-		if( *(c-1)=='<' && *c=='<' )  {
-			c++;
-		}
-		*(c++) = '\0';  ++n;
-	}
-
-/* to skip space */
-	while( *c==' ' || *c=='\t' )  { ++c; };
-
-/* to get a value */
-	*(args++) = c;
-	while( *c!='\n' && *c!='\0' && *c!= EOF )  {
-		c++;
-	};
-	*c = '\0';  ++n;
-
-	return n;
-}
-
-
-/*---------------------------------------------------------*/
-/*      inq command                                        */
-/*---------------------------------------------------------*/
-
-void inqRun()
-{
-	RepMsg( "rep Run = %s\n", slot_Run );
-}
-
-void inqModuleVersion()
-{
-	RepMsg( "rep ModuleVersion = \"%s\"\n", moduleVersion );
-}
-
-void inqProtocolVersion()
-{
-	RepMsg( "rep ProtocolVersion = \"%s\"\n", protocolVersion );
-}
-
-void inqSpeakerSet()
-{
-	send_speakerset();
-}
-
-void inqSpeaker()
-{
-	send_speaker();
-}
-
-void inqSpeechFile()
-{
-	RepMsg( "rep SpeechFile = %s\n", slot_Speech_file );
-}
-
-void inqProsFile()
-{
-	RepMsg( "rep ProsFile = %s\n", slot_Pros_file );
-}
-
-void inqAutoPlay()
-{
-	if( slot_Auto_play )  {
-		RepMsg( "rep AutoPlay = YES\n" );
-	} else {
-		RepMsg( "rep AutoPlay = NO\n" );
-	}
-}
-
-void inqAutoPlayDelay()
-{
-	RepMsg( "rep AutoPlayDelay = \"%d\"\n", slot_Auto_play_delay );
-}
-
-void inqTextText()
-{
-//	send_text( "Text.text" );
-	RepMsg( "rep Text.text = %s\n", input_text );
-}
-
-void inqTextPho()
-{
-	send_phonemes( "Text.pho" );
-}
-
-void inqTextDur()
-{
-	send_duration( "Text.dur" );
-}
-
-void inqSpeakText()
-{
-//	send_text( "Speak.text" );
-	RepMsg( "rep Speak.text = %s\n", spoken_text );
-}
-
-void inqSpeakPho()
-{
-	send_phonemes( "Speak.pho" );
-}
-
-void inqSpeakDur()
-{
-	send_duration( "Speak.dur" );
-}
-
-void inqSpeakUtt()
-{
-	send_talked_phonemes();
-}
-
-void inqSpeakLen()
-{
-	send_talked_duration();
-}
-
-void inqSpeakStat()
-{
-	RepMsg( "rep Speak.stat = %s\n", slot_Speak_stat );
-}
-
-void inqSpeakSyncinterval()
-{
-	RepMsg( "rep Speak.syncinterval = %d\n", slot_Speak_syncinterval );
-}
-
-/*---------------------------------------------------------*/
-/*      set command                                        */
-/*---------------------------------------------------------*/
-
-void setRun( char *rel, char *val )
-{
-	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
-
-	if( strcmp(val,"EXIT")==0 )  {
-		strcpy( slot_Run, "EXIT" );
-		if( prop_Run == AutoOutput )  inqRun();
-#ifdef WIN32
-		Sleep(3000);
-#else
-		sleep(3);
-#endif
-		if( s_mode ) {
-   		        server_destroy();
-		}
-		exit(0);
-	} else if( s_mode && strcmp(val,"CLOSE")==0 )  {
-	        server_close_client();
-	} else if( strcmp(val,"LIVE")==0 )  {
-		strcpy( slot_Run, "LIVE" );
-		if( prop_Run == AutoOutput )  inqRun();
-	} else {
-		unknown_com();
-	}
-}
-
-void setSpeaker( char *rel, char *val )
-{
-	int s;
-
-	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
-
-	s = speakerID( val );
-	if( s >= 0 )  {
-		spid = s;
-		if( prop_Speaker == AutoOutput )  inqSpeaker();
-	}
-}
-
-/* その時に選択されている話者 spid のαをセットする。*/
-void setAlpha( char *rel, char *val )
-{
-	double a;
-
-	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
-
-	a = atof( val );
-	if( a >= 0.0 )  {
-		speaker[spid].alpha = a;
-	}
-}
-
-/* その時に選択されている話者 spid のポストフィルタ係数をセットする。*/
-void setPostfilter_coef( char *rel, char *val)
-{
-	double a;
-
-	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
-
-	a = atof( val );
-	if( a >= 0.0 )  {
-		speaker[spid].postfilter_coef = a;
-	}
-}
-
-void setText( char *rel, char *val )
-{
-	strcpy( slot_Speak_stat, "PROCESSING" );
-	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
-
-	if( strcmp(rel,"=")==0 )  {
-		refresh();
-		text_analysis( val );	/* テキスト解析 */
-		if( prop_Text_text == AutoOutput )  inqTextText();
-		if( prop_Speak_text == AutoOutput )  inqSpeakText();
-
-		parameter_generation();	/* パラメータ生成(F0,MLSAフィルタ係数,継続長) */
-		do_synthesis();		/* 合成波形の生成 */
-#ifdef PRINTDATA
-		TmpMsg( "Synthesis Done.\n" );
-#endif
-/*	} else if( strcmp(rel,"<")==0 )  {
-	} else if( strcmp(rel,"<<")==0 )  {
-*/		
-	} else {
-		unknown_com();
-	}		
-	strcpy( slot_Speak_stat, "READY" );
-	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
-}
-
-void setSpeak( char *rel, char *val )
-{
-	int error;
-	long sleep_ms;
-
-	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
-
-	if( strcmp(val,"NOW")==0 )  {
-		strcpy( slot_Speak_stat, "SPEAKING" );
-		if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
-		do_output(NULL);	/* 音声出力 */
-
-	} else if( strcmp(val,"STOP")==0 )  {
-		abort_output();
-
-	} else {
-		/* val = "12:34:56.789" or "+1000" */
-		error = make_sleep_time( val, &sleep_ms );
-		if( error )  {
-			unknown_com();
-		} else {
-#ifdef PRINTDATA
-			TmpMsg( "sleep_ms: %d\n", sleep_ms );
-#endif
-			if( sleep_ms > 0 ) {
-#ifdef WIN32
-			        Sleep( sleep_ms );
-#else
-			        usleep( 1000*sleep_ms );
-#endif
-			}
-			strcpy( slot_Speak_stat, "SPEAKING" );
-			if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
-			do_output(NULL);	/* 音声出力 */
-		}
-	}
-/*	strcpy( slot_Speak_stat, "IDLE" );
-	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
-*/
-}
-
-void setSpeakSyncinterval( char *rel, char *val )
-{
-        int interval;
-	
-	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
-	
-	interval = atoi( val );
-
-	if( interval >= 0) {
-	        slot_Speak_syncinterval = interval;
-	        if( prop_Speak_syncinterval == AutoOutput )  inqSpeakSyncinterval();
-	}
-}
-
-/*-------------------*/
-
-void setSave( char *rel, char *filename )
-{
-	if( strcmp(rel,"=")==0 )  {
-		do_output( filename );
-	} else {
-		unknown_com();
-	}
-}
-
-void setSavePros( char *rel, char *filename )
-{
-	if( strcmp(rel,"=")==0 )  {
-		do_output_pros( filename );
-	} else {
-		unknown_com();
-	}
-}
-
-/* 韻律情報の書き出し */
-void setSpeechFile( char *rel, char *filename )
-{
-	strcpy( slot_Speak_stat, "PROCESSING" );
-	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
-
-	if( strcmp(rel,"=")==0 )  {
-		refresh();
-		strcpy( slot_Speech_file, filename );
-		if( prop_SpeechFile == AutoOutput )  inqSpeechFile();
-
-		read_speech_file( filename );
-	
-		if( prop_Text_pho == AutoOutput )  inqTextPho();
-		if( prop_Speak_pho == AutoOutput )  inqSpeakPho();
-		if( prop_Text_dur == AutoOutput )  inqTextDur();
-		if( prop_Speak_dur == AutoOutput )  inqSpeakDur();
-	} else {
-		unknown_com();
-	}
-	strcpy( slot_Speak_stat, "READY" );
-	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
-}
-
-/* 韻律情報の読み込み */
-void setProsFile( char *rel, char *filename )
-{
-	int error;
-
-	strcpy( slot_Speak_stat, "PROCESSING" );
-	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
-
-	if( strcmp(rel,"=")==0 )  {
-		strcpy( slot_Pros_file, filename );
-		if( prop_ProsFile == AutoOutput )  inqProsFile();
-
-		refresh();
-		/* prosBuf に各種パラメータを読み込む */
-		error = read_pros_file( filename );
-		if( ! error )  {
-
-			text_analysis( input_text );	/* テキスト解析 */
-			if( prop_Text_text == AutoOutput )  inqTextText();
-			if( prop_Speak_text == AutoOutput )  inqSpeakText();
-
-/*		parameter_generation();		*/
-
-			init_parameter(); /* パラメータ生成の準備 */
-			make_duration(); /* 素のテキストから状態継続長を生成 */
-			modify_duration(); /* 継続長の修正(タグ処理) */
-
-			/* 音素継続長が修正されている場合は、状態継続長を
-			   計算しなおす */
-			update_duration();
-			
-			/* ここで、prosBuf のデータで音素時間長を設定する。 */
-
-			make_cumul_time(); /* 音素時間長の累積を計算 */
-			modify_voice(); /* 話者のスイッチ、αパラメータの変更(タグ処理) */
-
-			if( prop_Text_pho == AutoOutput )  inqTextPho();
-			if( prop_Speak_pho == AutoOutput )  inqSpeakPho();
-			if( prop_Text_dur == AutoOutput )  inqTextDur();
-			if( prop_Speak_dur == AutoOutput )  inqSpeakDur();
-
-			make_parameter(); /* パラメータ生成を実行 */
-
-			modify_f0(); /* F0の修正(タグ処理) */
-			modify_power(); /* パワーの修正(タグ処理) */
-
-/*		parameter_generation();	 ここまで	*/
-
-			/* 生成されたパラメータに対してF0とc0を更新 */
-			error = set_f0_and_power( filename );
-			if( ! error )  {
-				do_synthesis();		/* 合成波形の生成 */
-			}
-		}
-	} else {
-		unknown_com();
-	}
-	strcpy( slot_Speak_stat, "READY" );
-	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
-}
-
-/* 茶筌の結果をファイルから読み込み */
-void setParsedText( char *rel, char *filename )
-{
-	if( strcmp(rel,"=")==0 )  {
-		refresh();
-		text_analysis_file( filename );	/* テキスト解析 */
-		parameter_generation();	/* パラメータ生成(F0,MLSAフィルタ係数,継続長) */
-		do_synthesis();		/* 合成波形の生成 */
-#ifdef PRINTDATA
-		TmpMsg( "Synthesis Done.\n" );
-#endif
-	} else {
-		unknown_com();
-	}		
-}
-
-void setLog( char *rel, char *filename )
-{
-	if( strcmp(rel,"=")==0 )  {
-		if( logfp && strcmp(slot_Log_file,"CONSOLE")!=0 )  {
-			fclose( logfp );
-			logfp = NULL;
-		}
-		strcpy( slot_Log_file, filename );
-		if( strcmp(filename,"NO")==0 )  return;
-		if( strcmp(filename,"CONSOLE")==0 ) {
-			logfp = stderr;
-		} else {
-			logfp = fopen( filename, "a" );
-			if( logfp == NULL )   {
-			  ErrMsg( "log file open error ... '%s'\n", filename );
-			}
-		}
-	} else {
-		unknown_com();
-	}
-}
-
-int setLogYesNo( char *rel, char *val )
-{
-	if( strcmp(rel,"=")==0 )  {
-	  if( strcmp( val, "YES" )==0 ) {
-		return 1;
-	  } else {
-		return 0;
-	  }
-	} else {
-		unknown_com();
-		return 0;
-	}
-}
-
-void setErr( char *rel, char *filename )
-{
-	if( strcmp(rel,"=")==0 )  {
-		if( fp_err && strcmp(slot_Err_file,"CONSOLE")!=0 )  fclose( fp_err );
-		strcpy( slot_Err_file, filename );
-		if( strcmp(filename,"CONSOLE")==0 ) {
-			fp_err = stderr;
-		} else {
-			fp_err = fopen( filename, "a" );
-			if( fp_err == NULL )   {
-			  ErrMsg( "error log file open error ... '%s'\n", filename );
-			}
-		}
-	} else {
-		unknown_com();
-	}
-}
-
-/*---------------------------------------------------------*/
-
-void parameter_generation()
-{
-/* 音声合成の初期設定 */
-	init_parameter();
-
-/* 音素継続長の決定 */
-	make_duration();
-/* 音素継続長の変更 */
-	modify_duration();
-	make_cumul_time();
-	modify_voice();
-
-	if( prop_Text_pho == AutoOutput )  inqTextPho();
-	if( prop_Speak_pho == AutoOutput )  inqSpeakPho();
-	if( prop_Text_dur == AutoOutput )  inqTextDur();
-	if( prop_Speak_dur == AutoOutput )  inqSpeakDur();
-
-/* パラメータ生成 F0,MLSAフィルタ係数 */
-	make_parameter();
-
-/* F0, ゲイン b(0) の変更 */
-	modify_f0();
-	modify_power();
-}
-
-/*---------------------------------------------------------*/
-
-int 	n_arg;
-char	*v_arg[10];
-
-void unknown_com()
-{
-	int 	i;
-	ErrMsg( "* Unknown command line ... \n" );
-	for( i=0; i<n_arg; ++i )  { ErrMsg( "%s ", v_arg[i] ); }
-	ErrMsg( "\n" );
-}
-
-void usage( char* com )
-{
-	fprintf( stderr, "%s [-v] [-p port-num] [-C conf-file]\n", com );
-	fprintf( stderr, "   -v: print version and exit\n" );
-	fprintf( stderr, "   -p port-num: to set port number in server mode\n" );
-	fprintf( stderr, "   -C conf-gile: to set configuration file\n" );
-	exit(1);
-}
-
-extern int chasen_process;
-static jmp_buf ebuf;
-
-void restart( int val )
-{
-	RepMsg( "rep Speak.stat = ERROR\n" );
-	longjmp( ebuf, val );
-	refresh();
-}
-
-int main( int argc, char **argv )
-{
-	int n, i;
-	char *com;
-
-	fp_err = stderr;
-
-	init_conf();
-
-	com = argv[0];
-	--argc;  ++argv;
-	while( argc > 0 && argv[0][0] == '-' )  {
-		switch( argv[0][1] )  {
-		case 'C':
-			if( argc < 2 )  usage( com );
-			read_conf( argv[1] );
-			--argc;  ++argv;
-			break;
-		/*******↓for server mode *******/
-		case 'p':
-   		        /* 引数が不正な場合はエラー出力 */
-			if( argc < 2 )  usage( com );
-			/* ポート番号の読み込み */
-			i = atoi( argv[1] );
-			if (i > 1024) {
-			        nPort = i;
-			}
-			s_mode = 1;
-			--argc;  ++argv;
-			break;
-		/*******↑***********************/
-		case 'v':
-			printf( "%s\n", moduleVersion );
-			printf( "%s\n", protocolVersion );
-			exit(0);
-		default:
-			usage( com );
-		}
-		--argc;  ++argv;
-	}
-	set_default_conf();
-
-	initialize();
-
-	n = setjmp( ebuf );
-
-	if( n > 0 )  chasen_process = 0;	/* to restart 'chasen' process */
-
-	for( ;; )  {
-#ifdef PRINTDATA
-		TmpMsg( "> " );
-#endif
-		n_arg = read_command( v_arg );
-
-#ifdef PRINTDATA
-		{
-			int i;
-			TmpMsg( "command is \n" );
-			for( i=0; i<n_arg; ++i )  {
-				TmpMsg( "  %d: %s\n", i+1, v_arg[i] );
-			}
-		}
-#endif
-
-		/* 「o」 で set Speak = NOW のショートカット */
-		if( strcmp(v_arg[0],"o")==0 )  {
-			setSpeak( "=", "NOW" );
-			continue;
-		}
-
-		if( n_arg < 2 )  { unknown_com();  continue; }
-
-		switch( commandID( v_arg[0] ) )  {
-		  case C_set:
-			if( n_arg < 4 )  { unknown_com();  break; }
-			switch( slotID( v_arg[1] ) )  {
-			  case S_Run:   setRun( v_arg[2], v_arg[3] );  break;
-			  case S_Speaker:  setSpeaker( v_arg[2], v_arg[3] );  break;
-			  case S_Alpha: setAlpha( v_arg[2], v_arg[3] );  break;
-			  case S_Postfilter_coef: setPostfilter_coef( v_arg[2], v_arg[3] );  break;
-			  case S_Text:  setText( v_arg[2], v_arg[3] );  break;
-			  case S_Speak: setSpeak( v_arg[2], v_arg[3] );  break;
-			  case S_Save:  setSave( v_arg[2], v_arg[3] );  break;
-			  case S_SavePros:  setSavePros( v_arg[2], v_arg[3] );  break;
-			  case S_SpeechFile:  setSpeechFile( v_arg[2], v_arg[3] );  break;
-			  case S_ProsFile:  setProsFile( v_arg[2], v_arg[3] );  break;
-			  case S_ParsedText: setParsedText( v_arg[2], v_arg[3] );  break;
-			  case S_Speak_syncinterval: setSpeakSyncinterval( v_arg[2], v_arg[3] );  break;
-			  case S_AutoPlay: 
-				slot_Auto_play = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_AutoPlayDelay: 
-				slot_Auto_play_delay = atoi( v_arg[3] ); break;
-			  case S_Log:   setLog( v_arg[2], v_arg[3] ); break;
-			  case S_Log_conf:
-				slot_Log_conf = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_text:
-				slot_Log_text = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_arranged_text:
-				slot_Log_arranged_text = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_chasen:
-				slot_Log_chasen = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_tag:
-				slot_Log_tag = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_phoneme:
-				slot_Log_phoneme = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_mora:
-				slot_Log_mora = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_morph:
-				slot_Log_morph = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_aphrase:
-				slot_Log_aphrase = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_breath:
-				slot_Log_breath = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Log_sentence:
-				slot_Log_sentence = setLogYesNo( v_arg[2], v_arg[3] ); break;
-			  case S_Err:          setErr( v_arg[2], v_arg[3] ); break;
-			  default:
-				unknown_com();
-			}
-			break;
-		  case C_inq:
-			switch( slotID( v_arg[1] ) ) {
-			  case S_Run:        inqRun();  break;
-			  case S_ModuleVersion: inqModuleVersion();  break;
-			  case S_ProtocolVersion: inqProtocolVersion();  break;
-			  case S_SpeakerSet: inqSpeakerSet();  break;
-			  case S_Speaker:    inqSpeaker();  break;
-			  case S_SpeechFile: inqSpeechFile();  break;
-			  case S_ProsFile:   inqProsFile();  break;
-			  case S_AutoPlay:   inqAutoPlay();  break;
-			  case S_AutoPlayDelay:   inqAutoPlayDelay();  break;
-			  case S_Text_text:  inqTextText();  break;
-			  case S_Text_pho:   inqTextPho();  break;
-			  case S_Text_dur:   inqTextDur();  break;
-			  case S_Speak_text: inqSpeakText();  break;
-			  case S_Speak_pho:  inqSpeakPho();  break;
-			  case S_Speak_dur:  inqSpeakDur();  break;
-			  case S_Speak_utt:  inqSpeakUtt();  break;
-			  case S_Speak_len:  inqSpeakLen();  break;
-			  case S_Speak_stat: inqSpeakStat();  break;
-			  case S_Speak_syncinterval: inqSpeakSyncinterval();  break;
-			  case S_Log:
-				RepMsg( "rep Log = %s\n", slot_Log_file );  break;
-			  case S_Log_conf:
-				RepMsg( "rep Log.conf = %s\n", YesNoSlot(S_Log_conf) );  break;
-			  case S_Log_text:
-				RepMsg( "rep Log.text = %s\n", YesNoSlot(S_Log_text) );  break;
-			  case S_Log_arranged_text:
-				RepMsg( "rep Log.arranged_text = %s\n", YesNoSlot(S_Log_arranged_text) );  break;
-			  case S_Log_chasen:
-				RepMsg( "rep Log.chasen = %s\n", YesNoSlot(S_Log_chasen) );  break;
-			  case S_Log_tag:
-				RepMsg( "rep Log.tag = %s\n", YesNoSlot(S_Log_tag) );  break;
-			  case S_Log_phoneme:
-				RepMsg( "rep Log.phoneme = %s\n", YesNoSlot(S_Log_phoneme) );  break;
-			  case S_Log_mora:
-				RepMsg( "rep Log.mora = %s\n", YesNoSlot(S_Log_mora) );  break;
-			  case S_Log_morph:
-				RepMsg( "rep Log.morph = %s\n", YesNoSlot(S_Log_morph) );  break;
-			  case S_Log_aphrase:
-				RepMsg( "rep Log.aphrase = %s\n", YesNoSlot(S_Log_aphrase) );  break;
-			  case S_Log_breath:
-				RepMsg( "rep Log.breath = %s\n", YesNoSlot(S_Log_breath) );  break;
-			  case S_Log_sentence:
-				RepMsg( "rep Log.sentence = %s\n", YesNoSlot(S_Log_sentence) );  break;
-			  case S_Err:
-				RepMsg( "rep Err = %s\n", slot_Err_file );  break;
-			  default:
-				unknown_com();
-			}
-			break;
-		  case C_prop:
-			{ SlotProp prop;
-			if( strcmp(v_arg[2],"=")!=0 )  { unknown_com(); break; }
-			if( strcmp(v_arg[3],"AutoOutput")==0 )  {
-				prop = AutoOutput;
-			} else if(strcmp(v_arg[3],"NoAutoOutput")==0 )  {
-				prop = NoAutoOutput;
-			} else {
-				unknown_com(); break;
-			}
-			switch( slotID( v_arg[1] ) ) {
-			  case S_Run:        prop_Run = prop;  break;
-			  case S_ModuleVersion: prop_ModuleVersion = prop;  break;
-			  case S_ProtocolVersion: prop_ProtocolVersion = prop;  break;
-			  case S_SpeakerSet: prop_SpeakerSet = prop;  break;
-			  case S_Speaker:    prop_Speaker = prop;  break;
-			  case S_SpeechFile: prop_SpeechFile = prop;  break;
-			  case S_ProsFile:   prop_ProsFile = prop;  break;
-			  case S_Text:       prop_Text = prop;  break;
-			  case S_Text_text:  prop_Text_text = prop;  break;
-			  case S_Text_pho:   prop_Text_pho = prop;  break;
-			  case S_Text_dur:   prop_Text_dur = prop;  break;
-			  case S_Speak:      prop_Speak = prop;  break;
-			  case S_Speak_text: prop_Speak_text = prop;  break;
-			  case S_Speak_pho:  prop_Speak_pho = prop;  break;
-			  case S_Speak_dur:  prop_Speak_dur = prop;  break;
-			  case S_Speak_utt:  prop_Speak_utt = prop;  break;
-			  case S_Speak_len:  prop_Speak_len = prop;  break;
-			  case S_Speak_stat: prop_Speak_stat = prop;  break;
-			  case S_Speak_syncinterval: prop_Speak_syncinterval = prop;  break;
-			  default:
-				unknown_com();
-			}
-			}
-			break;
-		  default:
-			unknown_com();
-		}
-	}
-	
-	if( s_mode ) {
-	        server_destroy ();
-	}
-	exit(0);
-}
+/* Copyright (c) 2003-2008                                           */
+/*   Interactive Speech Technology Consortium (ISTC)                 */
+/*   All rights reserved                                             */
+/*                                                                   */
+/*   The code is developed by Yamashita-lab, Ritsumeikan University  */
+/*                                                                   */
+/* $Id: main.c,v 1.31 2009/02/12 17:43:42 sako Exp $                                                              */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <unistd.h>
+#include <sys/wait.h>
+#endif
+#include <setjmp.h>
+#include "synthesis.h"
+#include "command.h"
+#include "confpara.h"
+
+#include "misc.h"
+#include "model.h"
+#include "tree.h"
+#include "defaults.h"
+#include "hmmsynth.h"
+#include "mlpg.h"
+#include "tag.h"
+
+#define INIT_SLOT_TABLE
+#include "slot.h"
+
+#define YesNoSlot(s)  ( ( (s==1) ? "YES" : "NO" ) )
+
+char *moduleVersion = "GalateaTalk Ver. 1.5.0 (gtalk-080731)";
+char *protocolVersion = "Protocol Ver. 1.0";
+
+/* synthesis.h グローバル変数の定義 */
+MORPH *mphead;
+MORPH *mptail;
+PHONEME *phhead;
+PHONEME *phtail;
+MORA *mrhead;
+MORA *mrtail;
+APHRASE *ahead;
+APHRASE *atail;
+BREATH *bhead;
+BREATH *btail;
+SENTENCE *shead;
+SENTENCE *stail;
+SENTENCE *sentence;
+WAVE wave;
+PARAM power;
+PARAM f0;
+PARAM alpha;
+/*******↓for server mode ********/
+int s_mode = 0;
+int nPort = 10600;
+/********↑***********************/
+
+PROS prosBuf;	/* 韻律データの一時格納用 */
+
+/* confpara.h グローバル変数の定義 */
+char *phlist_file;
+char *chasen_bin;
+char *chasen_dll;
+char *chaone_xsl;
+char *chasen_rc;
+char *chaone_bin;
+char *chaone_xsl;
+char *read_number;
+char *read_alphabet;
+char *read_date;
+char *read_time;
+int n_speaker;	/* 登録された話者数 */
+int spid;	/* 現在の話者ID */
+FILE *logfp;
+SPEAKER speaker[MAX_SPEAKER];
+char *dic_file;
+
+/* hmmsynth.h グローバル変数定義 */
+int nstate;
+int pitchstream;
+int mcepvsize;
+ModelSet mset[MAX_SPEAKER];
+double **mcep;  /* generated mel-cepstrum */
+double **coeff; /* mlsa filter coefficients */
+int totalframe;
+
+/* mlpg.h */
+PStream pitchpst;
+PStream mceppst;
+Boolean *voiced;
+
+/* model.h */
+Model *mhead;
+Model *mtail;
+FILE *durmodel;
+FILE *pitchmodel;
+FILE *mcepmodel;
+
+/* tag.h */
+TAG *tag[MAX_TAG];
+int n_tag;
+
+/* slot.h */
+SlotProp prop_Run;
+SlotProp prop_ModuleVersion;
+SlotProp prop_ProtocolVersion;
+SlotProp prop_SpeakerSet;
+SlotProp prop_Speaker;
+SlotProp prop_SpeechFile;
+SlotProp prop_ProsFile;
+SlotProp prop_Text;
+SlotProp prop_Text_text;
+SlotProp prop_Text_pho;
+SlotProp prop_Text_dur;
+SlotProp prop_Speak;
+SlotProp prop_Speak_text;
+SlotProp prop_Speak_pho;
+SlotProp prop_Speak_dur;
+SlotProp prop_Speak_utt;
+SlotProp prop_Speak_len;
+SlotProp prop_Speak_stat;
+SlotProp prop_Speak_syncinterval;
+
+/* slots */
+char slot_Run[20];
+char slot_Speak_stat[20];
+char input_text[MAX_TEXT_LEN];  /* 入力されたテキスト(タグつき) */
+char spoken_text[MAX_TEXT_LEN]; /* 音声出力された発話のテキスト */
+char slot_Log_file[256];
+char slot_Err_file[256];
+char slot_Speech_file[512];
+char slot_Pros_file[512];
+int slot_Auto_play;
+int slot_Auto_play_delay;
+int slot_n_phonemes;
+int slot_total_dur;
+int slot_Log_chasen;
+int slot_Log_tag;
+int slot_Log_phoneme;
+int slot_Log_mora;
+int slot_Log_morph;
+int slot_Log_aphrase;
+int slot_Log_breath;
+int slot_Log_conf;
+int slot_Log_text;
+int slot_Log_arranged_text;
+int slot_Log_sentence;
+int slot_Speak_syncinterval;
+
+/* chaone */
+#ifdef WIN32
+#include "chaone.h"
+#endif
+
+void setRun( char*, char* );
+void init_conf();
+void read_conf(char *);
+int speakerID(char *);
+void set_default_conf();
+void init_text_analysis();
+void init_hmmsynth();
+void set_da_signal();
+void read_phonemes(char *);
+void read_dic(char *);
+void init_tag();
+void init_mora();
+void init_morph();
+void init_aphrase();
+void init_breath();
+void init_phoneme();
+void init_sentence();
+void refresh_text_analysis();
+void refresh_tag();
+void refresh_mora();
+void refresh_morph();
+void refresh_aphrase();
+void refresh_breath();
+void refresh_phoneme();
+void refresh_sentence();
+void refresh_hmmsynth();
+void refresh_vocoder();
+int RepMsg(char *, ...);
+int TmpMsg(char *, ...);
+int ErrMsg(char *, ...);
+void init_parameter();
+void make_duration();
+void make_parameter();
+void unknown_com();
+void restart(int);
+void text_analysis();
+void send_speakerset();
+void send_speaker();
+void send_text(char *);
+void send_phonemes(char *);
+void send_duration(char *);
+void send_talked_phonemes();
+void send_talked_duration();
+void do_synthesis();
+void do_output(char *);
+void do_output_WAVfile(char *);
+void do_output_pros(char *);
+void read_speech_file(char *, SPEECHFILETYPE);
+int read_pros_file(char *);
+int set_f0_and_power(char *);
+void update_duration();
+void abort_output();
+void text_analysis_file();
+void reset_output();
+void parameter_generation();
+void modify_duration();
+void make_cumul_time();
+void modify_f0();
+void modify_power();
+void modify_voice();
+int make_sleep_time(char *, long *);
+void sig_wait_da();
+int getline( char *buf, int MAX_LENGTH );
+/*******↓for server mode ********/
+void refresh_server ( void );
+int server_init ( int port );
+void server_close_client ( void );
+int server_getline ( char *buf, int buf_size );
+void server_destroy ( void );
+/********↑***********************/
+void SetRun( char *rel, char *val);
+
+extern FILE *fp_err;
+
+void init_slot_prop()
+{
+	prop_Run = AutoOutput;
+	prop_ModuleVersion = AutoOutput;
+	prop_ProtocolVersion = AutoOutput;
+	prop_SpeakerSet = AutoOutput;
+	prop_Speaker = AutoOutput;
+	prop_SpeechFile = AutoOutput;
+	prop_ProsFile = AutoOutput;
+	prop_Text = AutoOutput;
+	prop_Text_text = AutoOutput;
+	prop_Text_pho = AutoOutput;
+	prop_Text_dur = AutoOutput;
+	prop_Speak = AutoOutput;
+	prop_Speak_text = AutoOutput;
+	prop_Speak_pho = AutoOutput;
+	prop_Speak_dur = AutoOutput;
+	prop_Speak_utt = AutoOutput;
+	prop_Speak_len = AutoOutput;
+	prop_Speak_stat = AutoOutput;
+	prop_Speak_syncinterval = AutoOutput;
+}
+
+/* 初期化: プログラム起動時に一度だけ実行 */
+void initialize()
+{
+	void setRun();
+
+	/*******↓for server mode *******/
+	if (s_mode) {
+	        server_init( nPort );
+	}
+	/*******↑***********************/
+	
+#ifndef WIN32
+	setpgrp();
+#endif
+	set_da_signal();
+
+	init_slot_prop();
+	init_text_analysis();
+	init_hmmsynth();
+	read_phonemes( phlist_file );
+	read_dic( dic_file );
+	init_tag();
+	init_mora();
+	init_morph();
+	init_aphrase();
+	init_breath();
+	init_phoneme();
+	init_sentence();
+	strcpy( slot_Speak_stat, "IDLE" );
+	setRun( "=", "LIVE" );
+	strcpy( slot_Log_file, "NO" );   logfp = NULL;
+	slot_Log_chasen= slot_Log_tag = slot_Log_phoneme = 0;
+	slot_Log_mora = slot_Log_morph = slot_Log_aphrase = 0;
+	slot_Log_breath = slot_Log_sentence = 0;
+	strcpy( slot_Err_file, "CONSOLE" );
+	slot_Speech_file[0] = '\0';
+	slot_Pros_file[0] = '\0';
+	prosBuf.nPhoneme = 0;
+	slot_Speak_syncinterval = 1000;
+}
+
+void refresh_prosBuf()
+{
+	if( prosBuf.nPhoneme == 0 )  return;
+
+	free( prosBuf.ph_name );
+	free( prosBuf.ph_dur );
+	free( prosBuf.fr_power );
+	free( prosBuf.fr_f0 );
+	prosBuf.nPhoneme = prosBuf.nFrame = 0;
+}
+
+/* 初期化: 合成を行うたびに実行 */
+void refresh()
+{
+	refresh_text_analysis();
+	refresh_tag();
+	refresh_mora();
+	refresh_morph();
+	refresh_aphrase();
+	refresh_breath();
+	refresh_phoneme();
+	refresh_sentence();
+	refresh_hmmsynth();
+	refresh_prosBuf();
+	refresh_server();
+}
+
+int commandID( char *com )
+{
+	int 	i;
+	for( i=0; i<NUM_COMMAND; ++i )  {
+		if( strcmp(com,commandTable[i].name)==0 )  return commandTable[i].id;
+	}
+	return -1;
+}
+
+int slotID( char *slot )
+{
+	int 	i;
+	for( i=0; i<NUM_SLOT; ++i )  {
+		if( strcmp(slot,slotTable[i].name)==0 )  return slotTable[i].id;
+	}
+	return -1;
+}
+
+#define MAX_COMMAND_LEN 8192  /* 入力コマンドの最大文字数 */
+static char cline[MAX_COMMAND_LEN];
+
+int read_command( char **args )
+{
+	int 	n=0, p=0;
+	char	*c;
+
+	if( s_mode ) {
+	        if (server_getline( cline, MAX_COMMAND_LEN ) <= 0) {
+  		        args[0] = "";
+   		        return 0;
+		}
+	} else {
+	        if( getline( cline, MAX_COMMAND_LEN ) < 0)
+		        setRun( "=", "EXIT" );
+		if( ! strlen( cline) > 0) return 0;
+	}
+	c = cline;
+
+/* to skip space */
+	while( *c==' ' || *c=='\t' )  { ++c; };
+
+/* to get a command name */
+	*(args++) = c;
+	while( *c!=' ' && *c!='\t' && *c!='\n' && *c!= EOF )  {
+		c++;
+	}
+	*(c++) = '\0';  ++n;
+
+/* to skip space */
+	while( *c==' ' || *c=='\t' )  { ++c; };
+
+/* to get a slot name */
+	*(args++) = c;
+	while( *c!=' ' && *c!='\t' && *c!='=' && *c!='<' && *c!='\n' && *c!= EOF )  {
+		c++;
+	};
+	*(c++) = '\0';  ++n;
+
+/* to skip space */
+	while( *c==' ' || *c=='\t' )  { ++c; };
+
+/* to get relation */
+	*(args++) = c;
+	if( *c=='=' || *c=='<' )  {
+		c++;
+		if( *(c-1)=='<' && *c=='<' )  {
+			c++;
+		}
+		*(c++) = '\0';  ++n;
+	}
+
+/* to skip space */
+	while( *c==' ' || *c=='\t' )  { ++c; };
+
+/* to get a value */
+	*(args++) = c;
+	while( *c!='\n' && *c!='\0' && *c!= EOF )  {
+		c++;
+	};
+	*c = '\0';  ++n;
+
+	return n;
+}
+
+
+/*---------------------------------------------------------*/
+/*      inq command                                        */
+/*---------------------------------------------------------*/
+
+void inqRun()
+{
+	RepMsg( "rep Run = %s\n", slot_Run );
+}
+
+void inqModuleVersion()
+{
+	RepMsg( "rep ModuleVersion = \"%s\"\n", moduleVersion );
+}
+
+void inqProtocolVersion()
+{
+	RepMsg( "rep ProtocolVersion = \"%s\"\n", protocolVersion );
+}
+
+void inqSpeakerSet()
+{
+	send_speakerset();
+}
+
+void inqSpeaker()
+{
+	send_speaker();
+}
+
+void inqSpeechFile()
+{
+	RepMsg( "rep SpeechFile = %s\n", slot_Speech_file );
+}
+
+void inqProsFile()
+{
+	RepMsg( "rep ProsFile = %s\n", slot_Pros_file );
+}
+
+void inqAutoPlay()
+{
+	if( slot_Auto_play )  {
+		RepMsg( "rep AutoPlay = YES\n" );
+	} else {
+		RepMsg( "rep AutoPlay = NO\n" );
+	}
+}
+
+void inqAutoPlayDelay()
+{
+	RepMsg( "rep AutoPlayDelay = \"%d\"\n", slot_Auto_play_delay );
+}
+
+void inqTextText()
+{
+//	send_text( "Text.text" );
+	RepMsg( "rep Text.text = %s\n", input_text );
+}
+
+void inqTextPho()
+{
+	send_phonemes( "Text.pho" );
+}
+
+void inqTextDur()
+{
+	send_duration( "Text.dur" );
+}
+
+void inqSpeakText()
+{
+//	send_text( "Speak.text" );
+	RepMsg( "rep Speak.text = %s\n", spoken_text );
+}
+
+void inqSpeakPho()
+{
+	send_phonemes( "Speak.pho" );
+}
+
+void inqSpeakDur()
+{
+	send_duration( "Speak.dur" );
+}
+
+void inqSpeakUtt()
+{
+	send_talked_phonemes();
+}
+
+void inqSpeakLen()
+{
+	send_talked_duration();
+}
+
+void inqSpeakStat()
+{
+	RepMsg( "rep Speak.stat = %s\n", slot_Speak_stat );
+}
+
+void inqSpeakSyncinterval()
+{
+	RepMsg( "rep Speak.syncinterval = %d\n", slot_Speak_syncinterval );
+}
+
+/*---------------------------------------------------------*/
+/*      set command                                        */
+/*---------------------------------------------------------*/
+
+void setRun( char *rel, char *val )
+{
+	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
+
+	if( strcmp(val,"EXIT")==0 )  {
+		strcpy( slot_Run, "EXIT" );
+		if( prop_Run == AutoOutput )  inqRun();
+#ifdef WIN32
+		Sleep(3000);
+#else
+		sleep(3);
+#endif
+		if( s_mode ) {
+   		        server_destroy();
+		}
+		exit(0);
+	} else if( s_mode && strcmp(val,"CLOSE")==0 )  {
+	        server_close_client();
+	} else if( strcmp(val,"LIVE")==0 )  {
+		strcpy( slot_Run, "LIVE" );
+		if( prop_Run == AutoOutput )  inqRun();
+	} else {
+		unknown_com();
+	}
+}
+
+void setSpeaker( char *rel, char *val )
+{
+	int s;
+
+	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
+
+	s = speakerID( val );
+	if( s >= 0 )  {
+		spid = s;
+		if( prop_Speaker == AutoOutput )  inqSpeaker();
+	}
+}
+
+/* その時に選択されている話者 spid のαをセットする。*/
+void setAlpha( char *rel, char *val )
+{
+	double a;
+
+	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
+
+	a = atof( val );
+	if( a >= 0.0 )  {
+		speaker[spid].alpha = a;
+	}
+}
+
+/* その時に選択されている話者 spid のポストフィルタ係数をセットする。*/
+void setPostfilter_coef( char *rel, char *val)
+{
+	double a;
+
+	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
+
+	a = atof( val );
+	if( a >= 0.0 )  {
+		speaker[spid].postfilter_coef = a;
+	}
+}
+
+void setText( char *rel, char *val )
+{
+	strcpy( slot_Speak_stat, "PROCESSING" );
+	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
+
+	if( strcmp(rel,"=")==0 )  {
+		refresh();
+		text_analysis( val );	/* テキスト解析 */
+		if( prop_Text_text == AutoOutput )  inqTextText();
+		if( prop_Speak_text == AutoOutput )  inqSpeakText();
+
+		parameter_generation();	/* パラメータ生成(F0,MLSAフィルタ係数,継続長) */
+		do_synthesis();		/* 合成波形の生成 */
+#ifdef PRINTDATA
+		TmpMsg( "Synthesis Done.\n" );
+#endif
+/*	} else if( strcmp(rel,"<")==0 )  {
+	} else if( strcmp(rel,"<<")==0 )  {
+*/		
+	} else {
+		unknown_com();
+	}		
+	strcpy( slot_Speak_stat, "READY" );
+	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
+}
+
+void setSpeak( char *rel, char *val )
+{
+	int error;
+	long sleep_ms;
+
+	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
+
+	if( strcmp(val,"NOW")==0 )  {
+		strcpy( slot_Speak_stat, "SPEAKING" );
+		if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
+		do_output(NULL);	/* 音声出力 */
+
+	} else if( strcmp(val,"STOP")==0 )  {
+		abort_output();
+
+	} else {
+		/* val = "12:34:56.789" or "+1000" */
+		error = make_sleep_time( val, &sleep_ms );
+		if( error )  {
+			unknown_com();
+		} else {
+#ifdef PRINTDATA
+			TmpMsg( "sleep_ms: %d\n", sleep_ms );
+#endif
+			if( sleep_ms > 0 ) {
+#ifdef WIN32
+			        Sleep( sleep_ms );
+#else
+			        usleep( 1000*sleep_ms );
+#endif
+			}
+			strcpy( slot_Speak_stat, "SPEAKING" );
+			if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
+			do_output(NULL);	/* 音声出力 */
+		}
+	}
+/*	strcpy( slot_Speak_stat, "IDLE" );
+	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
+*/
+}
+
+void setSpeakSyncinterval( char *rel, char *val )
+{
+        int interval;
+	
+	if( strcmp(rel,"=")!=0 )  { unknown_com();  return; }
+	
+	interval = atoi( val );
+
+	if( interval >= 0) {
+	        slot_Speak_syncinterval = interval;
+	        if( prop_Speak_syncinterval == AutoOutput )  inqSpeakSyncinterval();
+	}
+}
+
+/*-------------------*/
+
+void setSave( char *rel, char *filename )
+{
+	if( strcmp(rel,"=")==0 )  {
+		do_output( filename );
+	} else {
+		unknown_com();
+	}
+}
+
+void setSaveWAV( char *rel, char *filename )
+{
+	if( strcmp(rel,"=")==0 )  {
+		do_output_WAVfile( filename );
+	} else {
+		unknown_com();
+	}
+}
+
+/* 韻律情報の書き出し */
+void setSavePros( char *rel, char *filename )
+{
+	if( strcmp(rel,"=")==0 )  {
+		do_output_pros( filename );
+	} else {
+		unknown_com();
+	}
+}
+
+/* 音声データの読み込み */
+void setSpeechFile( char *rel, char *filename, SPEECHFILETYPE type )
+{
+	strcpy( slot_Speak_stat, "PROCESSING" );
+	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
+
+	if( strcmp(rel,"=")==0 )  {
+		refresh();
+		strcpy( slot_Speech_file, filename );
+		if( prop_SpeechFile == AutoOutput )  inqSpeechFile();
+
+		read_speech_file( filename, type );
+	
+		if( prop_Text_pho == AutoOutput )  inqTextPho();
+		if( prop_Speak_pho == AutoOutput )  inqSpeakPho();
+		if( prop_Text_dur == AutoOutput )  inqTextDur();
+		if( prop_Speak_dur == AutoOutput )  inqSpeakDur();
+	} else {
+		unknown_com();
+	}
+	strcpy( slot_Speak_stat, "READY" );
+	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
+}
+
+/* 韻律情報の読み込み */
+void setProsFile( char *rel, char *filename )
+{
+	int error;
+
+	strcpy( slot_Speak_stat, "PROCESSING" );
+	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
+
+	if( strcmp(rel,"=")==0 )  {
+		strcpy( slot_Pros_file, filename );
+		if( prop_ProsFile == AutoOutput )  inqProsFile();
+
+		refresh();
+		/* prosBuf に各種パラメータを読み込む */
+		error = read_pros_file( filename );
+		if( ! error )  {
+
+			text_analysis( input_text );	/* テキスト解析 */
+			if( prop_Text_text == AutoOutput )  inqTextText();
+			if( prop_Speak_text == AutoOutput )  inqSpeakText();
+
+/*		parameter_generation();		*/
+
+			init_parameter(); /* パラメータ生成の準備 */
+			make_duration(); /* 素のテキストから状態継続長を生成 */
+			modify_duration(); /* 継続長の修正(タグ処理) */
+
+			/* 音素継続長が修正されている場合は、状態継続長を
+			   計算しなおす */
+			update_duration();
+			
+			/* ここで、prosBuf のデータで音素時間長を設定する。 */
+
+			make_cumul_time(); /* 音素時間長の累積を計算 */
+			modify_voice(); /* 話者のスイッチ、αパラメータの変更(タグ処理) */
+
+			if( prop_Text_pho == AutoOutput )  inqTextPho();
+			if( prop_Speak_pho == AutoOutput )  inqSpeakPho();
+			if( prop_Text_dur == AutoOutput )  inqTextDur();
+			if( prop_Speak_dur == AutoOutput )  inqSpeakDur();
+
+			make_parameter(); /* パラメータ生成を実行 */
+
+			modify_f0(); /* F0の修正(タグ処理) */
+			modify_power(); /* パワーの修正(タグ処理) */
+
+/*		parameter_generation();	 ここまで	*/
+
+			/* 生成されたパラメータに対してF0とc0を更新 */
+			error = set_f0_and_power( filename );
+			if( ! error )  {
+				do_synthesis();		/* 合成波形の生成 */
+			}
+		}
+	} else {
+		unknown_com();
+	}
+	strcpy( slot_Speak_stat, "READY" );
+	if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
+}
+
+/* 茶筌の結果をファイルから読み込み */
+void setParsedText( char *rel, char *filename )
+{
+	if( strcmp(rel,"=")==0 )  {
+		refresh();
+		text_analysis_file( filename );	/* テキスト解析 */
+		parameter_generation();	/* パラメータ生成(F0,MLSAフィルタ係数,継続長) */
+		do_synthesis();		/* 合成波形の生成 */
+#ifdef PRINTDATA
+		TmpMsg( "Synthesis Done.\n" );
+#endif
+	} else {
+		unknown_com();
+	}		
+}
+
+void setLog( char *rel, char *filename )
+{
+	if( strcmp(rel,"=")==0 )  {
+		if( logfp && strcmp(slot_Log_file,"CONSOLE")!=0 )  {
+			fclose( logfp );
+			logfp = NULL;
+		}
+		strcpy( slot_Log_file, filename );
+		if( strcmp(filename,"NO")==0 )  return;
+		if( strcmp(filename,"CONSOLE")==0 ) {
+			logfp = stderr;
+		} else {
+			logfp = fopen( filename, "a" );
+			if( logfp == NULL )   {
+			  ErrMsg( "log file open error ... '%s'\n", filename );
+			}
+		}
+	} else {
+		unknown_com();
+	}
+}
+
+int setLogYesNo( char *rel, char *val )
+{
+	if( strcmp(rel,"=")==0 )  {
+	  if( strcmp( val, "YES" )==0 ) {
+		return 1;
+	  } else {
+		return 0;
+	  }
+	} else {
+		unknown_com();
+		return 0;
+	}
+}
+
+void setErr( char *rel, char *filename )
+{
+	if( strcmp(rel,"=")==0 )  {
+		if( fp_err && strcmp(slot_Err_file,"CONSOLE")!=0 )  fclose( fp_err );
+		strcpy( slot_Err_file, filename );
+		if( strcmp(filename,"CONSOLE")==0 ) {
+			fp_err = stderr;
+		} else {
+			fp_err = fopen( filename, "a" );
+			if( fp_err == NULL )   {
+			  ErrMsg( "error log file open error ... '%s'\n", filename );
+			}
+		}
+	} else {
+		unknown_com();
+	}
+}
+
+/*---------------------------------------------------------*/
+
+void parameter_generation()
+{
+/* 音声合成の初期設定 */
+	init_parameter();
+
+/* 音素継続長の決定 */
+	make_duration();
+/* 音素継続長の変更 */
+	modify_duration();
+	make_cumul_time();
+	modify_voice();
+
+	if( prop_Text_pho == AutoOutput )  inqTextPho();
+	if( prop_Speak_pho == AutoOutput )  inqSpeakPho();
+	if( prop_Text_dur == AutoOutput )  inqTextDur();
+	if( prop_Speak_dur == AutoOutput )  inqSpeakDur();
+
+/* パラメータ生成 F0,MLSAフィルタ係数 */
+	make_parameter();
+
+/* F0, ゲイン b(0) の変更 */
+	modify_f0();
+	modify_power();
+}
+
+/*---------------------------------------------------------*/
+
+int 	n_arg;
+char	*v_arg[10];
+
+void unknown_com()
+{
+	int 	i;
+	ErrMsg( "* Unknown command line ... \n" );
+	for( i=0; i<n_arg; ++i )  { ErrMsg( "%s ", v_arg[i] ); }
+	ErrMsg( "\n" );
+}
+
+void usage( char* com )
+{
+	fprintf( stderr, "%s [-v] [-p port-num] [-C conf-file]\n", com );
+	fprintf( stderr, "   -v: print version and exit\n" );
+	fprintf( stderr, "   -p port-num: to set port number in server mode\n" );
+	fprintf( stderr, "   -C conf-gile: to set configuration file\n" );
+	exit(1);
+}
+
+extern int chasen_process;
+static jmp_buf ebuf;
+
+void restart( int val )
+{
+	RepMsg( "rep Speak.stat = ERROR\n" );
+	longjmp( ebuf, val );
+	refresh();
+}
+
+int main( int argc, char **argv )
+{
+	int n, i;
+	char *com;
+
+	fp_err = stderr;
+
+	init_conf();
+
+	com = argv[0];
+	--argc;  ++argv;
+	while( argc > 0 && argv[0][0] == '-' )  {
+		switch( argv[0][1] )  {
+		case 'C':
+			if( argc < 2 )  usage( com );
+			read_conf( argv[1] );
+			--argc;  ++argv;
+			break;
+		/*******↓for server mode *******/
+		case 'p':
+   		        /* 引数が不正な場合はエラー出力 */
+			if( argc < 2 )  usage( com );
+			/* ポート番号の読み込み */
+			i = atoi( argv[1] );
+			if (i > 1024) {
+			        nPort = i;
+			}
+			s_mode = 1;
+			--argc;  ++argv;
+			break;
+		/*******↑***********************/
+		case 'v':
+			printf( "%s\n", moduleVersion );
+			printf( "%s\n", protocolVersion );
+			exit(0);
+		default:
+			usage( com );
+		}
+		--argc;  ++argv;
+	}
+	set_default_conf();
+
+	initialize();
+
+	n = setjmp( ebuf );
+
+	if( n > 0 )  chasen_process = 0;	/* to restart 'chasen' process */
+
+	for( ;; )  {
+#ifdef PRINTDATA
+		TmpMsg( "> " );
+#endif
+		n_arg = read_command( v_arg );
+
+#ifdef PRINTDATA
+		{
+			int i;
+			TmpMsg( "command is \n" );
+			for( i=0; i<n_arg; ++i )  {
+				TmpMsg( "  %d: %s\n", i+1, v_arg[i] );
+			}
+		}
+#endif
+
+		/* 「o」 で set Speak = NOW のショートカット */
+		if( strcmp(v_arg[0],"o")==0 )  {
+			setSpeak( "=", "NOW" );
+			continue;
+		}
+
+		if( n_arg < 2 )  { unknown_com();  continue; }
+
+		switch( commandID( v_arg[0] ) )  {
+		  case C_set:
+			if( n_arg < 4 )  { unknown_com();  break; }
+			switch( slotID( v_arg[1] ) )  {
+			  case S_Run:   setRun( v_arg[2], v_arg[3] );  break;
+			  case S_Speaker:  setSpeaker( v_arg[2], v_arg[3] );  break;
+			  case S_Alpha: setAlpha( v_arg[2], v_arg[3] );  break;
+			  case S_Postfilter_coef: setPostfilter_coef( v_arg[2], v_arg[3] );  break;
+			  case S_Text:  setText( v_arg[2], v_arg[3] );  break;
+			  case S_Speak: setSpeak( v_arg[2], v_arg[3] );  break;
+
+			  case S_SaveRAW: setSave( v_arg[2], v_arg[3] );  break;
+			  case S_Save:    setSave( v_arg[2], v_arg[3] );  break;
+			  case S_LoadRAW: setSpeechFile( v_arg[2], v_arg[3], RAW );  break;
+			  case S_SpeechFile: setSpeechFile( v_arg[2], v_arg[3], RAW );  break;
+			  case S_SaveWAV: setSaveWAV( v_arg[2], v_arg[3] );  break;
+			  case S_LoadWAV: setSpeechFile( v_arg[2], v_arg[3], WAV );  break;
+
+			  case S_SavePros:  setSavePros( v_arg[2], v_arg[3] );  break;
+			  case S_LoadPros:  setProsFile( v_arg[2], v_arg[3] );  break;
+			  case S_ProsFile:  setProsFile( v_arg[2], v_arg[3] );  break;
+
+			  case S_ParsedText: setParsedText( v_arg[2], v_arg[3] );  break;
+			  case S_Speak_syncinterval: setSpeakSyncinterval( v_arg[2], v_arg[3] );  break;
+			  case S_AutoPlay: 
+				slot_Auto_play = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_AutoPlayDelay: 
+				slot_Auto_play_delay = atoi( v_arg[3] ); break;
+			  case S_Log:   setLog( v_arg[2], v_arg[3] ); break;
+			  case S_Log_conf:
+				slot_Log_conf = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_text:
+				slot_Log_text = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_arranged_text:
+				slot_Log_arranged_text = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_chasen:
+				slot_Log_chasen = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_tag:
+				slot_Log_tag = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_phoneme:
+				slot_Log_phoneme = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_mora:
+				slot_Log_mora = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_morph:
+				slot_Log_morph = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_aphrase:
+				slot_Log_aphrase = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_breath:
+				slot_Log_breath = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Log_sentence:
+				slot_Log_sentence = setLogYesNo( v_arg[2], v_arg[3] ); break;
+			  case S_Err:          setErr( v_arg[2], v_arg[3] ); break;
+			  default:
+				unknown_com();
+			}
+			break;
+		  case C_inq:
+			switch( slotID( v_arg[1] ) ) {
+			  case S_Run:        inqRun();  break;
+			  case S_ModuleVersion: inqModuleVersion();  break;
+			  case S_ProtocolVersion: inqProtocolVersion();  break;
+			  case S_SpeakerSet: inqSpeakerSet();  break;
+			  case S_Speaker:    inqSpeaker();  break;
+			  case S_SpeechFile: inqSpeechFile();  break;
+			  case S_ProsFile:   inqProsFile();  break;
+			  case S_AutoPlay:   inqAutoPlay();  break;
+			  case S_AutoPlayDelay:   inqAutoPlayDelay();  break;
+			  case S_Text_text:  inqTextText();  break;
+			  case S_Text_pho:   inqTextPho();  break;
+			  case S_Text_dur:   inqTextDur();  break;
+			  case S_Speak_text: inqSpeakText();  break;
+			  case S_Speak_pho:  inqSpeakPho();  break;
+			  case S_Speak_dur:  inqSpeakDur();  break;
+			  case S_Speak_utt:  inqSpeakUtt();  break;
+			  case S_Speak_len:  inqSpeakLen();  break;
+			  case S_Speak_stat: inqSpeakStat();  break;
+			  case S_Speak_syncinterval: inqSpeakSyncinterval();  break;
+			  case S_Log:
+				RepMsg( "rep Log = %s\n", slot_Log_file );  break;
+			  case S_Log_conf:
+				RepMsg( "rep Log.conf = %s\n", YesNoSlot(S_Log_conf) );  break;
+			  case S_Log_text:
+				RepMsg( "rep Log.text = %s\n", YesNoSlot(S_Log_text) );  break;
+			  case S_Log_arranged_text:
+				RepMsg( "rep Log.arranged_text = %s\n", YesNoSlot(S_Log_arranged_text) );  break;
+			  case S_Log_chasen:
+				RepMsg( "rep Log.chasen = %s\n", YesNoSlot(S_Log_chasen) );  break;
+			  case S_Log_tag:
+				RepMsg( "rep Log.tag = %s\n", YesNoSlot(S_Log_tag) );  break;
+			  case S_Log_phoneme:
+				RepMsg( "rep Log.phoneme = %s\n", YesNoSlot(S_Log_phoneme) );  break;
+			  case S_Log_mora:
+				RepMsg( "rep Log.mora = %s\n", YesNoSlot(S_Log_mora) );  break;
+			  case S_Log_morph:
+				RepMsg( "rep Log.morph = %s\n", YesNoSlot(S_Log_morph) );  break;
+			  case S_Log_aphrase:
+				RepMsg( "rep Log.aphrase = %s\n", YesNoSlot(S_Log_aphrase) );  break;
+			  case S_Log_breath:
+				RepMsg( "rep Log.breath = %s\n", YesNoSlot(S_Log_breath) );  break;
+			  case S_Log_sentence:
+				RepMsg( "rep Log.sentence = %s\n", YesNoSlot(S_Log_sentence) );  break;
+			  case S_Err:
+				RepMsg( "rep Err = %s\n", slot_Err_file );  break;
+			  default:
+				unknown_com();
+			}
+			break;
+		  case C_prop:
+			{ SlotProp prop;
+			if( strcmp(v_arg[2],"=")!=0 )  { unknown_com(); break; }
+			if( strcmp(v_arg[3],"AutoOutput")==0 )  {
+				prop = AutoOutput;
+			} else if(strcmp(v_arg[3],"NoAutoOutput")==0 )  {
+				prop = NoAutoOutput;
+			} else {
+				unknown_com(); break;
+			}
+			switch( slotID( v_arg[1] ) ) {
+			  case S_Run:        prop_Run = prop;  break;
+			  case S_ModuleVersion: prop_ModuleVersion = prop;  break;
+			  case S_ProtocolVersion: prop_ProtocolVersion = prop;  break;
+			  case S_SpeakerSet: prop_SpeakerSet = prop;  break;
+			  case S_Speaker:    prop_Speaker = prop;  break;
+			  case S_SpeechFile: prop_SpeechFile = prop;  break;
+			  case S_ProsFile:   prop_ProsFile = prop;  break;
+			  case S_Text:       prop_Text = prop;  break;
+			  case S_Text_text:  prop_Text_text = prop;  break;
+			  case S_Text_pho:   prop_Text_pho = prop;  break;
+			  case S_Text_dur:   prop_Text_dur = prop;  break;
+			  case S_Speak:      prop_Speak = prop;  break;
+			  case S_Speak_text: prop_Speak_text = prop;  break;
+			  case S_Speak_pho:  prop_Speak_pho = prop;  break;
+			  case S_Speak_dur:  prop_Speak_dur = prop;  break;
+			  case S_Speak_utt:  prop_Speak_utt = prop;  break;
+			  case S_Speak_len:  prop_Speak_len = prop;  break;
+			  case S_Speak_stat: prop_Speak_stat = prop;  break;
+			  case S_Speak_syncinterval: prop_Speak_syncinterval = prop;  break;
+			  default:
+				unknown_com();
+			}
+			}
+			break;
+		  default:
+			unknown_com();
+		}
+	}
+	
+	if( s_mode ) {
+	        server_destroy ();
+	}
+	exit(0);
+}
Index: gtalk/slot.h
diff -u gtalk/slot.h:1.15 gtalk/slot.h:1.16
--- gtalk/slot.h:1.15	Thu Oct 19 12:26:33 2006
+++ gtalk/slot.h	Fri Feb 13 02:43:42 2009
@@ -1,149 +1,159 @@
-/* Copyright (c) 2000-2006                  */
-/*   Yamashita Lab., Ritsumeikan University */
-/*   All rights reserved                    */
-/*                                          */
-/* $Id: slot.h,v 1.15 2006/10/19 03:26:33 sako Exp $                                     */
-
-/* List of Slot */
-
-#define S_Run                    0
-#define S_ModuleVersion          1
-#define S_ProtocolVersion        2
-#define S_SpeakerSet            10
-#define S_Speaker               11
-#define S_Alpha                 12
-#define S_Postfilter_coef       13
-#define S_Text                  20
-#define S_Text_text             21
-#define S_Text_pho              22
-#define S_Text_dur              23
-#define S_Speak                 30
-#define S_Speak_text            31
-#define S_Speak_pho             32
-#define S_Speak_dur             33
-#define S_Speak_utt             34
-#define S_Speak_len             35
-#define S_Speak_stat            36
-#define S_Speak_syncinterval    37
-#define S_Save                  40
-#define S_SpeechFile            41
-#define S_SavePros              42
-#define S_ProsFile              43
-#define S_AutoPlay              44
-#define S_AutoPlayDelay         45
-#define S_ParsedText            50
-#define S_Log                  100	/* for debug */
-#define S_Log_conf             101	/* for debug */
-#define S_Log_text             102	/* for debug */
-#define S_Log_arranged_text    103	/* for debug */
-#define S_Log_chasen           104	/* for debug */
-#define S_Log_tag              105	/* for debug */
-#define S_Log_phoneme          106	/* for debug */
-#define S_Log_mora             107	/* for debug */
-#define S_Log_morph            108	/* for debug */
-#define S_Log_aphrase          109	/* for debug */
-#define S_Log_breath           110	/* for debug */
-#define S_Log_sentence         111	/* for debug */
-#define S_Err                  120	/* for debug */
-
-#ifdef INIT_SLOT_TABLE
-
-struct {
-	int 	id;
-	char	*name;
-} slotTable[] = {
-	{ S_Run, "Run" },
-	{ S_ModuleVersion, "ModuleVersion" },
-	{ S_ProtocolVersion, "ProtocolVersion" },
-	{ S_SpeakerSet, "SpeakerSet" },
-	{ S_Speaker, "Speaker" },
-	{ S_Alpha, "Alpha" },
-	{ S_Postfilter_coef, "Postfilter"},
-	{ S_Text, "Text" },
-	{ S_Text_text, "Text.text" },
-	{ S_Text_pho, "Text.pho" },
-	{ S_Text_dur, "Text.dur" },
-	{ S_Speak, "Speak" },
-	{ S_Speak_text, "Speak.text" },
-	{ S_Speak_pho, "Speak.pho" },
-	{ S_Speak_dur, "Speak.dur" },
-	{ S_Speak_utt, "Speak.utt" },
-	{ S_Speak_len, "Speak.len" },
-	{ S_Speak_stat, "Speak.stat" },
-	{ S_Speak_syncinterval, "Speak.syncinterval" },
-	{ S_Save,       "Save" },
-	{ S_SpeechFile, "SpeechFile" },
-	{ S_SavePros,   "SavePros" },
-	{ S_ProsFile,   "ProsFile" },
-	{ S_AutoPlay,   "AutoPlay" },
-	{ S_AutoPlayDelay,"AutoPlayDelay" },
-	{ S_ParsedText, "ParsedText" },
-	{ S_Log,          "Log" },
-	{ S_Log_conf,     "Log.conf" },
-	{ S_Log_text,     "Log.text" },
-	{ S_Log_arranged_text,  "Log.arrangedText" },
-	{ S_Log_chasen,   "Log.chasen" },
-	{ S_Log_tag,      "Log.tag" },
-	{ S_Log_phoneme,  "Log.phoneme" },
-	{ S_Log_mora,     "Log.mora" },
-	{ S_Log_morph,    "Log.morph" },
-	{ S_Log_aphrase,  "Log.aphrase" },
-	{ S_Log_breath,   "Log.breath" },
-	{ S_Log_sentence, "Log.sentence" },
-	{ S_Err,          "Err" }
-};
-
-#define NUM_SLOT ( sizeof(slotTable)/sizeof(slotTable[0]))
-
-#endif
-
-typedef enum {AutoOutput, NoAutoOutput} SlotProp;
-
-extern SlotProp prop_Run;
-extern SlotProp prop_ModuleVersion;
-extern SlotProp prop_ProtocolVersion;
-extern SlotProp prop_SpeakerSet;
-extern SlotProp prop_Speaker;
-extern SlotProp prop_SpeechFile;
-extern SlotProp prop_ProsFile;
-extern SlotProp prop_Text;
-extern SlotProp prop_Text_text;
-extern SlotProp prop_Text_pho;
-extern SlotProp prop_Text_dur;
-extern SlotProp prop_Speak;
-extern SlotProp prop_Speak_text;
-extern SlotProp prop_Speak_pho;
-extern SlotProp prop_Speak_dur;
-extern SlotProp prop_Speak_utt;
-extern SlotProp prop_Speak_len;
-extern SlotProp prop_Speak_stat;
-extern SlotProp prop_Speak_syncinterval;
-
-/* slots */
-
-#define MAX_TEXT_LEN 8192     /* 合成すべき文の最大文字数 */
-
-extern char slot_Run[20];
-extern char slot_Speak_stat[20];
-extern char input_text[MAX_TEXT_LEN];  /* 入力されたテキスト(タグつき) */
-extern char spoken_text[MAX_TEXT_LEN]; /* 音声出力された発話のテキスト */
-extern char slot_Log_file[256];
-extern char slot_Err_file[256];
-extern char slot_Speech_file[512];
-extern char slot_Pros_file[512];
-extern int slot_Auto_play;
-extern int slot_Auto_play_delay;	/* msec */
-extern int slot_n_phonemes;
-extern int slot_total_dur;
-extern int slot_Log_conf;
-extern int slot_Log_text;
-extern int slot_Log_arranged_text;
-extern int slot_Log_chasen;
-extern int slot_Log_tag;
-extern int slot_Log_phoneme;
-extern int slot_Log_mora;
-extern int slot_Log_morph;
-extern int slot_Log_aphrase;
-extern int slot_Log_breath;
-extern int slot_Log_sentence;
-extern int slot_Speak_syncinterval;
+/* Copyright (c) 2000-2006                  */
+/*   Yamashita Lab., Ritsumeikan University */
+/*   All rights reserved                    */
+/*                                          */
+/* $Id: slot.h,v 1.16 2009/02/12 17:43:42 sako Exp $                                     */
+
+/* List of Slot */
+
+#define S_Run                    0
+#define S_ModuleVersion          1
+#define S_ProtocolVersion        2
+#define S_SpeakerSet            10
+#define S_Speaker               11
+#define S_Alpha                 12
+#define S_Postfilter_coef       13
+#define S_Text                  20
+#define S_Text_text             21
+#define S_Text_pho              22
+#define S_Text_dur              23
+#define S_Speak                 30
+#define S_Speak_text            31
+#define S_Speak_pho             32
+#define S_Speak_dur             33
+#define S_Speak_utt             34
+#define S_Speak_len             35
+#define S_Speak_stat            36
+#define S_Speak_syncinterval    37
+#define S_SaveRAW               40
+#define S_LoadRAW               41
+#define S_SaveWAV               42
+#define S_LoadWAV               43
+#define S_SavePros              44
+#define S_LoadPros              45
+#define S_AutoPlay              46
+#define S_AutoPlayDelay         47
+#define S_Save                  50  /* 旧バージョンとの互換性のため残す */
+#define S_SpeechFile            51	/* 旧バージョンとの互換性のため残す */
+#define S_ProsFile              53	/* 旧バージョンとの互換性のため残す */
+#define S_ParsedText            60
+#define S_Log                  100	/* for debug */
+#define S_Log_conf             101	/* for debug */
+#define S_Log_text             102	/* for debug */
+#define S_Log_arranged_text    103	/* for debug */
+#define S_Log_chasen           104	/* for debug */
+#define S_Log_tag              105	/* for debug */
+#define S_Log_phoneme          106	/* for debug */
+#define S_Log_mora             107	/* for debug */
+#define S_Log_morph            108	/* for debug */
+#define S_Log_aphrase          109	/* for debug */
+#define S_Log_breath           110	/* for debug */
+#define S_Log_sentence         111	/* for debug */
+#define S_Err                  120	/* for debug */
+
+#ifdef INIT_SLOT_TABLE
+
+struct {
+	int 	id;
+	char	*name;
+} slotTable[] = {
+	{ S_Run, "Run" },
+	{ S_ModuleVersion, "ModuleVersion" },
+	{ S_ProtocolVersion, "ProtocolVersion" },
+	{ S_SpeakerSet, "SpeakerSet" },
+	{ S_Speaker, "Speaker" },
+	{ S_Alpha, "Alpha" },
+	{ S_Postfilter_coef, "Postfilter"},
+	{ S_Text, "Text" },
+	{ S_Text_text, "Text.text" },
+	{ S_Text_pho, "Text.pho" },
+	{ S_Text_dur, "Text.dur" },
+	{ S_Speak, "Speak" },
+	{ S_Speak_text, "Speak.text" },
+	{ S_Speak_pho, "Speak.pho" },
+	{ S_Speak_dur, "Speak.dur" },
+	{ S_Speak_utt, "Speak.utt" },
+	{ S_Speak_len, "Speak.len" },
+	{ S_Speak_stat, "Speak.stat" },
+	{ S_Speak_syncinterval, "Speak.syncinterval" },
+	{ S_SaveRAW,    "SaveRAW" },
+	{ S_LoadRAW,    "LoadRAW" },
+	{ S_SaveWAV,    "SaveWAV" },
+	{ S_LoadWAV,    "LoadWAV" },
+	{ S_SavePros,   "SavePros" },
+	{ S_LoadPros,   "LoadPros" },
+	{ S_Save,       "Save" },	  /* 旧バージョンとの互換性のため残す */
+	{ S_SpeechFile, "SpeechFile" },	  /* 旧バージョンとの互換性のため残す */
+	{ S_ProsFile,   "ProsFile" },	  /* 旧バージョンとの互換性のため残す */
+	{ S_AutoPlay,   "AutoPlay" },
+	{ S_AutoPlayDelay,"AutoPlayDelay" },
+	{ S_ParsedText, "ParsedText" },
+	{ S_Log,          "Log" },
+	{ S_Log_conf,     "Log.conf" },
+	{ S_Log_text,     "Log.text" },
+	{ S_Log_arranged_text,  "Log.arrangedText" },
+	{ S_Log_chasen,   "Log.chasen" },
+	{ S_Log_tag,      "Log.tag" },
+	{ S_Log_phoneme,  "Log.phoneme" },
+	{ S_Log_mora,     "Log.mora" },
+	{ S_Log_morph,    "Log.morph" },
+	{ S_Log_aphrase,  "Log.aphrase" },
+	{ S_Log_breath,   "Log.breath" },
+	{ S_Log_sentence, "Log.sentence" },
+	{ S_Err,          "Err" }
+};
+
+#define NUM_SLOT ( sizeof(slotTable)/sizeof(slotTable[0]))
+
+#endif
+
+typedef enum {AutoOutput, NoAutoOutput} SlotProp;
+
+extern SlotProp prop_Run;
+extern SlotProp prop_ModuleVersion;
+extern SlotProp prop_ProtocolVersion;
+extern SlotProp prop_SpeakerSet;
+extern SlotProp prop_Speaker;
+extern SlotProp prop_SpeechFile;
+extern SlotProp prop_ProsFile;
+extern SlotProp prop_Text;
+extern SlotProp prop_Text_text;
+extern SlotProp prop_Text_pho;
+extern SlotProp prop_Text_dur;
+extern SlotProp prop_Speak;
+extern SlotProp prop_Speak_text;
+extern SlotProp prop_Speak_pho;
+extern SlotProp prop_Speak_dur;
+extern SlotProp prop_Speak_utt;
+extern SlotProp prop_Speak_len;
+extern SlotProp prop_Speak_stat;
+extern SlotProp prop_Speak_syncinterval;
+
+/* slots */
+
+#define MAX_TEXT_LEN 8192     /* 合成すべき文の最大文字数 */
+
+extern char slot_Run[20];
+extern char slot_Speak_stat[20];
+extern char input_text[MAX_TEXT_LEN];  /* 入力されたテキスト(タグつき) */
+extern char spoken_text[MAX_TEXT_LEN]; /* 音声出力された発話のテキスト */
+extern char slot_Log_file[256];
+extern char slot_Err_file[256];
+extern char slot_Speech_file[512];
+extern char slot_Pros_file[512];
+extern int slot_Auto_play;
+extern int slot_Auto_play_delay;	/* msec */
+extern int slot_n_phonemes;
+extern int slot_total_dur;
+extern int slot_Log_conf;
+extern int slot_Log_text;
+extern int slot_Log_arranged_text;
+extern int slot_Log_chasen;
+extern int slot_Log_tag;
+extern int slot_Log_phoneme;
+extern int slot_Log_mora;
+extern int slot_Log_morph;
+extern int slot_Log_aphrase;
+extern int slot_Log_breath;
+extern int slot_Log_sentence;
+extern int slot_Speak_syncinterval;
Index: gtalk/ssm-win.conf
diff -u gtalk/ssm-win.conf:1.5 gtalk/ssm-win.conf:1.6
--- gtalk/ssm-win.conf:1.5	Fri Oct 13 19:16:11 2006
+++ gtalk/ssm-win.conf	Fri Feb 13 02:43:42 2009
@@ -5,16 +5,16 @@
 #CHASEN: /usr/local/bin/chasen
 
 # path name of 'libchasen.dll' (only for Windows)
-CHASEN-DLL:  ../chasen-2.3.3/lib/libchasen.dll
+CHASEN-DLL:  ../chasen-2.4.1/lib/libchasen.dll
 
 # configuration file for 'chasen'
 CHASEN-RC: ./chasenrc-win
 
 # command of running 'chaone'
-CHAONE: ../morph/chaone-win-1.3.0/chaone
+CHAONE: ../morph/chaone-win-1.3.2/chaone
 
 # path name of 'chaone.xsl' (only for Windows)
-CHAONE-XSL-FILE: ../chaone-win-1.3.0/chaone_t_Shift_JIS.xsl
+CHAONE-XSL-FILE: ../chaone-win-1.3.2/chaone4gtalk_win.xsl
 
 # default for numbers and alphabets
 NUMBER: DECIMAL
Index: gtalk/ssm.conf
diff -u gtalk/ssm.conf:1.22 gtalk/ssm.conf:1.23
--- gtalk/ssm.conf:1.22	Thu Jul 12 16:47:36 2007
+++ gtalk/ssm.conf	Fri Feb 13 02:43:42 2009
@@ -1,62 +1,62 @@
-# configuratiuon file for gtalk (GalateaTalk)
-
-# path name of 'chasen'
-CHASEN: ../morph/chasen-2.3.3/chasen/chasen
-#CHASEN: /usr/local/bin/chasen
-
-# configuration file for 'chasen'
-CHASEN-RC: ./chasenrc
-
-# command of running 'chaone'
-CHAONE: ../morph/chaone-1.3.0/chaone -s gtalk
-
-# path name of 'chaone.xsl' (only for library-based version)
-#CHAONE-XSL-FILE: ../chaone-1.2.0/chaone_t_EUC-JP.xsl
-
-# default for numbers and alphabets
-NUMBER: DECIMAL
-ALPHABET: WORD
-DATE: YMD
-TIME: hms
-
-# dictionary
-DICTIONARY: ./gtalk-eucjp.dic
-
-# automatic play of synthesized speech
-AUTO-PLAY: NO
-
-# time delay [msec] for autuomatic play
-AUTO-PLAY-DELAY: 250
-
-# file of phoneme list
-PHONEME-LIST: mono.lst
-
-# parameter files for each speaker
-SPEAKER-ID: male01
-GENDER: male
-DUR-TREE-FILE:   ../speakers/male01/tree-dur.inf
-PIT-TREE-FILE:   ../speakers/male01/tree-lf0.inf
-MCEP-TREE-FILE:  ../speakers/male01/tree-mcep.inf
-DUR-MODEL-FILE:  ../speakers/male01/duration.pdf
-PIT-MODEL-FILE:  ../speakers/male01/lf0.pdf
-MCEP-MODEL-FILE: ../speakers/male01/mcep.pdf
-
-# parameter files for each speaker
-SPEAKER-ID: female01
-GENDER: female
-DUR-TREE-FILE:   ../speakers/female01/tree-dur.inf
-PIT-TREE-FILE:   ../speakers/female01/tree-lf0.inf
-MCEP-TREE-FILE:  ../speakers/female01/tree-mcep.inf
-DUR-MODEL-FILE:  ../speakers/female01/duration.pdf
-PIT-MODEL-FILE:  ../speakers/female01/lf0.pdf
-MCEP-MODEL-FILE: ../speakers/female01/mcep.pdf
-
-# parameter files for each speaker
-SPEAKER-ID: male02
-GENDER: male
-DUR-TREE-FILE:   ../speakers/male02/tree-dur.inf
-PIT-TREE-FILE:   ../speakers/male02/tree-lf0.inf
-MCEP-TREE-FILE:  ../speakers/male02/tree-mcep.inf
-DUR-MODEL-FILE:  ../speakers/male02/duration.pdf
-PIT-MODEL-FILE:  ../speakers/male02/lf0.pdf
-MCEP-MODEL-FILE: ../speakers/male02/mcep.pdf
+# configuratiuon file for gtalk (GalateaTalk)
+
+# path name of 'chasen'
+CHASEN: ../morph/chasen-2.3.3/chasen/chasen
+#CHASEN: /usr/local/bin/chasen
+
+# configuration file for 'chasen'
+CHASEN-RC: ./chasenrc
+
+# command of running 'chaone'
+CHAONE: ../morph/chaone-1.3.2/chaone -s gtalk
+
+# path name of 'chaone.xsl' (only for library-based version)
+#CHAONE-XSL-FILE: ../chaone-win-1.3.2/chaone4gtalk_win.xsl
+
+# default for numbers and alphabets
+NUMBER: DECIMAL
+ALPHABET: WORD
+DATE: YMD
+TIME: hms
+
+# dictionary
+DICTIONARY: ./gtalk-eucjp.dic
+
+# automatic play of synthesized speech
+AUTO-PLAY: NO
+
+# time delay [msec] for autuomatic play
+AUTO-PLAY-DELAY: 250
+
+# file of phoneme list
+PHONEME-LIST: mono.lst
+
+# parameter files for each speaker
+SPEAKER-ID: male01
+GENDER: male
+DUR-TREE-FILE:   ../speakers/male01/tree-dur.inf
+PIT-TREE-FILE:   ../speakers/male01/tree-lf0.inf
+MCEP-TREE-FILE:  ../speakers/male01/tree-mcep.inf
+DUR-MODEL-FILE:  ../speakers/male01/duration.pdf
+PIT-MODEL-FILE:  ../speakers/male01/lf0.pdf
+MCEP-MODEL-FILE: ../speakers/male01/mcep.pdf
+
+# parameter files for each speaker
+SPEAKER-ID: female01
+GENDER: female
+DUR-TREE-FILE:   ../speakers/female01/tree-dur.inf
+PIT-TREE-FILE:   ../speakers/female01/tree-lf0.inf
+MCEP-TREE-FILE:  ../speakers/female01/tree-mcep.inf
+DUR-MODEL-FILE:  ../speakers/female01/duration.pdf
+PIT-MODEL-FILE:  ../speakers/female01/lf0.pdf
+MCEP-MODEL-FILE: ../speakers/female01/mcep.pdf
+
+# parameter files for each speaker
+SPEAKER-ID: male02
+GENDER: male
+DUR-TREE-FILE:   ../speakers/male02/tree-dur.inf
+PIT-TREE-FILE:   ../speakers/male02/tree-lf0.inf
+MCEP-TREE-FILE:  ../speakers/male02/tree-mcep.inf
+DUR-MODEL-FILE:  ../speakers/male02/duration.pdf
+PIT-MODEL-FILE:  ../speakers/male02/lf0.pdf
+MCEP-MODEL-FILE: ../speakers/male02/mcep.pdf
Index: gtalk/strings_sjis.h
diff -u gtalk/strings_sjis.h:1.4 gtalk/strings_sjis.h:1.5
--- gtalk/strings_sjis.h:1.4	Fri Oct 27 09:49:44 2006
+++ gtalk/strings_sjis.h	Fri Feb 13 02:43:42 2009
@@ -1,104 +1,104 @@
-/* $Id: strings_sjis.h,v 1.4 2006/10/27 00:49:44 sako Exp $                                            */
-#define TOKEN_MEISHI "–¼ŽŒ"
-#define TOKEN_DOUSHI "“®ŽŒ"
-#define TOKEN_KEIYOUSHI "Œ`—eŽŒ"
-
-#define KUTEN "A"
-#define TOUTEN "B"
-#define GIMONFU "H"
-
-#define KATAKANA_SMALL_A "ƒ@"
-#define KATAKANA_SMALL_I "ƒB"
-#define KATAKANA_SMALL_U "ƒD"
-#define KATAKANA_SMALL_E "ƒF"
-#define KATAKANA_SMALL_O "ƒH"
-#define KATAKANA_SMALL_YA "ƒƒ"
-#define KATAKANA_SMALL_YU "ƒ…"
-#define KATAKANA_SMALL_YO "ƒ‡"
-
-/*---- for text.c ----*/
-#define KANSUUJI_ZERO "Z"
-#define KANSUUJI_ICHI "ˆê"
-#define KANSUUJI_NI "“ñ"
-#define KANSUUJI_SAN "ŽO"
-#define KANSUUJI_SHI "Žl"
-#define KANSUUJI_GO "Ά"
-#define KANSUUJI_ROKU "˜Z"
-#define KANSUUJI_SHICHI "オ"
-#define KANSUUJI_HACHI "ӻ"
-#define KANSUUJI_KYUU "‹ã"
-
-#define KANSUUJI_KETA_ZERO "Z"
-#define KANSUUJI_KETA_ICHI "ˆê"
-#define KANSUUJI_KETA_JUU "\"
-#define KANSUUJI_KETA_HYAKU "•S"
-#define KANSUUJI_KETA_SEN "ç"
-#define KANSUUJI_KETA_MAN "–œ"
-#define KANSUUJI_KETA_OKU "‰­"
-#define KANSUUJI_KETA_CHOU "’›"
-
-#define KANJI_TIME_NEN "”N"
-#define KANJI_TIME_TSUKI "ŒŽ"
-#define KANJI_TIME_NICHI "“ú"
-#define KANJI_TIME_JI "Žž"
-#define KANJI_TIME_FUN "•ª"
-#define KANJI_TIME_BYOU "•b"
-
-#define ZENKAKU_EXCLAMATION "I"
-#define ZENKAKU_DOUBLE_QUOTATION "h"
-#define ZENKAKU_SHARP "”"
-#define ZENKAKU_DOLLAR ""
-#define ZENKAKU_PERCENT "“"
-#define ZENKAKU_AMPERSAND "•"
-#define ZENKAKU_QUOTATION "f"
-#define ZENKAKU_LEFT_PARENTHESIS "i"
-#define ZENKAKU_RIGHT_PARENTHESIS "j"
-#define ZENKAKU_ASTERISK "–"
-#define ZENKAKU_PLUS "{"
-#define ZENKAKU_COMMA "C"
-#define ZENKAKU_CHOUON "["
-#define ZENKAKU_PERIOD "D"
-#define ZENKAKU_TOUTEN "A"
-#define ZENKAKU_MINUS "|"
-#define ZENKAKU_KUTEN "B"
-#define ZENKAKU_SLASH "^"
-#define ZENKAKU_EQUAL ""
-#define ZENKAKU_QUESTION "H"
-#define ZENKAKU_COLON "F"
-#define ZENKAKU_SEMICOLON "G"
-#define ZENKAKU_EN ""
-#define ZENKAKU_ATMARK "—"
-#define ZENKAKU_HAT "O"
-#define ZENKAKU_LT "ƒ"
-#define ZENKAKU_GT "„"
-#define ZENKAKU_UNDERSCORE "Q"
-#define ZENKAKU_LEFT_BRACKET "m"
-#define ZENKAKU_RIGHT_BRACKET "n"
-#define ZENKAKU_BACK_QUOTATION "e"
-#define ZENKAKU_LEFT_BRACE "o"
-#define ZENKAKU_RIGHT_BRACE "p"
-#define ZENKAKU_VERTICAL_BAR "b"
-
-#define PRON_SYM_TSUITACHI "<PRON SYM='ƒcƒCƒ^ƒ`'>"
-#define PRON_SYM_FUTSUKA "<PRON SYM='ƒtƒcƒJ'>"
-#define PRON_SYM_MIKKA "<PRON SYM='ƒ~ƒbƒJ'>"
-#define PRON_SYM_YOKKA "<PRON SYM='ƒˆƒbƒJ'>"
-#define PRON_SYM_ITSUKA "<PRON SYM='ƒCƒcƒJ'>"
-#define PRON_SYM_MUIKA "<PRON SYM='ƒ€ƒCƒJ'>"
-#define PRON_SYM_NANOKA "<PRON SYM='ƒiƒmƒJ'>"
-#define PRON_SYM_YOUKA "<PRON SYM='ƒˆ[ƒJ'>"
-#define PRON_SYM_KOKONOKA "<PRON SYM='ƒRƒRƒmƒJ'>"
-#define PRON_SYM_TOUKA "<PRON SYM='ƒg[ƒJ'>"
-#define PRON_SYM_HATSUKA "<PRON SYM='ƒnƒcƒJ'>"
-
-#define ZENKAKU_ALPHABET_FIRST_BYTE 0x82
-#define ZENKAKU_NUMBER_SECOND_BYTE_MIN 0x4F
-#define ZENKAKU_NUMBER_SECOND_BYTE_MAX 0x58
-#define ZENKAKU_CAPITAL_ALPHABET_SECOND_BYTE_MIN 0x60
-#define ZENKAKU_CAPITAL_ALPHABET_SECOND_BYTE_MAX 0x79
-#define ZENKAKU_ALPHABET_SECOND_BYTE_MIN 0x81
-#define ZENKAKU_ALPHABET_SECOND_BYTE_MAX 0x9A
-
-#define ACCENT_MARK "f"
-#define is_ZENKAKU_ALPNUM(x,y) ( (x) == ZENKAKU_ALPHABET_FIRST_BYTE & ( \
-( ((y) >= ZENKAKU_NUMBER_SECOND_BYTE_MIN) & ((y) <= ZENKAKU_ALPHABET_SECOND_BYTE_MAX))))
+/* $Id: strings_sjis.h,v 1.5 2009/02/12 17:43:42 sako Exp $                                            */
+#define TOKEN_MEISHI "–¼ŽŒ"
+#define TOKEN_DOUSHI "“®ŽŒ"
+#define TOKEN_KEIYOUSHI "Œ`—eŽŒ"
+
+#define KUTEN "A"
+#define TOUTEN "B"
+#define GIMONFU "H"
+
+#define KATAKANA_SMALL_A "ƒ@"
+#define KATAKANA_SMALL_I "ƒB"
+#define KATAKANA_SMALL_U "ƒD"
+#define KATAKANA_SMALL_E "ƒF"
+#define KATAKANA_SMALL_O "ƒH"
+#define KATAKANA_SMALL_YA "ƒƒ"
+#define KATAKANA_SMALL_YU "ƒ…"
+#define KATAKANA_SMALL_YO "ƒ‡"
+
+/*---- for text.c ----*/
+#define KANSUUJI_ZERO "Z"
+#define KANSUUJI_ICHI "ˆê"
+#define KANSUUJI_NI "“ñ"
+#define KANSUUJI_SAN "ŽO"
+#define KANSUUJI_SHI "Žl"
+#define KANSUUJI_GO "Ά"
+#define KANSUUJI_ROKU "˜Z"
+#define KANSUUJI_SHICHI "オ"
+#define KANSUUJI_HACHI "ӻ"
+#define KANSUUJI_KYUU "‹ã"
+
+#define KANSUUJI_KETA_ZERO "Z"
+#define KANSUUJI_KETA_ICHI "ˆê"
+#define KANSUUJI_KETA_JUU "\"
+#define KANSUUJI_KETA_HYAKU "•S"
+#define KANSUUJI_KETA_SEN "ç"
+#define KANSUUJI_KETA_MAN "–œ"
+#define KANSUUJI_KETA_OKU "‰­"
+#define KANSUUJI_KETA_CHOU "’›"
+
+#define KANJI_TIME_NEN "”N"
+#define KANJI_TIME_TSUKI "ŒŽ"
+#define KANJI_TIME_NICHI "“ú"
+#define KANJI_TIME_JI "Žž"
+#define KANJI_TIME_FUN "•ª"
+#define KANJI_TIME_BYOU "•b"
+
+#define ZENKAKU_EXCLAMATION "I"
+#define ZENKAKU_DOUBLE_QUOTATION "h"
+#define ZENKAKU_SHARP "”"
+#define ZENKAKU_DOLLAR ""
+#define ZENKAKU_PERCENT "“"
+#define ZENKAKU_AMPERSAND "•"
+#define ZENKAKU_QUOTATION "f"
+#define ZENKAKU_LEFT_PARENTHESIS "i"
+#define ZENKAKU_RIGHT_PARENTHESIS "j"
+#define ZENKAKU_ASTERISK "–"
+#define ZENKAKU_PLUS "{"
+#define ZENKAKU_COMMA "C"
+#define ZENKAKU_CHOUON "["
+#define ZENKAKU_PERIOD "D"
+#define ZENKAKU_TOUTEN "A"
+#define ZENKAKU_MINUS "|"
+#define ZENKAKU_KUTEN "B"
+#define ZENKAKU_SLASH "^"
+#define ZENKAKU_EQUAL ""
+#define ZENKAKU_QUESTION "H"
+#define ZENKAKU_COLON "F"
+#define ZENKAKU_SEMICOLON "G"
+#define ZENKAKU_EN ""
+#define ZENKAKU_ATMARK "—"
+#define ZENKAKU_HAT "O"
+#define ZENKAKU_LT "ƒ"
+#define ZENKAKU_GT "„"
+#define ZENKAKU_UNDERSCORE "Q"
+#define ZENKAKU_LEFT_BRACKET "m"
+#define ZENKAKU_RIGHT_BRACKET "n"
+#define ZENKAKU_BACK_QUOTATION "e"
+#define ZENKAKU_LEFT_BRACE "o"
+#define ZENKAKU_RIGHT_BRACE "p"
+#define ZENKAKU_VERTICAL_BAR "b"
+
+#define PRON_SYM_TSUITACHI "<PRON SYM='ƒcƒCƒ^ƒ`'>"
+#define PRON_SYM_FUTSUKA "<PRON SYM='ƒtƒcƒJ'>"
+#define PRON_SYM_MIKKA "<PRON SYM='ƒ~ƒbƒJ'>"
+#define PRON_SYM_YOKKA "<PRON SYM='ƒˆƒbƒJ'>"
+#define PRON_SYM_ITSUKA "<PRON SYM='ƒCƒcƒJ'>"
+#define PRON_SYM_MUIKA "<PRON SYM='ƒ€ƒCƒJ'>"
+#define PRON_SYM_NANOKA "<PRON SYM='ƒiƒmƒJ'>"
+#define PRON_SYM_YOUKA "<PRON SYM='ƒˆ[ƒJ'>"
+#define PRON_SYM_KOKONOKA "<PRON SYM='ƒRƒRƒmƒJ'>"
+#define PRON_SYM_TOUKA "<PRON SYM='ƒg[ƒJ'>"
+#define PRON_SYM_HATSUKA "<PRON SYM='ƒnƒcƒJ'>"
+
+#define ZENKAKU_ALPHABET_FIRST_BYTE 0x82
+#define ZENKAKU_NUMBER_SECOND_BYTE_MIN 0x4F
+#define ZENKAKU_NUMBER_SECOND_BYTE_MAX 0x58
+#define ZENKAKU_CAPITAL_ALPHABET_SECOND_BYTE_MIN 0x60
+#define ZENKAKU_CAPITAL_ALPHABET_SECOND_BYTE_MAX 0x79
+#define ZENKAKU_ALPHABET_SECOND_BYTE_MIN 0x81
+#define ZENKAKU_ALPHABET_SECOND_BYTE_MAX 0x9A
+
+#define ACCENT_MARK "f"
+#define is_ZENKAKU_ALPNUM(x,y) ( (x) == ZENKAKU_ALPHABET_FIRST_BYTE && ( \
+( ((y) >= ZENKAKU_NUMBER_SECOND_BYTE_MIN) && ((y) <= ZENKAKU_ALPHABET_SECOND_BYTE_MAX))))
Index: gtalk/synthesis.h
diff -u gtalk/synthesis.h:1.17 gtalk/synthesis.h:1.18
--- gtalk/synthesis.h:1.17	Thu Oct 19 12:27:08 2006
+++ gtalk/synthesis.h	Fri Feb 13 02:43:42 2009
@@ -7,10 +7,11 @@
 /*   (Nagoya Institute of Technology)                  */
 /*   All rights reserved                               */
 /*                                                     */
-/* $Id: synthesis.h,v 1.17 2006/10/19 03:27:08 sako Exp $                                                */
+/* $Id: synthesis.h,v 1.18 2009/02/12 17:43:42 sako Exp $                                                */
 
 typedef enum {NON,SILB,SILE,PAU} SILENCE;
 typedef enum {NO,YES} GBOOLEAN;
+typedef enum {RAW,WAV} SPEECHFILETYPE;
 
 /* 音素 */
 
Index: gtalk/tag.h
diff -u gtalk/tag.h:1.15 gtalk/tag.h:1.16
--- gtalk/tag.h:1.15	Thu Oct 19 12:27:08 2006
+++ gtalk/tag.h	Fri Feb 13 02:43:42 2009
@@ -1,207 +1,211 @@
-/* Copyright (c) 2000-2006                  */
-/*   Yamashita Lab., Ritsumeikan University */
-/*   All rights reserved                    */
-/*                                          */
-/* $Id: tag.h,v 1.15 2006/10/19 03:27:08 sako Exp $                                     */
-
-/*  List of speech controll tags */
-
-#define T_BOOKMARK 0
-#define T_SILENCE  1
-#define T_EMPH     2
-#define T_SPELL    3
-#define T_PRON     4
-#define T_SPEECH   5
-#define T_LANG     6
-#define T_PARTOFSP 7
-#define T_VOICE    8
-#define T_RATE     9
-#define T_VOLUME  10
-#define T_PITCH   11
-#define T_RESET   12
-#define T_CONTEXT 13
-#define T_REGWORD 14
-
-#ifdef INIT_TAG_TABLE
-
-struct {
-	int 	id;
-	char	*name;
-} tagTable[] = {
-	{ T_BOOKMARK, "BOOKMARK" },
-	{ T_SILENCE,  "SILENCE"  },
-	{ T_EMPH,     "EMPH"     },
-	{ T_SPELL,    "SPELL"    },
-	{ T_PRON,     "PRON"     },
-	{ T_SPEECH,   "SPEECH"   },
-	{ T_LANG,     "LANG"     },
-	{ T_PARTOFSP, "PARTOFSP" },
-	{ T_VOICE,    "VOICE"    },
-	{ T_RATE,     "RATE"     },
-	{ T_VOLUME,   "VOLUME"   },
-	{ T_PITCH,    "PITCH"    },
-	{ T_RESET,    "RESET"    },
-	{ T_CONTEXT,  "CONTEXT"  },
-	{ T_REGWORD,  "REGWORD"  }
-};
-
-#define NUM_TAG ( sizeof(tagTable)/sizeof(tagTable[0]))
-
-#endif /* INIT_TAG_TABLE */
-
-/* List of attributes in the speech control tag */
-
-/* BOOKMARK */
-#define TA_MARK      1
-/* SILENCE */
-#define TA_MSEC     11
-#define TA_MORA     12
-/* PRON */
-#define TA_SYM      21
-#define TA_SAMPA    22
-/* LANG */
-#define TA_ISO639   31
-/* PARTOFSP */
-#define TA_PART     41
-/* VOICE */
-#define TA_REQUIRED 51
-#define TA_OPTIONAL 52
-#define TA_ALPHA    53
-/* RATE */
-#define TA_SPEED    61
-#define TA_ABSSPEED 62
-#define TA_MORASEC  63
-/* VOLUME, PITCH */
-#define TA_LEVEL    71
-#define TA_ABSLEVEL 72
-#define TA_RANGE    73
-/* CONTEXT */
-#define TA_TYPE     81
-/* REGWORD */
-#define TA_STRING   91
-#define TA_READING  92
-#define TA_PARTOFSP 93
-#define TA_SYMSAMPA 94
-
-#define TA_START  1000
-#define TA_END    1001
-
-#ifdef INIT_TAG_TABLE
-
-struct {
-	int 	id;
-	char	*name;
-} attrTable[] = {
-	{ TA_MARK,     "MARK"     },
-	{ TA_MSEC,     "MSEC"     },
-	{ TA_MORA,     "MORA"     },
-	{ TA_SYM,      "SYM"      },
-	{ TA_SAMPA,    "SAMPA"    },
-	{ TA_ISO639,   "ISO639"   },
-	{ TA_PART,     "PART"     },
-	{ TA_REQUIRED, "REQUIRED" },
-	{ TA_OPTIONAL, "OPTIONAL" },
-	{ TA_ALPHA,    "ALPHA" },
-	{ TA_SPEED,    "SPEED"    },
-	{ TA_ABSSPEED, "ABSSPEED" },
-	{ TA_MORASEC,  "MORASEC"  },
-	{ TA_LEVEL,    "LEVEL"    },
-	{ TA_ABSLEVEL, "ABSLEVEL" },
-	{ TA_RANGE,    "RANGE"    },
-	{ TA_TYPE,     "TYPE"     },
-	{ TA_STRING,   "STRING"   },
-	{ TA_READING,  "READING"  },
-	{ TA_PARTOFSP, "PARTOFSP" },
-	{ TA_SYMSAMPA, "SYMSAMPA" },
-	{ TA_START,    "start"    },
-	{ TA_END,      "end"      }
-};
-
-#define NUM_ATTR ( sizeof(attrTable)/sizeof(attrTable[0]))
-
-#endif /* INIT_TAG_TABLE */
-
-#define MAX_JEIDA_TAGOPTIONS 10
-
-typedef struct _JEIDA_tagoptions {
-	int 	attrID;
-	char	*val;
-} JEIDA_TAGOPTIONS;
-
-typedef struct _tag {
-	int 	id;
-	int 	n_op;
-	JEIDA_TAGOPTIONS options[MAX_JEIDA_TAGOPTIONS];
-/*	int 	attrID;		*/
-/*	char	*val;	*/
-	int 	start;
-	int 	end;
-	MORPH	*prev_morph;
-	MORPH	*start_morph;
-	MORPH	*end_morph;
-} TAG;
-
-#define MAX_TAG 200
-extern TAG *tag[MAX_TAG];
-
-extern int n_tag;
-
-#define TAG_NAME_SIZE 128
-#define TAG_ATTR_SIZE 64
-#define TAG_VAL_SIZE 256
-#define TAG_MAX_OP 10
-
-/* 茶筌解析結果の形態素属性名のID */
-
-#define W_PRON    0
-#define W_POS     1
-#define W_CTYPE   2
-#define W_CFORM   3
-#define W_INFO    4
-#define W_FORM    5
-#define W_ORTH    6
-
-#define W_ACCENT       7
-#define W_INDEX_FORM   8
-#define W_INDEX_ORTH   9
-#define W_A_TYPE      10
-#define W_A_CON_TYPE  11
-#define W_C_TYPE      12
-#define W_C_FORM      13
-#define W_LEX         14
-#define W_SILENCE     15
-#define W_INTERROGATIVE  16
-
-#ifdef INIT_TAG_TABLE
-
-struct {
-	int 	id;
-	char	*name;
-} attributeTable[] = {
-	{ W_PRON,       "pron" },
-	{ W_POS,        "pos" },
-	{ W_CTYPE,      "ctype" },
-	{ W_CFORM,      "cform" },
-	{ W_INFO,       "info" },
-	{ W_FORM,       "form" },
-	{ W_ORTH,       "orth" },
-	{ W_ACCENT,     "accent" },
-	{ W_INDEX_FORM, "indexForm" },
-	{ W_INDEX_ORTH, "indexOrth" },
-	{ W_A_TYPE,     "aType"},
-	{ W_A_CON_TYPE, "aConType" },
-	{ W_C_TYPE,     "cType" },
-	{ W_C_FORM,     "cForm" },
-	{ W_LEX,        "lex" },
-	{ W_SILENCE,    "silence" },
-	{ W_INTERROGATIVE, "interrogative" }
-};
-
-#define NUM_ATTRIBUTE	(sizeof(attributeTable)/sizeof(attributeTable[0]))
-
-#endif /* INIT_TAG_TABLE */
-
-typedef struct _tagoptions {
-	char	attr[TAG_ATTR_SIZE];
-	char	val[TAG_VAL_SIZE];
-} TAGOPTIONS;
+/* Copyright (c) 2000-2006                  */
+/*   Yamashita Lab., Ritsumeikan University */
+/*   All rights reserved                    */
+/*                                          */
+/* $Id: tag.h,v 1.16 2009/02/12 17:43:42 sako Exp $                                     */
+
+/*  List of speech controll tags */
+
+#define T_BOOKMARK 0
+#define T_SILENCE  1
+#define T_EMPH     2
+#define T_SPELL    3
+#define T_PRON     4
+#define T_SPEECH   5
+#define T_LANG     6
+#define T_PARTOFSP 7
+#define T_VOICE    8
+#define T_RATE     9
+#define T_VOLUME  10
+#define T_PITCH   11
+#define T_RESET   12
+#define T_CONTEXT 13
+#define T_REGWORD 14
+#define T_APB     15
+#define T_W1      16
+
+#ifdef INIT_TAG_TABLE
+
+struct {
+	int 	id;
+	char	*name;
+} tagTable[] = {
+	{ T_BOOKMARK, "BOOKMARK" },
+	{ T_SILENCE,  "SILENCE"  },
+	{ T_EMPH,     "EMPH"     },
+	{ T_SPELL,    "SPELL"    },
+	{ T_PRON,     "PRON"     },
+	{ T_SPEECH,   "SPEECH"   },
+	{ T_LANG,     "LANG"     },
+	{ T_PARTOFSP, "PARTOFSP" },
+	{ T_VOICE,    "VOICE"    },
+	{ T_RATE,     "RATE"     },
+	{ T_VOLUME,   "VOLUME"   },
+	{ T_PITCH,    "PITCH"    },
+	{ T_RESET,    "RESET"    },
+	{ T_CONTEXT,  "CONTEXT"  },
+	{ T_REGWORD,  "REGWORD"  },
+	{ T_APB,      "APB"      },
+	{ T_W1,       "W1"       }
+};
+
+#define NUM_TAG ( sizeof(tagTable)/sizeof(tagTable[0]))
+
+#endif /* INIT_TAG_TABLE */
+
+/* List of attributes in the speech control tag */
+
+/* BOOKMARK */
+#define TA_MARK      1
+/* SILENCE */
+#define TA_MSEC     11
+#define TA_MORA     12
+/* PRON */
+#define TA_SYM      21
+#define TA_SAMPA    22
+/* LANG */
+#define TA_ISO639   31
+/* PARTOFSP */
+#define TA_PART     41
+/* VOICE */
+#define TA_REQUIRED 51
+#define TA_OPTIONAL 52
+#define TA_ALPHA    53
+/* RATE */
+#define TA_SPEED    61
+#define TA_ABSSPEED 62
+#define TA_MORASEC  63
+/* VOLUME, PITCH */
+#define TA_LEVEL    71
+#define TA_ABSLEVEL 72
+#define TA_RANGE    73
+/* CONTEXT */
+#define TA_TYPE     81
+/* REGWORD */
+#define TA_STRING   91
+#define TA_READING  92
+#define TA_PARTOFSP 93
+#define TA_SYMSAMPA 94
+
+#define TA_START  1000
+#define TA_END    1001
+
+#ifdef INIT_TAG_TABLE
+
+struct {
+	int 	id;
+	char	*name;
+} attrTable[] = {
+	{ TA_MARK,     "MARK"     },
+	{ TA_MSEC,     "MSEC"     },
+	{ TA_MORA,     "MORA"     },
+	{ TA_SYM,      "SYM"      },
+	{ TA_SAMPA,    "SAMPA"    },
+	{ TA_ISO639,   "ISO639"   },
+	{ TA_PART,     "PART"     },
+	{ TA_REQUIRED, "REQUIRED" },
+	{ TA_OPTIONAL, "OPTIONAL" },
+	{ TA_ALPHA,    "ALPHA" },
+	{ TA_SPEED,    "SPEED"    },
+	{ TA_ABSSPEED, "ABSSPEED" },
+	{ TA_MORASEC,  "MORASEC"  },
+	{ TA_LEVEL,    "LEVEL"    },
+	{ TA_ABSLEVEL, "ABSLEVEL" },
+	{ TA_RANGE,    "RANGE"    },
+	{ TA_TYPE,     "TYPE"     },
+	{ TA_STRING,   "STRING"   },
+	{ TA_READING,  "READING"  },
+	{ TA_PARTOFSP, "PARTOFSP" },
+	{ TA_SYMSAMPA, "SYMSAMPA" },
+	{ TA_START,    "start"    },
+	{ TA_END,      "end"      }
+};
+
+#define NUM_ATTR ( sizeof(attrTable)/sizeof(attrTable[0]))
+
+#endif /* INIT_TAG_TABLE */
+
+#define MAX_JEIDA_TAGOPTIONS 10
+
+typedef struct _JEIDA_tagoptions {
+	int 	attrID;
+	char	*val;
+} JEIDA_TAGOPTIONS;
+
+typedef struct _tag {
+	int 	id;
+	int 	n_op;
+	JEIDA_TAGOPTIONS options[MAX_JEIDA_TAGOPTIONS];
+/*	int 	attrID;		*/
+/*	char	*val;	*/
+	int 	start;
+	int 	end;
+	MORPH	*prev_morph;
+	MORPH	*start_morph;
+	MORPH	*end_morph;
+} TAG;
+
+#define MAX_TAG 200
+extern TAG *tag[MAX_TAG];
+
+extern int n_tag;
+
+#define TAG_NAME_SIZE 128
+#define TAG_ATTR_SIZE 64
+#define TAG_VAL_SIZE 256
+#define TAG_MAX_OP 10
+
+/* 茶筌解析結果の形態素属性名のID */
+
+#define W_PRON    0
+#define W_POS     1
+#define W_CTYPE   2
+#define W_CFORM   3
+#define W_INFO    4
+#define W_FORM    5
+#define W_ORTH    6
+
+#define W_ACCENT       7
+#define W_INDEX_FORM   8
+#define W_INDEX_ORTH   9
+#define W_A_TYPE      10
+#define W_A_CON_TYPE  11
+#define W_C_TYPE      12
+#define W_C_FORM      13
+#define W_LEX         14
+#define W_SILENCE     15
+#define W_INTERROGATIVE  16
+
+#ifdef INIT_TAG_TABLE
+
+struct {
+	int 	id;
+	char	*name;
+} attributeTable[] = {
+	{ W_PRON,       "pron" },
+	{ W_POS,        "pos" },
+	{ W_CTYPE,      "ctype" },
+	{ W_CFORM,      "cform" },
+	{ W_INFO,       "info" },
+	{ W_FORM,       "form" },
+	{ W_ORTH,       "orth" },
+	{ W_ACCENT,     "accent" },
+	{ W_INDEX_FORM, "indexForm" },
+	{ W_INDEX_ORTH, "indexOrth" },
+	{ W_A_TYPE,     "aType"},
+	{ W_A_CON_TYPE, "aConType" },
+	{ W_C_TYPE,     "cType" },
+	{ W_C_FORM,     "cForm" },
+	{ W_LEX,        "lex" },
+	{ W_SILENCE,    "silence" },
+	{ W_INTERROGATIVE, "interrogative" }
+};
+
+#define NUM_ATTRIBUTE	(sizeof(attributeTable)/sizeof(attributeTable[0]))
+
+#endif /* INIT_TAG_TABLE */
+
+typedef struct _tagoptions {
+	char	attr[TAG_ATTR_SIZE];
+	char	val[TAG_VAL_SIZE];
+} TAGOPTIONS;
Index: gtalk/text.c
diff -u gtalk/text.c:1.29 gtalk/text.c:1.30
--- gtalk/text.c:1.29	Fri Oct 27 09:49:44 2006
+++ gtalk/text.c	Fri Feb 13 02:43:42 2009
@@ -6,7 +6,7 @@
 /*                            by Studio ARC */
 /*                             2003.08.10   */
 /*               version as of 2003.08.18   */
-/* $Id: text.c,v 1.29 2006/10/27 00:49:44 sako Exp $                                     */
+/* $Id: text.c,v 1.30 2009/02/12 17:43:42 sako Exp $                                     */
 
 #include	<stdio.h>
 #include	<stdlib.h>
@@ -107,6 +107,8 @@
 			/* do nothing */
 		} else if( strcmp(tname,"W1")==0 )  {
 			/* donothing */
+		} else if( strcmp(tname,"/W1")==0 )  {
+			/* donothing */
 		} else if( strcmp(tname,"W2")==0 )  {
 			/* PRON タグの中は一つの形態素として PRON で処理済 */
 			if( ! in_PRON_TAG )  {
Index: gtalk/util.c
diff -u gtalk/util.c:1.14 gtalk/util.c:1.15
--- gtalk/util.c:1.14	Thu Oct 19 12:27:08 2006
+++ gtalk/util.c	Fri Feb 13 02:43:42 2009
@@ -1,186 +1,227 @@
-/* Copyright (c) 2000-2006                  */
-/*   Yamashita Lab., Ritsumeikan University */
-/*   All rights reserved                    */
-/*                                          */
-/* $Id: util.c,v 1.14 2006/10/19 03:27:08 sako Exp $                                     */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include "confpara.h"
-
-void restart(int);
-int ByteSwap( void *, int, int);
-
-/*******↓for server mode *******/
-int server_send ( char *message );
-extern int s_mode;
-/*******↑***********************/
-
-/* to report messages to Control Unit */
-
-int RepMsg(char *fmt, ...)
-{
-	va_list ap;
-	int error;
-
-	va_start( ap, fmt );
-	error = vfprintf( stdout, fmt, ap );
-	fflush( stdout );
-	va_end( ap );
-	
-	/*******↓for server mode *******/
-	if ( s_mode ) {
-	        char *chrMsg;
-		
-    	        if( error > 0 ) {
-		        chrMsg = (char*)malloc((error + 4) * sizeof(char*));
-			va_start( ap, fmt );
-			error = vsprintf( chrMsg, fmt, ap );
-			va_end( ap );
-		    
-			if( error > 0 ) {
-			        strcat( chrMsg, "./\n" );
-			        server_send( chrMsg );
-			}
-			
-			free(chrMsg);
-	        }
-	}
-	/*******↑***********************/
-	
-	return( error );
-}
-
-/* to print messages to debug */
-
-int TmpMsg(char *fmt, ...)
-{
-	va_list ap;
-	int error;
-
-	va_start( ap, fmt );
-	error = vfprintf( stderr, fmt, ap );
-	fflush( stderr );
-	va_end( ap );
-	return( error );
-}
-
-/* to log messages to debug */
-
-int LogMsg(char *fmt, ...)
-{
-	va_list ap;
-	int error;
-
-	va_start( ap, fmt );
-	error = vfprintf( logfp, fmt, ap );
-	fflush( stderr );
-	va_end( ap );
-	return( error );
-}
-
-/* to log error messages */
-
-FILE *fp_err;
-
-int ErrMsg(char *fmt, ...)
-{
-	va_list ap;
-	int error;
-
-	va_start( ap, fmt );
-	error = vfprintf( fp_err, fmt, ap );
-	fflush( fp_err );
-	va_end( ap );
-	return( error );
-}
-
-char* malloc_char( char* str, char *str_name )
-{
-	char *p;
-
-	p = (char *) malloc( sizeof(char) * (strlen(str)+1) );
-	if( ! p )  {
-		ErrMsg( "* malloc error in '%s'\n", str_name );
-		restart(1);
-	}
-	strcpy( p, str );
-	return p;
-}
-
-/* 合成音声データの書き出しに使う。 */
-/* もとのメモリ内容は保存しておく。 */
-int xfwrite(void *p, int size, int num, FILE *fp){
-	int block;
-	void *tmp;
-
-#ifdef WORDS_LITTLEENDIAN
-	tmp = malloc( size*num );
-	if( ! tmp )  {
-		ErrMsg( "* malloc error in xfwrite\n" );
-		restart(1);
-	}
-	memcpy( tmp, p, size*num );
-	ByteSwap( tmp, size, num );
-#else
-/* BIG_ENDIAN */
-	tmp = p;
-#endif
-
-	block = fwrite( tmp, size, num, fp);
-
-#ifdef WORDS_LITTLEENDIAN
-	free( tmp );
-#endif
-
-	return block;
-}
-
-int xfread(void *p, int size, int num, FILE *fp)
-{
-	int block;
-
-	block = fread( p, size, num, fp);
-
-#ifdef WORDS_LITTLEENDIAN
-	ByteSwap( p, size, block);
-#endif /* !BIG_ENDIAN */
-
-	return block;
-}
-
-int ByteSwap( void *p, int size, int blocks)
-{
-        char *q, tmp;
-        int i, j;
-
-        q = (char *)p;
-
-        for( i = 0; i < blocks; i++){
-                for( j = 0; j < (size/2); j++){
-                        tmp = *(q+j);
-                        *(q+j) = *(q+(size-1-j));
-                        *(q+(size-1-j)) = tmp;
-                }
-                q += size;
-        }
-        return i;
-}
-
-#if defined(WIN32) || defined(USE_CHASENLIB)
-
-int snprintf( char *str, size_t size, const char *fmt, ... )
-{
-	va_list ap;
-	int error;
-
-	va_start( ap, fmt );
-	error = vsprintf( str, fmt, ap );
-	va_end( ap );
-	return( error );
-}
-
-#endif
-
+/* Copyright (c) 2000-2006                  */
+/*   Yamashita Lab., Ritsumeikan University */
+/*   All rights reserved                    */
+/*                                          */
+/* $Id: util.c,v 1.15 2009/02/12 17:43:42 sako Exp $                                     */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include "confpara.h"
+
+void restart(int);
+int ByteSwap( void *, int, int);
+
+/*******↓for server mode *******/
+int server_send ( char *message );
+extern int s_mode;
+/*******↑***********************/
+
+/* to report messages to Control Unit */
+
+int RepMsg(char *fmt, ...)
+{
+	va_list ap;
+	int error;
+
+	va_start( ap, fmt );
+	error = vfprintf( stdout, fmt, ap );
+	fflush( stdout );
+	va_end( ap );
+	
+	/*******↓for server mode *******/
+	if ( s_mode ) {
+	        char *chrMsg;
+		
+    	        if( error > 0 ) {
+		        chrMsg = (char*)malloc((error + 4) * sizeof(char*));
+			va_start( ap, fmt );
+			error = vsprintf( chrMsg, fmt, ap );
+			va_end( ap );
+		    
+			if( error > 0 ) {
+			        strcat( chrMsg, "./\n" );
+			        server_send( chrMsg );
+			}
+			
+			free(chrMsg);
+	        }
+	}
+	/*******↑***********************/
+	
+	return( error );
+}
+
+/* to print messages to debug */
+
+int TmpMsg(char *fmt, ...)
+{
+	va_list ap;
+	int error;
+
+	va_start( ap, fmt );
+	error = vfprintf( stderr, fmt, ap );
+	fflush( stderr );
+	va_end( ap );
+	return( error );
+}
+
+/* to log messages to debug */
+
+int LogMsg(char *fmt, ...)
+{
+	va_list ap;
+	int error;
+
+	va_start( ap, fmt );
+	error = vfprintf( logfp, fmt, ap );
+	fflush( stderr );
+	va_end( ap );
+	return( error );
+}
+
+/* to log error messages */
+
+FILE *fp_err;
+
+int ErrMsg(char *fmt, ...)
+{
+	va_list ap;
+	int error;
+
+	va_start( ap, fmt );
+	error = vfprintf( fp_err, fmt, ap );
+	fflush( fp_err );
+	va_end( ap );
+	return( error );
+}
+
+char* malloc_char( char* str, char *str_name )
+{
+	char *p;
+
+	p = (char *) malloc( sizeof(char) * (strlen(str)+1) );
+	if( ! p )  {
+		ErrMsg( "* malloc error in '%s'\n", str_name );
+		restart(1);
+	}
+	strcpy( p, str );
+	return p;
+}
+
+/* 合成音声データの書き出しに使う。 */
+/* BIG ENDIAN での書き出しを行う。もとのメモリ内容は保存しておく。 */
+int xfwrite(void *p, int size, int num, FILE *fp){
+	int block;
+	void *tmp;
+
+#ifdef WORDS_LITTLEENDIAN
+	tmp = malloc( size*num );
+	if( ! tmp )  {
+		ErrMsg( "* malloc error in xfwrite\n" );
+		restart(1);
+	}
+	memcpy( tmp, p, size*num );
+	ByteSwap( tmp, size, num );
+#else
+/* BIG_ENDIAN */
+	tmp = p;
+#endif
+
+	block = fwrite( tmp, size, num, fp);
+
+#ifdef WORDS_LITTLEENDIAN
+	free( tmp );
+#endif
+
+	return block;
+}
+
+/* 合成音声データの書き出しに使う。 */
+/* LITTLE ENDIAN での書き出しを行う。もとのメモリ内容は保存しておく。 */
+int xfwrite_LE(void *p, int size, int num, FILE *fp){
+	int block;
+	void *tmp;
+
+#ifndef WORDS_LITTLEENDIAN
+	tmp = malloc( size*num );
+	if( ! tmp )  {
+		ErrMsg( "* malloc error in xfwrite\n" );
+		restart(1);
+	}
+	memcpy( tmp, p, size*num );
+	ByteSwap( tmp, size, num );
+#else
+/* BIG_ENDIAN */
+	tmp = p;
+#endif
+
+	block = fwrite( tmp, size, num, fp);
+
+#ifndef WORDS_LITTLEENDIAN
+	free( tmp );
+#endif
+
+	return block;
+}
+
+int xfread(void *p, int size, int num, FILE *fp)
+{
+	int block;
+
+	block = fread( p, size, num, fp);
+
+#ifdef WORDS_LITTLEENDIAN
+	ByteSwap( p, size, block);
+#endif /* !BIG_ENDIAN */
+
+	return block;
+}
+
+int xfread_LE(void *p, int size, int num, FILE *fp)
+{
+	int block;
+
+	block = fread( p, size, num, fp);
+
+#ifndef WORDS_LITTLEENDIAN
+	ByteSwap( p, size, block);
+#endif /* !BIG_ENDIAN */
+
+	return block;
+}
+
+int ByteSwap( void *p, int size, int blocks)
+{
+        char *q, tmp;
+        int i, j;
+
+        q = (char *)p;
+
+        for( i = 0; i < blocks; i++){
+                for( j = 0; j < (size/2); j++){
+                        tmp = *(q+j);
+                        *(q+j) = *(q+(size-1-j));
+                        *(q+(size-1-j)) = tmp;
+                }
+                q += size;
+        }
+        return i;
+}
+
+#if defined(WIN32) || defined(USE_CHASENLIB)
+
+int snprintf( char *str, size_t size, const char *fmt, ... )
+{
+	va_list ap;
+	int error;
+
+	va_start( ap, fmt );
+	error = vsprintf( str, fmt, ap );
+	va_end( ap );
+	return( error );
+}
+
+#endif
+



Galateatalk-dev メーリングリストの案内
Zurück zum Archiv-Index