locked
Bing SpeechRecognizer Windows 8.1 error RRS feed

  • Question

  • Hi,

    I want to use the Bing speech API in my app, but when I click on my custom button to speech, I receive always this error:

    WinRT information: System.Exception: The data specified for the media type is invalid, inconsistent, or not supported by this object. (Exception from HRESULT: 0xC00D36B4)
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Bing.Speech.Audio.SirenSRAudioPipeline.<StartCaptureAsync>d__7.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runt

    How can I fix this issue? My Windows Store app is HTML/Javascript. And it includes few webview elements and a navigation bar. And yes the mic, internet and location is enabled in the package.appxmanifest file.

    Thanks,
    Stefan

    original post from http://social.msdn.microsoft.com/Forums/windowsapps/en-US/26379a54-fe5b-4542-a414-5d76bdbeb2db/bing-speechrecognizer-windows-81-error?forum=winappswithhtml5

    Monday, April 14, 2014 8:07 PM

All replies

  • Hi,

    This forum is specifically for App Linking.  For more information on the Bing Speech API please see

    http://www.bing.com/dev/en-us/speech

    Thanks,

    Julie

    Monday, April 14, 2014 8:47 PM
  • I can't post it in the "general" Bing forum. I must select a sub forum then it make my post visible. (-> forum website problem)

    Thanks,

    Stefan

    Monday, April 14, 2014 8:57 PM
  • Hi Stefan,

        Could you please share a code snippet behind you custom button to speech?

        Also, please confirm if your project is following required steps mentioned at the below link to use Bing Speech Recognition control. http://msdn.microsoft.com/en-us/library/dn467592.aspx


    ranjit

    Tuesday, April 15, 2014 10:57 PM
  • Hi,

    The code must be OK, because I use it from that bing speech sample. And yes everything is enabled (Speech, location and internet client). The first time I run my app, it asked for the permission of my Mic, and I clicked on the allow button.

    Small note: my app run also other things (such as a lot's of webview element...etc.). 

    var speechRecognizer; document.addEventListener('DOMContentLoaded', function() { // Apply credentials from the Windows Azure Data Marketplace. var credentials = new Bing.Speech.SpeechAuthorizationParameters(); credentials.clientId = "MYAPINOTHERE"; credentials.clientSecret = "THAT'saSECRET"; // Initialize the speech recognizer. speechRecognizer = new Bing.Speech.SpeechRecognizer("en-US", credentials); //Bing.Speech.Audio. }); function SpeakButton_Click() { // Declare a string to hold the result text. var s = ""; // Start speech recognition. speechRecognizer.recognizeSpeechToTextAsync() .then( // Write the result to the string. function (result) { /* result.text should return a string, but if the user speaks too quietly or is unintelligible, result.text will return an error object, so we have to catch it here to prevent interruption. */ if (typeof (result.text) == "string") { s = result.text; } else { // Catch the error from speech that is too quiet or unintelligible. s = "I'm sorry. I couldn't understand you." } }, // If there's another error, write the error number and message to the string. function (error) { s = "Error: (" + error.number + ") " + error.message; } ) .done( // Write the string to ResultText. function (result) { document.getElementById("ResultText").innerHTML = window.toStaticHTML(s); var test = window.toStaticHTML(s); console.log("dus: " + test); } ); }

    //in the html there is one button for speech_click


    Thanks,
    Stefan

    Wednesday, April 16, 2014 8:25 AM
  • Hi Stefan,
        Ok, so the issue is <extensions> section that is required in appxmanifest for Bing Speech Recognition control to work is missing in your App.
    Do this,
    1. Open your Package.appxmanifest file in edit/view code mode
    2. Immediately after the <Capabilities> section, add the following <Extensions> section. If there is already an <Extensions> section, add these <Extension> elements to it.

    <Extensions>
         <Extension Category="windows.activatableClass.inProcessServer">
           <InProcessServer>
             <Path>Microsoft.Speech.VoiceService.MSSRAudio.dll</Path>
             <ActivatableClass ActivatableClassId="Microsoft.Speech.VoiceService.MSSRAudio.Encoder" ThreadingModel="both" />
           </InProcessServer>
         </Extension>
         <Extension Category="windows.activatableClass.proxyStub">
           <ProxyStub ClassId="5807FC3A-A0AB-48B4-BBA1-BA00BE56C3BD">
             <Path>Microsoft.Speech.VoiceService.MSSRAudio.dll</Path>
             <Interface Name="IEncodingSettings" InterfaceId="C97C75EE-A76A-480E-9817-D57D3655231E" />
           </ProxyStub>
         </Extension>
         <Extension Category="windows.activatableClass.proxyStub">
           <ProxyStub ClassId="F1D258E4-9D97-4BA4-AEEA-50A8B74049DF">
             <Path>Microsoft.Speech.VoiceService.Audio.dll</Path>
             <Interface Name="ISpeechVolumeEvent" InterfaceId="946379E8-A397-46B6-B9C4-FBB253EFF6AE" />
             <Interface Name="ISpeechStatusEvent" InterfaceId="FB0767C6-7FAA-4E5E-AC95-A3C0C4D72720" />
           </ProxyStub>
         </Extension>
       </Extensions>

    With these changes things should work just fine :)

    This step is mentioned in How to: Enable a project for the Bing Speech Recognition Control http://msdn.microsoft.com/en-us/library/dn467592.aspx


    ranjit


    • Edited by ranjit01 Thursday, April 17, 2014 10:49 PM
    • Proposed as answer by ranjit01 Monday, April 21, 2014 5:30 PM
    Thursday, April 17, 2014 10:47 PM
  • It's OK now. (the "InProcessServer" was missing in the code)

    Thanks!
    Stefan

    Friday, April 18, 2014 8:34 AM