文本到语音使用拼音声音 [英] Text-to-speech using Phonics Sounds

查看:138
本文介绍了文本到语音使用拼音声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能获得拼音音按任意字母键?比如,我想通过按A键搞定的 A 的拼音音。

How can I get the phonics sound by pushing any letter key? For example, I want to get the phonics sound of A by pushing the 'A' key.

我使用的是微软的SAPI 5.1版。你能指出正确的方向我好吗?

I'm using Microsoft SAPI v5.1. Can you point me in the right direction please?

推荐答案

添加引用 System.Speech 组件。

添加使用System.Speech.Synthesis;

using (var speechSynthesizer = new SpeechSynthesizer())
{
    speechSynthesizer.Speak("A");
    speechSynthesizer.Speak("B");
    speechSynthesizer.Speak("C");
}

例如是这样的:

using (var speechSynthesizer = new SpeechSynthesizer())
{
    while (true)
    {
        var consoleKey = Console.ReadKey();
        if (consoleKey.Key == ConsoleKey.Escape)
            break;
        var text = consoleKey.KeyChar.ToString();
        speechSynthesizer.Speak(text);
    }
}

这篇关于文本到语音使用拼音声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