In this article, I'll demonstrate how to use System.Speech.NET, a valuable tool for developing speech applications. It is available for .NET 4.x, .NET 5, 6, and 7.
It supports speech recognition and text-to-speech and provides a unified API.
With System.Speech.NET, you can easily create applications that understand and respond to natural language input.
We will focus here on the Speak method.
How do I do?
1) Create a folder and run dotnet command to create a new project,
![Using System.Speech with Extension .NET 7]()
2) Open Manage NuGet Packages... on the context menu in "Dependencies" on Solution Explorer,
![Using System.Speech with Extension .NET 7]()
3) Browse for System.Speech and add it to the project,
![Using System.Speech with Extension .NET 7]()
4) Create an extension class,
How to use this extension
Add controls to your Form.
![Using System.Speech with Extension .NET 7]()
Add events
About the extension
Speak directly from the string like:
Or from Text property,
Bonus
While debugging, send speak from Message string error using SpeakError extension.
Extension methods are handy for working from value to action.
I hope this article helps you to make a better world.