Sorry, I just saw your response. No, I didn't solve the problem, the code I posted is really all, it's already a working (and in my case, not working) sample of the azure api used in c#. Just I can't make it work on a Ubuntu Server on the cloud...
SpeechSynthesizer shutdown process in linux without exceptions
Sebastiano Gazzola
1
Reputation point
I have created a sample console app in dotnet core 5.0 that synthetize some text in italian, using Microsoft.CognitiveServices.Speech library. I can make it work in my Windows laptop and in a Ubuntu virtual machine, but if I try to run it in my Ubuntu server online, it exits without any exceptions. I can't really understand what the problem is, as I can't get any log message. Here the program:
using System;
using System.Threading.Tasks;
using Microsoft.CognitiveServices.Speech;
namespace text2speech_test
{
class Program
{
static async Task Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
AppDomain.CurrentDomain.ProcessExit += CurrentDomainOnProcessExit;
try{
var text="ciao";
var config = SpeechConfig.FromSubscription("20e436a07865468ba9b78a4aee703c07", "francecentral");
config.SpeechRecognitionLanguage = "it-IT";
config.SpeechSynthesisVoiceName = "it-IT-ElsaNeural";
using var synthesizer = new SpeechSynthesizer(config, null);
var result = await synthesizer.SpeakTextAsync(text);
return;
}
catch(Exception ex){
return;
}
}
static void CurrentDomainOnProcessExit(object sender, EventArgs e){
Console.WriteLine(e);
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Console.WriteLine("Terminating " + e.IsTerminating.ToString());
}
}
}
Can you help me on this?