Handling barge-in

September 20, 2013

It often occurs in speech interfaces that a user wants to barge in to the system utterance while the system is speakings. You can handle such a “barge-in” action from a user by creating a dialog script (.fst) as follows:

     1 10 RECOG_EVENT_STOP|こんにちは SYNTH_START|mei|mei_voice_normal|こんにちは。
    10 20 SYNTH_EVENT_STOP|mei SYNTH_START|mei|mei_voice_normal|私の名前はメイと言います。
    20 30 SYNTH_EVENT_STOP|mei SYNTH_START|mei|mei_voice_normal|私は情報案内ができます。
    30 50 SYNTH_EVENT_STOP|mei SYNTH_START|mei|mei_voice_normal|ご用件をおっしゃってください。
    10 40 RECOG_EVENT_START SYNTH_STOP|mei 
    20 40 RECOG_EVENT_START SYNTH_STOP|mei 
    30 40 RECOG_EVENT_START SYNTH_STOP|mei
    40 50 SYNTH_EVENT_STOP|mei SYNTH_START|mei|mei_voice_normal|はい。
    50  2 SYNTH_EVENT_STOP|mei <eps>

=== Japanese ========================================

音声インタフェースではシステムの発話中にユーザがその発話を遮って音声入力を行うことがあります.これをバージインといいます.以下のように音声対話スクリプト(.fst)を記述することでバージインを扱うことができます.

     1 10 RECOG_EVENT_STOP|こんにちは SYNTH_START|mei|mei_voice_normal|こんにちは。
    10 20 SYNTH_EVENT_STOP|mei SYNTH_START|mei|mei_voice_normal|私の名前はメイと言います。
    20 30 SYNTH_EVENT_STOP|mei SYNTH_START|mei|mei_voice_normal|私は情報案内ができます。
    30 50 SYNTH_EVENT_STOP|mei SYNTH_START|mei|mei_voice_normal|ご用件をおっしゃってください。
    10 40 RECOG_EVENT_START SYNTH_STOP|mei 
    20 40 RECOG_EVENT_START SYNTH_STOP|mei 
    30 40 RECOG_EVENT_START SYNTH_STOP|mei
    40 50 SYNTH_EVENT_STOP|mei SYNTH_START|mei|mei_voice_normal|はい。
    50  2 SYNTH_EVENT_STOP|mei <eps>

Audio input level

May 7, 2013

If you experience some trouble in recognizing speech in MMDAgent, you should first check your audio input whether your voice is detected properly or not.

The indicator below shows the status of the recognition module.  The  blue bar is the current audio input level.  While recognizing, orange lines are flown from the right side.  At the end of speech, the orange lines will disappear and recognition result will be output.

bar

When the recognition does not work well, please check the indicator:

  • In case the blue bar does not appear, check that your microphone is correctly connected and enabled,  the device setting whether the target device is specified as the default device, or  if the device is not muted.
  • In case the blue bar responds very little, try increasing the recording level.
  • In case the blue bar is always full or sometimes turns to red, the input level is overflowing.  Try decreasing the recording level.
  • In case the orange lines keep showing even if you are not speaking, the background noise is too loud and detected as an input.  Try setting smaller recording level and also decrease the noise.

You can also modify the detection sensitivity parameters in the way described in the article “Parameter setting for speech recognition”.

=== Japanese ========================================

MMDAgent で音声がうまく認識されないときは,まず音声入力がうまく検出されているかを確認してください.

認識モジュールの状態が,下図のようなインジケータに表示されます.青いバーが現在の音声入力レベルを表します.音声認識部が一定以上の音の大きさを検出すると認識が開始されます.認識処理中は,右側からオレンジ色の線が表示されていきます.入力が終了すると同時にオレンジ色の線が消え,認識結果が出力されます.

bar

