Reputation: 73
I'm trying to save a text to Audio file in my web app developed in ASP.NET Core 2.0.
I'm trying to find the support for the System.Speech, but the namespace seems not available in .NET Core.
Can anyone give me any alternate class libraries to save a text to audio file (MP3).
I found some ScriptCs code samples but they are not working for me.
Does anyone has any suggestions?
Upvotes: 2
Views: 2629
Reputation: 87
Not sure if this is an option for you, but you could set your ASP.NET Core app to target the .NET Framework.
Edit yourapp.csproj and change:
<TargetFramework>netcoreapp2.2</TargetFramework>
to
<TargetFramework>net472</TargetFramework>
Now you should be able to add the reference to System.Speech and do something like:
System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer();
synth.SetOutputToDefaultAudioDevice();
synth.Speak("Your awesome web site is starting!!");
Another cool way to get this done would be to use some on-line API, such as Azure Speech Services (text-to-speech) that is pretty much platform independent and provides plenty of configuration options (https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/text-to-speech).
Upvotes: 1