I googled it for a long time and I'm really suprised no one mentioned this.
Last active
February 14, 2023 01:50
-
-
Save imba-tjd/5d76060f25735cd3d6bbe1cc4702fd28 to your computer and use it in GitHub Desktop.
Call UWP / WinRT API from Win32 without installing Windows SDK
This file contains hidden or 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
// Compile: csc TTS.cs /o /r:Windows.winmd /r:System.Runtime.dll /r:System.Runtime.WindowsRuntime.dll | |
using System; | |
using System.IO; | |
using System.Threading.Tasks; | |
var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); | |
string text = Console.In.ReadToEnd(); | |
var stream = await synth.SynthesizeTextToStreamAsync(text); | |
var fs = new FileStream("tts.wav", FileMode.Create); | |
stream.AsStream().CopyTo(fs); | |
stream.CloneStream(); | |
fs.Close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment