I solved the problem by creating two separate voice instances in two different modules and calling each of them in turn.
How to use more than one voice in a TTS JavaScript snippet
The TTS javascript project I am currently working on needs to use two voices with the ability to be able to switch between these two. However, as far as I can see, I can only configure the synthesizer engine with one voice using speechConfig.speechSynthesisVoiceName = "voice to be used". Can I configure this for more than one voice, or do I have to create two instances of the synthesizer and call each each one separately? I imagine something like using two different “phraseDiv”s (based on the demo code provided by Azure) for this with possibly an IF statement, but there’s still the issue with the voice assignment.