Build an open future with us.

Invest in Mycroft and become a community partner.

Using the Bing TTS Engine


#1

Hi,

I am trying to use the Bing TTS engine (and the new Azure Speech service) but I was not able to figure out how to set the parameters in the mycroft.conf file. Microsoft documentation says that I need to set the following parameters (in addtion to the API key “Ocp-Apim-Subscription-Key” which I allready have):


POST /synthesize
HTTP/1.1
Host: speech.platform.bing.com

X-Microsoft-OutputFormat: riff-8khz-8bit-mono-mulaw
Content-Type: application/ssml+xml
Host: speech.platform.bing.com
Content-Length: 197
Authorization: Bearer [Base64 access_token]

<speak version='1.0' xml:lang='en-US'><voice xml:lang='en-US' xml:gender='Female' name='Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)'>Microsoft Bing Voice Output API</voice></speak>

I am not sure how to add these settings in mycroft.conf using the following format:


{
  “tts”: {
  “module”: “bing”,    <- this should be set to the name of your TTS provider (ie "google_cloud", "wit" etc)
  “bing”: {            <- this should be set to the name of your TTS provider (ie "google_cloud", "wit" etc)
    “lang”: “en-US”,           <- the IETF BCP-47 language code for your language (shown is Hindi as spoken in India)
    “credential”: {            <- some STT engines require credentials - check the documentation for the STT engine
      “json”: {
      }
    }
  }
}

Thanks in advance.

Abdulrahman


#2

Hi there @Abdulrahman2,

To try and find an answer for you here, I had a look at the mycroft-core source code for the BingTTS class. You can see it here. Based on the source code, the BingTTS class is expecting something like;

{
  “tts”: {
  “module”: “bing”,
  “bing”: {           
    “lang”: “en-US”,
    "api_key": "YOURAPIKEYHERE", 
   }
 }
}

None of the other parameters are found in the BingTTS class.

Can you try the above configuration and let me know how you go?


#3

Thanks @KathyReid.

I tried that and unfortunately it did not work.

However, I think you are correct and the problem is actually caused by the proxy since I am correcting to the net through a proxy server.

Even though the proxy setting is already set using the export commands and Mycroft is working fine through the proxy, it seems that Bing TTS requests are not able to pass though the proxy.

Thanks,

Abdulrahman


#4

Hmmm. That doesn’t make sense though, because it’s mycroft that is handling the proxy requests, and the requests/responses to/from BingTTS are handled thorugh mycroft.

Is there anything in your voice.log, audio.log or skills.log with either;

  • confirms that this is a proxy issue
  • or provides an error relating to BingTTS?

Best, Kathy


#5

I don’t have access to the log files right now to check the errors. I will check them later.
However, I thought Mycroft depends on this Python library (Python-Bing-TTS) (as mentioned in bing_tts.py) to do the BingTTS requests.
Thanks, Abdulrahman


#6

Yes, that’s correct, Mycroft uses python-bing-tts for abstraction

How did you go finding the logs?


#7

If found the following errors in the audio.log file:

  1. If the “Python-Bing-TTS” package is not installed, I get the following error in the audio.log file:

ModuleNotFoundError: No module named 'bingtts'

  1. If I use the following configuration:

“bing”: {
“lang”: “en-US”,
“api_key”: “[my API key]”
},

I get the following error in the audio.log file:
mycroft.audio.speech:mute_and_speak:126 - ERROR - TTS execution failed (LanguageException('Requested language en-US does not have voice Male!',)).

So, I tried to use the gender field to pass the voice name.

  1. If I use the following configuration:

“bing”: {
“lang”: “en-US”,
“gender”:“JessaRUS”,
“api_key”: “[my API key]”
},

I get the following error in the audio.log file:

mycroft.audio.speech:mute_and_speak:126 - ERROR - TTS execution failed (TimeoutError(110, 'Connection timed out')).

So now I am not sure where is the source of the error: is it the proxy or in using the Python-Bing-TTS backage.

Thanks, Abdulrahman.


#8

Great information and troubleshooting @Abdulrahman2

It sounds like BingTTS is expecting a voice key-value pair. By default, Mycroft sets the voice to “Male” so I think that’s what’s happening.

Do you know what voices are available with BingTTS?

We could try adding a voice value like this:

“bing”: {
“lang”: “en-US”,
“voice”:“JessaRUS”,
“api_key”: “[my API key]”
},