Text to Speech

How can we do text to speech on HoloLens in Unity? I started writing my own bridge using SpeechSynthesizer but I'm a bit stumped when it comes time to play the stream. Looks like the SynthesizeTextToStreamAsync method returns a SpeechSynthesisStream. Normally you would play that with a MediaElement, but since this HoloLens app is a D3D only app I don't have XAML and I don't have MediaElement. Is there another way to play this stream? Or is there a component somewhere in the toolkit that I'm missing to enable this?

Our Holographic world is here

RoadToHolo.com      WikiHolo.net      @jbienz
I work in Developer Experiences at Microsoft. My posts are based on my own experience and don't represent Microsoft or HoloLens.

Best Answer

Answers

  • I believe your best bet would be to use XAudio2 to play the audio. You can get started with XAudio at https://msdn.microsoft.com/en-us/library/windows/desktop/ee415762(v=vs.85).aspx.

    To verify before you use XAudio2 directly, if this is a Unity app you can use Unity APIs to stream audio that way. Use of XAudio2 should only be required if you're not developing using Unity.

  • @jbienzms this is awesome! I had to use this today and found your implementation excellent!

  • Awesome @papiot! I'm so glad it helped.

    Our Holographic world is here

    RoadToHolo.com      WikiHolo.net      @jbienz
    I work in Developer Experiences at Microsoft. My posts are based on my own experience and don't represent Microsoft or HoloLens.

  • Hi @jbienzms I found your Scene in the HoloToolkit-Tests, the speech synthesis worked good, but when I asked "What time is it" there was no response, I had opened up the micphone functionality. Can you check what is the reason for that? Thanks!

  • Hi, have a look at my tutorial on Text to Speech in HoloLens using MR Toolkit latest version. https://codeholo.com/2018/04/12/texttospeech-tutorial-hololens/

  • Can you please give me the answer on following,
    1. Can we change language?
    2. What languages are supported?

Sign In or Register to comment.