Last active
April 15, 2024 01:38
-
-
Save robertmeta/42358108f589ebd740ca0c8669cb381e to your computer and use it in GitHub Desktop.
Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to use: | |
// 1. make directory | |
// 2. switch to directory | |
// 3. dotnet new console | |
// 4. dotnet add package System.Speech | |
// 5. copy this file into Program.cs | |
// 6. dotnet run | |
using System; | |
using System.Speech.Synthesis; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using (SpeechSynthesizer synth = new SpeechSynthesizer()) | |
{ | |
synth.SelectVoice("Microsoft Zira Desktop"); | |
string ssml = @"<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'> | |
<prosody pitch='0%'>hello</prosody> | |
<prosody pitch='+20%'>world</prosody> | |
</speak>"; | |
synth.SpeakSsml(ssml); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment