Tutorial: Extend to Direct Line Speech

Changing the Voice

Now let’s change the default voice (Jessa24kRUS) configured within your Virtual Assistant to a higher quality Neural voice. Note that Neural voices will only work with speech subscription keys created for certain locations (regions). See the last column in the Standard and neural voices table for region availability. If your bot is configured for Neural voice and your speech subscription key is for a region not enabled for Neural voices, Direct Line Speech channel will terminate the connection with the client with an Internal Server Error (code 500).

To change your Virtual Assistant’s voice:

  1. Open your Virtual Assistant Solution in Visual Studio.
  2. Open DefaultWebSocketAdapter.cs located within the Adapters folder.
  3. Select the Voice you would like to use from this list, for example Microsoft Server Speech Text to Speech Voice (en-US, JessaNeural)
  4. Update the following line to specify the new voice:
    - Use(new SetSpeakMiddleware(settings.DefaultLocale ?? "en-us"));
    + Use(new SetSpeakMiddleware(settings.DefaultLocale ?? "en-us", "Microsoft Server Speech Text to Speech Voice (en-US, JessaNeural)"));
    
  5. Build your Assistant and re-publish your Assistant to Azure so the changes are available to the Speech Channel.
  6. Repeat the tests and listen to the voice difference.