Hi @Orlando José Polo Padilla,
Next time please use English, then you could get help faster. Please re-generate the speeckey
when you use higher price plan.
Why I change the test code, because I am facing other issues related to environment, if you not facing the same issue again, it means it works in your project. If you facing other issues, we very much welcome your new questions.
I create a folder and copy the Microsoft.CognitiveServices.Speech.core.dll
file into the new folder. And select Copy always like below.
We can find Microsoft.CognitiveServices.Speech.core.dll
file here.
Here is my test code
using Microsoft.CognitiveServices.Speech;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _1183770
{
public partial class _Default : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public async void Speak()
{
string speechKey = "ab48e94e9a9c4d5a806c4fa05ded6b5b";
string speechRegion = "eastus";
var speechConfig = SpeechConfig.FromSubscription(speechKey, speechRegion);
speechConfig.SetSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm);
var synthesizer = new SpeechSynthesizer(speechConfig, null);
var result = await synthesizer.SpeakTextAsync("I'm excited to try text-to-speech");
var stream = AudioDataStream.FromResult(result);
await stream.SaveToWaveFileAsync("E://file" + Guid.NewGuid().ToString() + ".wav");
}
protected async void btnTest_Click(object sender, EventArgs e)
{
// Here's where you do stuff.
Speak();
}
}
}
Test Result
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards,
Jason