I successfully added text-to-speech synthesis in a MS PowerPoint 2013 application for my students. The app gives the impression of switching between an adult voice and a child voice by using SSML/XML codes to change the pitch. This worked well on Windows 7's using the Microsoft Anna voice.
However, with Windows 10 becoming more and more common, I am needing the PowerPoint to function properly in Windows 10 too. While the app will run and use the default Microsoft David Desktop voice, the change in pitch is not sufficient when using David to tell that a different voice is speaking. That's a huge problem for this app because the user needs to take a different action depending on which voice is speaking.
To get the speech to work, the PowerPoint VBA uses a reference to Microsoft Excel 15.0 Object Library and then the following code where SayWhat is the text to speak which incorporates XML for either a high or low pitch:
Excel.Application.Speech.Speak Text:="<?xml version='1.0'?> <speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'>" & SayWhat & "</speak>", SpeakAsync:=Async, SpeakXML:=True
And the SayWhat variable would begin with
<prosody pitch = 'high'>
and end with
</prosody>
for a child voice and would begin with
<prosody rate = '-15%'><prosody pitch = 'low'>
and end with
</prosody></prosody>
for an adult voice.
On Windows 10, Microsoft David Desktop is the default voice in the TTS settings.
What I am trying to do now, is use the Windows 10 David voice for the adult and the Windows 10 Zira voice for the child. However, when I use the following code, it is only spoken in David's voice and never Zira's.
Excel.Application.Speech.Speak Text:="<?xml version='1.0'?> <speak version='1.1' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'>" & "<voice name='MicrosoftZiraDesktop-English(UnitedStates)'>I am Zira.</voice><voice name='MicrosoftDavidDesktop-English(UnitedStates)'>I am David.</voice>" & "</speak>", SpeakAsync:=Async, SpeakXML:=True
That does not work. Nor does this:
Excel.Application.Speech.Speak Text:="<?xml version='1.0'?> <speak version='1.1' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'>" & "<voice name='Zira'>I am Zira.</voice><voice name='David'>I am David.</voice>" & "</speak>", SpeakAsync:=Async, SpeakXML:=True
Nor do any number of variations I try with the voice string.
Although the online documentation I've found for SSML/XML all indicate that my syntax for the element is correct, I cannot switch voices.
Can anyone identify the correct SSML/XML code that will work to actually change the voice.
(Note: If I change the default voice to Zira instead of David, then the above code will speak in Zira's voice instead of David's and will not switch to David.)