-
Notifications
You must be signed in to change notification settings - Fork 25
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
Strange behavior setting voices with WinRT #29
Comments
Give main a shot, and if it works for you then I'll make a new release. Sorry about that--there were indeed two paths and I hadn't set the voice on one of them. Thanks for the report! |
Setting the voice works in the main branch, but getting it doesn't. If I call Maybe it would make more sense for |
Ah, you're right, it should just return `self.voice`. I implemented
voice support into so many speech APIs at once that I didn't have time
to think through each one carefully. Feel free to submit a PR, otherwise
I'll get to it on Monday and push out a new release.
Thanks for testing!
|
I'll open a PR, it's a quick fix :P. Is there any technical reason why you chose to store the voice, rate, pitch and volume in the struct itself? As I see it, calling the methods in |
There's no other way I know of to indicate which parameters a given
utterance should speak with. If you don't store the properties and set
them at the time you speak something, you'll run into situations where
you speak a thing, change synth properties, queue up something else, and
the results are inconsistent. Feel free to try another way in case I'm
wrong, but it seems like most TTS APIs handle these parameters on an
utterance-by-utterance basis.
|
Isn't it possible to call all of these in their respective self.synth.Options()?.SetSpeakingRate(self.rate.into())?;
self.synth.Options()?.SetAudioPitch(self.pitch.into())?;
self.synth.Options()?.SetAudioVolume(self.volume.into())?;
self.synth.SetVoice(&self.voice)?; You would still have to store the voice because there is no way to convert from fn get_volume(&self) -> std::result::Result<f32, Error> {
Ok(self.synth.Options()?.AudioVolume()? as f32)
}
fn set_volume(&mut self, volume: f32) -> std::result::Result<(), Error> {
self.synth.Options()?.SetAudioVolume(volume as f64)?;
Ok(())
} |
It sounds like you have a good idea for a path forward. Why not give
that a shot and see if it runs all the examples correctly? If it does,
and if it holds up in my production use, I'll merge it.
Elaborating more on my previous comment, it behaved inconsistently.
Sometimes rate/voice changes didn't take effect in time for utterances
to queue up. It's possible that went away in an unrelated fix and it
isn't needed anymore, but if it isn't broken for me then I personally
don't have the time to fix it. :) Again, if you have the time to make
your changes, and if they work, I'm happy to accept them.
|
Great! I'll give it a go :D |
When I run this snippet, even though I changed the voice, Microsoft David is still being used when I call
Tts::speak
.stdout:
Looking at the output of the program, "hello" should be said by Zira, not David. Interestingly enough, everything works fine with the following change:
This makes me think
Tts::speak
performs some kind of initialization that allows changing the voices afterwards.The text was updated successfully, but these errors were encountered: