Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text To Speech #45

Open
cyberprophet opened this issue Jul 18, 2023 · 0 comments
Open

Text To Speech #45

cyberprophet opened this issue Jul 18, 2023 · 0 comments

Comments

@cyberprophet
Copy link
Member

cyberprophet commented Jul 18, 2023

if (PlatformID.Win32NT == Environment.OSVersion.Platform)
{
    var tts = new TextToSpeech(Resources.GOOGLESERVICE);

    using (var ms = new MemoryStream())
    {
        tts.VoiceSelection.LanguageCode = Google.Cloud.Speech.V1.LanguageCodes.Korean.SouthKorea;
        tts.VoiceSelection.SsmlGender = (Google.Cloud.TextToSpeech.V1.SsmlVoiceGender)(inventory.Value.Name.Length % 2 + 1);

        using (var sp = new SoundPlayer(await tts.SynthesizeSpeechAsync(ms, inventory.Value.Name)))
        {
            sp.PlaySync();
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant