音声活動検出
Streaming Sound Waveは、Capturable Sound Waveのような派生型とともに、音声活動検出(VAD)をサポートしています。VADは、内部バッファーを埋めるのに、音声が検出された場合のみ、入力されたオーディオデータをフィルタリングします。この機能は libfvad を使用して実装されています。
サウンドウェーブを作成した後、VADを有効にするには、対応する関数を使用します。
- Blueprint
- C++
// Assuming StreamingSoundWave is a UE reference to a UStreamingSoundWave object (or its derived type, such as UCapturableSoundWave)
StreamingSoundWave->ToggleVAD(true);
VADが有効になったら、必要に応じてVADモードを設定したり、VADをリセットしたりできます。これらの機能は、VADが有効になっている場合にのみ呼び出す必要があります。
- ブループリント
- C++
// Assuming StreamingSoundWave is a UE reference to a UStreamingSoundWave object (or its derived type, such as UCapturableSoundWave)
// Set the VAD mode
StreamingSoundWave->SetVADMode(ERuntimeVADMode::VeryAggressive);
// Reset the VAD
StreamingSoundWave->ResetVAD();
音声の開始と終了の検出
Voice Activity Detectionは音声の存在を検出するだけでなく、音声活動の開始と終了も検出できます。これは、再生中または録音中に音声が始まったり終わったりする際にイベントをトリガーするのに役立ちます。
音声の開始と終了の検出感度をカスタマイズするには、最小音声持続時間や無音時間といったパラメータを調整します。これらのパラメータは、短い雑音や音声間の短い停滞を誤検出しないよう、検出を微調整するのに役立ちます。
最小音声持続時間
最小音声持続時間 パラメータは、音声開始イベントをトリガーするために必要な連続音声活動の最短時間を設定します。これは、音声とみなされるべきでない短い雑音をフィルターアウトし、継続的な音声活動のみが認識されるようにするのに役立ちます。最小音声持続時間 のデフォルト値は 300ミリ秒 です。
- Blueprint
- C++
// Assuming StreamingSoundWave is a UE reference to a UStreamingSoundWave object (or its derived type, such as UCapturableSoundWave)
// Set the minimum speech duration
StreamingSoundWave->SetMinimumSpeechDuration(200);
無音時間
無音時間 パラメータは、スピーチ終了イベントをトリガーするために必要な無音の長さを設定します。これにより、単語や文の間の自然 な一時停止中にスピーチ検出が早すぎる段階で終了するのを防ぎます。無音時間 のデフォルト値は 500 ミリ秒 です。
- Blueprint
- C++
// Assuming StreamingSoundWave is a UE reference to a UStreamingSoundWave object (or its derived type, such as UCapturableSoundWave)
// Set the silence duration
StreamingSoundWave->SetSilenceDuration(700);
スピーチデリゲートへのバインディング
スピーチの開始や終了に特定のデリゲートをバインドすることができます。これは、スピーチ活動を基にしたカスタムな動作をトリガーするのに役立ちます。例としては、テキスト認識の開始や停止、他の音声ソースの音量調整などがあります。
- Blueprint
- C++
// Assuming StreamingSoundWave is a UE reference to a UStreamingSoundWave object (or its derived type, such as UCapturableSoundWave)
// Bind to the OnSpeechStartedNative delegate
StreamingSoundWave->OnSpeechStartedNative.AddWeakLambda(this, [this]()
{
// Handle the result when speech starts
});
// Bind to the OnSpeechEndedNative delegate
StreamingSoundWave->OnSpeechEndedNative.AddWeakLambda(this, [this]()
{
// Handle the result when speech ends
});