Hi,
I'm trying to use the Neural Text To Speech containers from a C# project.
I have the container running locally, and I'm able to get text read out loud via the container using Microsoft.CognitiveServices.Speech v1.36.0.
My issue is that I need the WordBoundary event to be called back. But when using the local container this event is not invoked at all.
If I switch to use my Azure subscription ( Speech.Config.FromSubsribtion(...) )it works as expected.
My sample code for demonstrating the issue
async static Task Main(string[] args)
{
var speechConfig = SpeechConfig.FromHost(new Uri("http://localhost:5000"));
// The language of the voice that speaks.
speechConfig.SpeechSynthesisVoiceName = "da-DK-JeppeNeural";
using (var speechSynthesizer = new SpeechSynthesizer(speechConfig))
{
speechSynthesizer.SynthesisStarted += (s, e) =>
{
Console.WriteLine("Synthesis started.");
};
speechSynthesizer.Synthesizing += (s, e) =>
{
Console.WriteLine($"Synthesizing, received an audio chunk of {e.Result.AudioData.Length} bytes.");
};
speechSynthesizer.WordBoundary += (s, e) =>
{
Console.Write($"Word \"{e.Text}\" | ");
Console.Write($"Text offset {e.TextOffset} | ");
Console.WriteLine($"Audio offset {(e.AudioOffset + 5000) / 10000}ms");
};
// Get text from the console and synthesize to the default speaker.
Console.WriteLine("Enter some text that you want to speak >");
string text = Console.ReadLine();
var speechSynthesisResult = await speechSynthesizer.SpeakTextAsync(text);
}
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}