Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need an easy way to do Text to Speech #25

Closed
jbienzms opened this issue May 3, 2016 · 14 comments
Closed

Need an easy way to do Text to Speech #25

jbienzms opened this issue May 3, 2016 · 14 comments

Comments

@jbienzms
Copy link
Contributor

jbienzms commented May 3, 2016

Windows 10 supports text to speech via SpeechSynthesizer but this isn't easily used from Unity because of the complexities in converting from SpeechSynthesisStream to AudioClip. I propose a new component called TextToSpeechManager (which I've already written) to do this work for us.

@jbienzms
Copy link
Contributor Author

jbienzms commented May 3, 2016

Oh, I forgot that I'm supposed to describe how I plan to solve this problem. I have been able to convert SpeechSyntehsisStream to a byte[] containing WAV data. I then found code to load WAV data into a mono Unity AudioClip. From there, we can assign that audio clip to an Audio Source which allows the voice to be positioned in 3D space. The TextToSpeechManager component does all of this work. The only things the developer needs to do are:

  1. Create an AudioSource somewhere in the scene. I recommend creating it on an empty GameObject that is a child of the Main Camera and is positioned about 0.6 units above the camera.
  2. Add the TextToSpeechManager component to the scene.
  3. Assoicate the AudioSource with the manager.
  4. In code call TextToSpeechManager.Instance.Speak("Hello World");

The component takes care of generating the speech using SpeechSysntesizer, converting the output stream to WAV data then on to an AudioClip. It sets the AudioSource.clip property and then calls AudioSource.play. This all happens in about 500ms.

@keveleigh
Copy link
Contributor

I agree! I've been working on something like this recently as well, but have been stuck at the "convert the WAV data to an AudioClip" step. Sounds like you've solved that, so I think this would be a welcome addition. Feel free to create a pull request for review.

@jbienzms
Copy link
Contributor Author

jbienzms commented May 3, 2016

Awesome! Pull request has been submitted. You can review it here:

#26

@jbienzms
Copy link
Contributor Author

Updated to new pull request:

#38

@jbienzms
Copy link
Contributor Author

Updated to a third pull request:

#48

@jwittner
Copy link
Member

Awesome! Left some comments. Out of curiosity, why the new Pull Request every time you make changes? If you update your branch the currently standing PR will update to reflect that merge instead.

Can you assign this issue to yourself? That way it's clear from the outside that you're working on it. =)

@jbienzms
Copy link
Contributor Author

As for the new pull request, well, to be honest I haven't had a pull request rejected before. The one's I've done were accepted first time so I never had to go back and rework a submission. Good to know it works that way, thank you.

I would be happy to assign the issue to myself, but when I click the Edit button I'm only able to change the title. I don't think I have the permissions to assign the issue. Can you help?

@keveleigh
Copy link
Contributor

I'm not sure where the Assignees list is filled from, but I wasn't able to find you in the list for some reason.

@kenyee
Copy link

kenyee commented Jun 12, 2016

+1 used it this weekend at the Boston hackathon and it worked very well. Thanks, Jared!

@mobrien650
Copy link

mobrien650 commented Jun 13, 2016

Used at the Boston MS Hololens Hackathon this weekend and it worked perfect for what we needed.

@mattThousand
Copy link

Another +1, this would be great feature to bring in

@NeerajW
Copy link

NeerajW commented Jun 13, 2016

@jbienzms, have you added a test scene to your pull?
Please check out the Contributing.md’s implementation section.

Once your test scene is added and readme updated, I’d be happy to merge.

@jwittner
Copy link
Member

This was fixed by the merge of #48 correct?

@jbienzms
Copy link
Contributor Author

Correct @jwittner. Sorry I forgot to close the issue. Closing now.

keveleigh pushed a commit to keveleigh/HoloToolkit-Unity that referenced this issue Jun 13, 2018
david-c-kline pushed a commit that referenced this issue Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants