実現したいこと
音声認識→テキスト化
前提
公式のサンプルコード実行後,エラーが発生.
発生している問題・エラーメッセージ
Dictation completed unsuccessfully: Canceled. UnityEngine.Debug:LogErrorFormat (string,object[]) VoiceInput/<>c:<Start>b__3_2 (UnityEngine.Windows.Speech.DictationCompletionCause) (at Assets/VoiceInput.cs:35) UnityEngine.Windows.Speech.DictationRecognizer:DictationRecognizer_InvokeCompletedEvent (UnityEngine.Windows.Speech.DictationCompletionCause)
該当のソースコード
C#
1using UnityEditor; 2using UnityEngine; 3using UnityEngine.UI; 4using UnityEngine.Windows.Speech; 5 6public class VoiceInput : MonoBehaviour 7{ 8 [SerializeField] 9 private Text m_Hypotheses; 10 11 [SerializeField] 12 private Text m_Recognitions; 13 14 private DictationRecognizer m_DictationRecognizer; 15 16 void Start() 17 { 18 m_DictationRecognizer = new DictationRecognizer(); 19 20 m_DictationRecognizer.DictationResult += (text, confidence) => 21 { 22 Debug.LogFormat("Dictation result: {0}", text); 23 m_Recognitions.text += text + "\n"; 24 }; 25 26 m_DictationRecognizer.DictationHypothesis += (text) => 27 { 28 Debug.LogFormat("Dictation hypothesis: {0}", text); 29 m_Hypotheses.text += text; 30 }; 31 32 m_DictationRecognizer.DictationComplete += (completionCause) => 33 { 34 if (completionCause != DictationCompletionCause.Complete) 35 Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause); 36 }; 37 38 m_DictationRecognizer.DictationError += (error, hresult) => 39 { 40 Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult); 41 }; 42 43 m_DictationRecognizer.Start(); 44 } 45} 46
試したこと
おそらく,コードの問題ではなくマイクが有効化できていないのが原因だと考えwindows設定上からマイクテスト,さらにプライバシー関連の設定からwebアプリ等のマイク使用の許可周りもきちんとできているか確認したが、エラーは解決しませんでした.
unityに疎く,project settingの中にmicの設定がないか探してみましたがなく、お手上げの状態です.どなたかお力を貸していただけると幸いです.
補足情報(FW/ツールのバージョンなど)
unity 2021.3.22f1

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。