You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I'm truing to convert text to speech in C# I'm always getting cancelled response. Why I'm getting Reason [ResultReason]: Cancel even after providing correct details. We are using Standard Tire plan also. So I would like to request you please guide me. I tried multiple time but always getting same response.
Code
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.CognitiveServices.Speech;
using Microsoft.CognitiveServices.Speech.Audio;
class Program
{
static string speechKey = "1234567890"; //replaced
static string speechRegion = "someWhereOnMars"; //replaced
static void OutputSpeechSynthesisResult(SpeechSynthesisResult speechSynthesisResult, string text)
{
Console.WriteLine($"Tango Reason: {speechSynthesisResult.Reason}");
switch (speechSynthesisResult.Reason)
{
case ResultReason.SynthesizingAudioCompleted:
Console.WriteLine($"Speech synthesized for text: [{text}]");
break;
case ResultReason.Canceled:
var cancellation = SpeechSynthesisCancellationDetails.FromResult(speechSynthesisResult);
Console.WriteLine($"CANCELED: Reason={cancellation.Reason}");
if (cancellation.Reason == CancellationReason.Error)
{
Console.WriteLine($"CANCELED: ErrorCode={cancellation.ErrorCode}");
Console.WriteLine($"CANCELED: ErrorDetails=[{cancellation.ErrorDetails}]");
Console.WriteLine($"CANCELED: Did you set the speech resource key and region values?");
}
break;
default:
break;
}
}
async static Task Main(string[] args)
{
var speechConfig = SpeechConfig.FromSubscription(speechKey, speechRegion);
// The language of the voice that speaks.
speechConfig.SpeechSynthesisVoiceName = "en-US-JennyNeural";
using (var speechSynthesizer = new SpeechSynthesizer(speechConfig))
{
// Get text from the console and synthesize to the default speaker.
string text = "Enter some text that you want to speak ";
var speechSynthesisResult = await speechSynthesizer.SpeakTextAsync(text);
OutputSpeechSynthesisResult(speechSynthesisResult, text);
}
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
The text was updated successfully, but these errors were encountered:
While I'm truing to convert text to speech in C# I'm always getting cancelled response. Why I'm getting Reason [ResultReason]: Cancel even after providing correct details. We are using Standard Tire plan also. So I would like to request you please guide me. I tried multiple time but always getting same response.
Code
The text was updated successfully, but these errors were encountered: