Hello
I’ve got my editor build set for android, and the following code:
speechText = GameObject.Find ("SpeechLabel").GetComponent<UILabel> ();
GetComponent<AudioSource>().clip = Microphone.Start (null,false,5,8000);
yield return new WaitForSeconds(5);
Microphone.End(null);
GetComponent<AudioSource>().Play(); //hear whatw e got
float[] clipData = new float[GetComponent<AudioSource>().clip.samples * GetComponent<AudioSource>().clip.channels];
GetComponent<AudioSource>().clip.GetData(clipData,0);
WaveGen.WaveFormatChunk format = new WaveGen().MakeFormat(GetComponent<AudioSource>().clip);
string filename = Application.persistentDataPath + "/" + "recordedSpeech.wav";
FileStream stream = File.OpenWrite(filename);
new WaveGen().Write (clipData,format,stream);
stream.Close();
SpeechResponse response = requestFactory.SpeechToText (filename);
string transcribedText = response.Recognition.NBest[0].ResultText;
speechText.text = transcribedText;
When i’m debugging the code on android it seems to stop on these lines :
SpeechResponse response = requestFactory.SpeechToText (filename);
string transcribedText = response.Recognition.NBest[0].ResultText;
I get these errors on iOS…
creating a file in local path
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
Check response from API
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
TlsException: The authentication or decryption has failed.
at Mono.Math.BigInteger+Kernel.Multiply (System.UInt32[] x, UInt32 xOffset, UInt32 xLen, System.UInt32[] y, UInt32 yOffset, UInt32 yLen, System.UInt32[] d, UInt32 dOffset) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.ProcessAlert (AlertLevel alertLevel, AlertDescription alertDesc) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.IO.Stream.BeginRead (System.Byte[] buffer, Int32 offset, Int32 count, System.AsyncCallback callback, System.Object state) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.BeginReceiveRecord (System.IO.Stream record, System.AsyncCallback callback, System.Object state) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.InternalReadCallback (IAsyncResult result) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket+SocketAsyncResult.Complete () [0x00000] in <filename unknown>:0
Rethrow as WebException: Error getting response stream (ReadDone1): ReceiveFailure
at System.Net.Configuration.BypassElementCollection.set_Item (Int32 index, System.Net.Configuration.BypassElement value) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.Send (HTTPMethods method, System.String relativeUri, System.Collections.Specialized.NameValueCollection headers, System.Byte[] bodyBytes, System.String contentType, System.String accept, Boolean returnWebResponse) [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.Send (HTTPMethods method, System.String relativeUri, System.Collections.Specialized.NameValueCollection headers, System.String body, System.String contentType, System.String accept) [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.GetNewClientCredential () [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.GetClientCredentials () [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.ConvertToText (System.String audioFilePath, System.String speechContext, Nullable`1 xSpeechContext, System.String xArgsParameter, System.Collections.Specialized.NameValueCollection xArgsCollection, ATT_MSSDK.Speechv3.XArgs xArgs) [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.SpeechToText (System.String audioFilePath) [0x00000] in <filename unknown>:0
at VoiceRec+<DoRecognize>c__Iterator17.MoveNext () [0x00000] in <filename unknown>:0
Rethrow as InvalidResponseException: Failed: Unable to get response
at ATT_MSSDK.RequestFactory..ctor (System.String endPoint, System.String clientId, System.String clientSecret, System.Collections.Generic.List`1 scopes, System.String redirectUri, System.String proxyAddress) [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.Send (HTTPMethods method, System.String relativeUri, System.Collections.Specialized.NameValueCollection headers, System.Byte[] bodyBytes, System.String contentType, System.String accept, Boolean returnWebResponse) [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.Send (HTTPMethods method, System.String relativeUri, System.Collections.Specialized.NameValueCollection headers, System.String body, System.String contentType, System.String accept) [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.GetNewClientCredential () [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.GetClientCredentials () [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.ConvertToText (System.String audioFilePath, System.String speechContext, Nullable`1 xSpeechContext, System.String xArgsParameter, System.Collections.Specialized.NameValueCollection xArgsCollection, ATT_MSSDK.Speechv3.XArgs xArgs) [0x00000] in <filename unknown>:0
at ATT_MSSDK.RequestFactory.SpeechToText (System.String audioFilePath) [0x00000] in <filename unknown>:0
at VoiceRec+<DoRecognize>c__Iterator17.MoveNext () [0x00000] in <filename unknown>:0
(Filename: currently not available on il2cpp Line: -1)