音声入力がうまく動かないときは,バーの動きに注目してみて下さい.

  • 喋ってもバーが動かない場合
    マイクがきちんと接続されているか,規定の録音デバイスが正しく選択されているか,デバイスがミュートされていないか,確認してください.
  • 喋ったときのバーの動きが小さく,音声認識が開始しない場合
    録音デバイスの入力レベルが小さすぎます.入力レベルを大きくしてみてください.
  • 喋ったときバーが右端まで達してしまったり,ときおり赤くなる場合
    オーバーフローしています.録音デバイスの入力レベルを小さくしてみてください.
  • 喋っていないときもずっと音声認識中になってしまうとき
    周囲の雑音を誤検知しつづけている状態です.録音デバイスの入力レベルを小さく調整してみてください.また周囲の雑音を抑えてください.

また,「Parameter setting for speech recognition」で説明したように,音声認識部での感度調整も可能です.

CC-BY-NC Copyright 2009-2011 Nagoya Institute of Technology (MMDAgent Model “Mei”)
CC-BY Copyright 2009-2011 Nagoya Institute of Technology (MMDAgent Accessory “NIT Menu”, MMDAgent Motion “Wait of Mei”)

The speech recognition module of MMDAgent is based on “Julius”, the open-source large-vocabulary continuous speech recognition engine.  Configuration file of the module is located at Appdata\Julius\jconf.txt, and you can modify parameters in the file in order to improve speech recognition performance. Several major parameters are described as follows, with their default values.

  • -lv 1500
    Sound detection threshold.  Speech recognition will start when the amplitude of audio input goes over this value for a while.  Setting larger value will make the detection sensitivity lower.  On the application, the amplitude of current input is drawn as blue bar and the threshold as yellow line in front of the character as in the  figure below.
  • -b 800
    Search width.  Larger value will make Julius to search for a larger number of hypotheses in the recognition process and make the recognition accuracy stable, at a cost of increasing the computational cost.  Setting smaller value may improve speech recognition speed, but may result in the degradation of recognition accuracy.
  • -rejectshort 700
    A threshold to reject a short input in milliseconds.  Julius will reject an input whose detected length is less than the specified value.  This function is for avoiding unintentional sound detection caused by a short, impulsive noise.
  • -tailmargin 240
    Margin length at the end of  a speech input in milliseconds.  Smaller value will lead to a quicker response of the speech recognition, however the end-of-speech detection may become unstable.

 the amplitude of current input and the threshold

See the Julius manual section of “Juliusbook” as a reference for available parameters of Julius that can be written in the file.

=== Japanese ========================================

MMDAgentでは音声認識に,大語彙連続音声認識エンジンJuliusを使っています.設定ファイルはAppData\Julius\jconf.txtで,これを編集することで音声認識の設定やパフォーマンスの調整を行うことができます.ここでは設定できる項目のうち,代表的なものを説明します.なお,それぞれ記されている数値はデフォルトの値です.

  • -lv  1500
    設定値より大きい入力音声の振幅が一定時間続けば音声認識開始とみなされます.設定値を大きくすると,感度が鈍くなります.なお,下図のキャラクターの前に表示されている青いバーが入力音声の振幅であり,黄色い線がこの設定値です.
  • -b  800
    探索幅です.設定値が大きいと認識中にたくさんの候補を扱うようになり,計算量はかかるようになりますが精度は安定します.逆に小さくするほど候補を絞るので認識処理が高速になりますが,精度が悪くなる可能性が高くなります.
  • -rejectshort  700
    検出した音の長さ(ミリ秒)がこの設定値未満の時,認識を行わずに入力を無視します.鋭い物音等で音声認識が意図せず開始されるのを防ぐ役割を持っています.
  • -tailmargin  240
    音の長さの終了部のマージン(ミリ秒)です.設定値を小さくすると,発話終了の検出が早くなりますが,発話終了の検出が不安定になる可能性があります.大きくすることで安定しますが,認識結果が出力されるのが遅くなります.

 the amplitude of current input and the threshold

Julusで設定できるパラメータについては,JuliusのWebページにあるThe Juliusbookのjuliusの節を参考にしてください.

CC-BY-NC Copyright 2009-2011 Nagoya Institute of Technology (MMDAgent Model “Mei”)
CC-BY Copyright 2009-2011 Nagoya Institute of Technology (MMDAgent Accessory “NIT Menu”, MMDAgent Motion “Wait of Mei”)

