0

可以通过 SAPI 通过以下方式提取给定单词的默认音素:

  1. 带有文本到语音的语音单词并将输出存储在 .wav 中
  2. 使用 .wav 作为语音识别的输入
  3. 在识别单词后,从识别的短语元素中提取音素

但是,我无法捕获(如果有的话)强调标记(美国英语音素表中的“1”和“2” )。有没有办法做到这一点?

编辑:这是我迄今为止尝试过的(不是很漂亮,但很实用)。可悲的是,即使我通过 SAPI 语音词典修改手动添加对单词的强调,SpeechVisemeFeature 似乎总是显示“SVF_None”。有人知道为什么吗?

using System;
using System.Threading;
using SpeechLib;
using System.Windows.Forms;

namespace PhoneEmphasis
{
    class Program
    {
        static string myWord = "hello";
        static SpPhoneConverter c = new SpPhoneConverter();
        static Thread t = null;

        static void Main(string[] args)
        {
            c.LanguageId = 1033;
            t = new Thread(test);
            t.Start();
            t.Join();
            Console.WriteLine("done");
            Console.ReadLine();
        }

        private static void test()
        {
            SpVoice v = new SpVoice();
            //v.EventInterests = SpeechVoiceEvents.;
            v.Phoneme += new _ISpeechVoiceEvents_PhonemeEventHandler(Phoneme_Handler);
            v.EndStream += new _ISpeechVoiceEvents_EndStreamEventHandler(EndStream_Handler);
            v.Speak(myWord, SpeechVoiceSpeakFlags.SVSFlagsAsync);
            Application.Run();
        }

        private static void Phoneme_Handler(int StreamNumber, object StreamPosition, int Duration, short NextPhoneId, SpeechVisemeFeature Feature, short CurrentPhoneId)
        {
            Console.WriteLine("Phoneme = " + c.IdToPhone(CurrentPhoneId).ToString() + " , VisemeFeature = " + Feature.ToString());
        }

        private static void EndStream_Handler(int StreamNumber, object StreamPosition)
        {
            Console.WriteLine("end stream!");
            t.Abort();
        }
    }
}
4

0 回答 0