watson-developer-cloud / unity-sdk

:video_game: Unity SDK to use the IBM Watson services.
Apache License 2.0
569 stars 206 forks source link

Speech to text example streaming is not working #674

Closed nahalnrz closed 3 years ago

nahalnrz commented 3 years ago

I was trying the example streaming tutorial in Unity based on the IBM Watson YouTube instructions. I am using Unity version 2019.2.13. Initially, I only added the Apikey that I got from IBM to the exampleStreaming script and I got the lines below in the console:

[SpeechToText.CreateListenConnector()][DEBUG] Created listen socket. Model: en-US_BroadbandModel, parsedParams: [ExampleStreaming.RecordingHandler()][DEBUG] devices: Microphone (Realtek Audio) [SpeechToText.KeepAlive()][DEBUG] KeepAlive exited.

Afterward, I added the URL from my service credentials to the example exampleStreaming script. Doing this, I see the lines below in the console:

[SpeechToText.CreateListenConnector()][DEBUG] Created listen socket. Model: en-US_BroadbandModel, parsedParams: [ExampleStreaming.RecordingHandler()][DEBUG] devices: Microphone (Realtek Audio)

After a few seconds I get an error:

[SpeechToText.OnListen()][ERROR] Failed to enter listening state. [ExampleStreaming.OnError()][DEBUG] Error! Failed to enter listening state. [SpeechToText.KeepAlive()][DEBUG] KeepAlive exited.

I know that Unity has access to the microphone when the scene is running since in my permission settings I can see that the microphone is marked as "currently in use" for Unity. I also tried the code below from Unity (slightly adjusted) while the example streaming scene is running to check if my microphone is detected and I can see the name of my mic in the console:

public class Example : MonoBehaviour { // Get list of Microphone devices and print the names to the log void Start() { foreach (string device in Microphone.devices) { Debug.Log("Name: " + device); } } }

I tried the same things on a different computer (different Unity version, 2019.4.0) and I get exactly the same logs in the console. I appreciate your help with this issue.

mediumTaj commented 3 years ago

Thanks @nahalnrz - can you provide an example of how you are authenticating the service? Do not include your apikey.

nahalnrz commented 3 years ago

Hi @mediumTaj. Thank you for your quick response. I'm not sure if I am answering your question correctly but I followed the steps in the second Watson Unity SDK tutorial on YouTube. I added the text-to-speech service in my IBM cloud account and from the service credentials tab copy and pasted my apikey and URL. As in the tutorial, when adding the service, I kept my "region" as Dallas (although I am not physically located in Dallas) and "select resource group" as default.

mediumTaj commented 3 years ago

Did you create a text to speech service instance or a speech to text service instance? You mention text to speech above.

nahalnrz commented 3 years ago

Sorry, my bad. I created an speech to text service instance.

mediumTaj commented 3 years ago

Come join #unity-sdk channel in our public slack workspace http://wdc-slack-inviter.mybluemix.net/

It might help to talk there

nahalnrz commented 3 years ago

Taj helped me to resolve the issue, I had downloaded text to speech instead of speech to text!