As described in the posted article “Adding recognition words”, a word pronunciation should be described as a sequence of phonemes in the recognition dictionary.  Here is the Japanese kana-to-phone mapping used in MMDAgent.

a i u e o
k a k i k u k e k o
s a sh i s u s e s o
t a ch i ts u t e t o
n a n i n u n e n o
h a h i f u h e h o
m a m i m u m e m o
y a y u y o
r a r i r u r e r o
w a o N
g a g i g u g e g o
z a z i z u z e z o
d a z i z u d e d o
b a b i b u b e b o
p a p i p u p e p o
キャ キュ キョ
ky a ky u ky o
シャ シュ シェ ショ
sh a sh u sh e sh o
チャ チュ チェ チョ
ch a ch u ch e ch o
ニャ ニュ ニョ
ny a ny u ny o
ヒャ ヒュ ヒョ
hy a hy u hy o
ミャ ミュ ミョ
my a my u my o
リャ リュ リョ
ry a ry u ry o
ギャ ギュ ギョ
gy a gy u gy o
ジャ ジュ ジェ ジョ
j a j u j e j o
ビャ ビュ ビョ
by a by u by o
ピャ ピュ ピョ
py a py u py o
ファ フィ フュ フェ フォ
f a f i hy u f e f o
ウィ ウェ ウォ
w i w e w o
ヴァ ヴィ ヴェ ヴォ
b a b i b e b o
ツァ ツィ ツェ ツォ
ts a ts i ts e ts o
ティ テュ
t i t u
ディ デュ
d i d u
ドゥ
d u

Please note that there are special rules for Japanese prolonged consonant “ッ” and long vowels, as shown bellow.

special phoneme

prolonged consonant(ッ) q example: ラッコ r a q k o
long vowels(ー) a: i: u: e: o: example: チーター ch i: t a:

You can also consult the system’s dictionary for reference.  It is located at “AppData\Julius\lang_m\web.60k.htkdic”. The actual pronunciations are written according to the same rules above.

=== Japanese ========================================

「Adding recognition words」の記事で説明したように,ユーザ用の辞書ファイルでは各単語の発音を音素列で記述します.カタカナ読みから音素列への変換は以下の規則に従います.

a i u e o
k a k i k u k e k o
s a sh i s u s e s o
t a ch i ts u t e t o
n a n i n u n e n o
h a h i f u h e h o
m a m i m u m e m o
y a y u y o
r a r i r u r e r o
w a o N
g a g i g u g e g o
z a z i z u z e z o
d a z i z u d e d o
b a b i b u b e b o
p a p i p u p e p o
キャ キュ キョ
ky a ky u ky o
シャ シュ シェ ショ
sh a sh u sh e sh o
チャ チュ チェ チョ
ch a ch u ch e ch o
ニャ ニュ ニョ
ny a ny u ny o
ヒャ ヒュ ヒョ
hy a hy u hy o
ミャ ミュ ミョ
my a my u my o
リャ リュ リョ
ry a ry u ry o
ギャ ギュ ギョ
gy a gy u gy o
ジャ ジュ ジェ ジョ
j a j u j e j o
ビャ ビュ ビョ
by a by u by o
ピャ ピュ ピョ
py a py u py o
ファ フィ フュ フェ フォ
f a f i hy u f e f o
ウィ ウェ ウォ
w i w e w o
ヴァ ヴィ ヴェ ヴォ
b a b i b e b o
ツァ ツィ ツェ ツォ
ts a ts i ts e ts o
ティ テュ
t i t u
ディ デュ
d i d u
ドゥ
d u

なお,促音・長音については以下のルールに従います.

特殊な音素

促音(ッ) q (例)ラッコ r a q k o
長音(ー) a: i: u: e: o: (例)チーター ch i: t a:

MMDAgentに付属のシステム用の辞書は,MMDAgentのフォルダにあるAppData\Julius\lang_m\web.60k.htkdicにあります.同じ形式で記述されていますので,そちらも参考にしてください.

Adding recognition words

January 18, 2013

