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:
- Open your Virtual Assistant Solution in Visual Studio.
- Open DefaultWebSocketAdapter.cs located within the Adapters folder.
- Select the Voice you would like to use from this list, for example Microsoft Server Speech Text to Speech Voice (en-US, JessaNeural)
- 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)"));
- Build your Assistant and re-publish your Assistant to Azure so the changes are available to the Speech Channel.
- Repeat the tests and listen to the voice difference.