You can add new words to be recognized to MMDAgent, by making a user dictionary. The location of the user dictionary (.dic) is:

  • the same folder of the executable (MMDAgent.exe), replacing the suffix “.exe” with “.dic”, when MMDAgent is invoked solely with no argument.
  • the same folder of the configuration file (.mdf), replacing the suffix “.mdf” with “.dic”, when invoked with configuration file (.mdf) as argument.

The format of the user dictionary (.dic) is basically a plain text file, having one word entry per line as a space/tab-separated list as shown bellow:

    東京:トーキョー:東京:515 @1.0 鶴舞:ツルマイ:鶴舞:515 [鶴舞]   ts u r u m a i
    花子:ハナコ:花子:513     @2.0 メイ:メイ:メイ:513    [メイ]   m e i
    花子:ハナコ:花子:513     @2.0 メイ:メー:メイ:513    [メイ]   m e:
    <unk>                 @0.0 <unk>              [ヘロー]  h e r o:

The first field is a grammatical string for controlling the word output.  You should specify a string of a similar word that exists in the system dictionary. At speech recognition, the output pattern of the specified word in the system dictionary will also be applied to the new word.  At the first line of the example above, the new word entry “鶴舞” is a place name, and its first field specifies that the word should output as same as “東京:トーキョー:東京:515”, which is already defined in the system dictionary.  If you are not sure on how to set this field properly, you can set this field to “<unk>” and set its output probability manually by changing the value of the second field as described below.

The second field is the additional word score, preceded by “@”.  The default is 0.0, and setting a positive larger value will make the word to output more frequently.

The third field is a grammatical expression of this word, just like the first field.  This field is actually not used in MMDAgent, so any string is acceptable.  You can leave it as “<unk>”.

The forth field is the output string when recognized.

The fifth field and the later lists describe the pronunciation of the word as a sequence of phones.

=== Japanese ========================================

ユーザ用の辞書ファイルを作成することで,辞書にない単語を登録して認識させることができます. ユーザ用の辞書ファイルの場所は,以下のようになります.

  • 実行ファイル(.exe)から起動する時は,実行ファイル(.exe)の拡張子を「.dic」に換えた辞書ファイル(.dic)
  • 設定ファイル(.mdf)から起動する時は,設定ファイル(.mdf)の拡張子を「.dic」に換えた辞書ファイル(.dic)

となります.

辞書ファイル(.dic)にはテキスト形式で,以下のように追加する単語を記述します.

    東京:トーキョー:東京:515 @1.0 鶴舞:ツルマイ:鶴舞:515 [鶴舞]   ts u r u m a i
    花子:ハナコ:花子:513     @2.0 メイ:メイ:メイ:513    [メイ]   m e i
    花子:ハナコ:花子:513     @2.0 メイ:メー:メイ:513    [メイ]   m e:
    <unk>                 @0.0 <unk>              [ヘロー]  h e r o:

第1フィールドは単語の出現を表す文字列を指定します.システム辞書内にある単語の中で似た単語の第1フィールドを指定します.音声認識時には,ここで指定された単語の出現パターンがそのままこの新単語に適用されます.上の最初の例では「鶴舞」は地名であり,システム辞書内にある「東京:トーキョー:東京:515」を指定することで出現を定義しています.分からない場合は「<unk>」と記述して,下記の第2フィールドの補正値を変えることで手動で調整することもできます.

第2フィールドの@の後の数字は補正値で,大きくするほど認識されやすくなります.認識されにくい場合はこの数字を大きくしてください.

第3フィールドにはその単語の登録情報を,表記:発音:基本形の順で記述します.数字は第1フィールドと同じ物を使用してください.また第1フィールド同様,分からない場合は「<unk>」で構いません.

第4フィールドの[]内に書かれたものは,認識結果として出てくる単語となります.

第5フィールドは読みを表す音素列を表します.

When your recognition accuracy is not good enough, you still have a few things to be checked for improving the accuracy:

  • Speak clearly.  Don’t murmur.
  • Speak in a constant speed, like reading aloud.
  • Use in a quiet environment.  Suppress background noise.
  • Use a good microphone because PC-internal microphones often cause troubles.

You can see the recognition result in the log window of MMDAgent to see how your recognition result is.  The log window can be enabled by “D” key.

Please note that these methods are just general tips for speech recognition systems, and  sometimes do not work for you.

=== Japanese ========================================

MMDAgentの音声認識率が低いときは,以下のような点に気をつけると改善されることがあります.

  • 口を大きく動かしてはっきりと発音する.
  • 適度な速度で話す.
  • 静かな場所で使い,周りの雑音が入るのを抑える.
  • 外付けの性能の良いマイクを使う.

「D」キーを押すと出てくるログに認識結果が表示されるので,それを見ながら話し方を調節できます.

なお,上記は一般的な音声認識のアドバイスであり,個人差により効果が少ない場合があります.

MMDAgent generates a speech recognition result as a sequence of keywords.  You can view how your speech input is being recognized in the log window which can be enabled by “D” key.

You can write a dialog scenario file (.fst) to perform some actions to the recognition result.  When you expect only one keyword in the result, the part of the dialog scenario file (.fst) should look like

  1     11     RECOG_EVENT_STOP|こんにちは    SYNTH_START|mei|mei_voice_normal|こんにちは
  (こんにちは means hello.)

When you want to set several keywords to be matched, they can be specified as follows:

  • For AND condition, in case you expect all of the keywords should be included in an utterance.  When multiple keywords are separated by comma like this, all of them should be matched.  Do not insert a space around commas!
  1     11     RECOG_EVENT_STOP|名古屋,天気 SYNTH_START|mei|mei_voice_normal|晴れ
  (名古屋 means Nagoya, 天気 means weather and 晴れ means sunny.)
  • For OR condition, in case you expect any of keywords to be matched. Equivalent words or synonyms can be specified by defining the same arcs with different keywords.  Note that, when several arcs are defined between the same pair of states, they will be evaluated in the order written in the dialog scenario file (.fst).
  1     11     RECOG_EVENT_STOP|昼ごはん  SYNTH_START|mei|mei_voice_normal|いいですね
  1     11     RECOG_EVENT_STOP|ランチ   SYNTH_START|mei|mei_voice_normal|いいですね
  1     11     RECOG_EVENT_STOP|昼食     SYNTH_START|mei|mei_voice_normal|いいですね
  (昼ごはん, ランチ and 昼食 mean lunch and いいですね means good.)

=== Japanese ========================================

MMDAgent では,音声認識の結果をキーワードの列で取得しています.「D」キーを押すと,ログを見ながら自分の発話がどのように認識されているかを確認できます.

認識結果に反応する動作を音声対話スクリプト(.fst)に書く際は,「今日」「天気」のようにキーワードで指定します.ある単独のキーワードに反応させるには,以下のように記述します.

  1     11     RECOG_EVENT_STOP|こんにちは    SYNTH_START|mei|mei_voice_normal|こんにちは

複数のキーワードに反応させる場合は以下のようになります.

  • 複数のキーワードが全て含まれる時に反応させる場合,下記のように半角コンマ(,)で区切って複数のキーワードを記述することで,それら全てのキーワードが認識された時に反応します.半角コンマの直後にはスペース等を入れないでください.
  1     11     RECOG_EVENT_STOP|名古屋, 天気 SYNTH_START|mei|mei_voice_normal|晴れです.
  • 複数のキーワードのどれかが含まれる時に反応させる場合,下記のように複数のキーワードを記述することで,それらのキーワードのいずれかが認識された時に反応します.なお,音声対話スクリプト(.fst)の中である状態からの遷移が複数定義されている場合,上から順に評価されます.
  1     11     RECOG_EVENT_STOP|昼ごはん     SYNTH_START|mei|mei_voice_normal|Aランチがおすすめです.
  1     11     RECOG_EVENT_STOP|ランチ      SYNTH_START|mei|mei_voice_normal|Aランチがおすすめです.
  1     11     RECOG_EVENT_STOP|昼食       SYNTH_START|mei|mei_voice_normal|Aランチがおすすめです.