using SpeechLib;
using System;
class Program
{
static void Main(string[] args)
{
SpeakToFile(Console.ReadLine());
}
static void SpeakToFile(string toSpeak)
{
SpVoice v = new SpVoice();
v.EventInterests = SpeechVoiceEvents.SVEAllEvents;
v.Word += V_Word;
SpFileStream speechStream = new SpFileStream();
speechStream.Open("D:/Documenten/test.mp3", SpeechStreamFileMode.SSFMCreateForWrite, true);
v.AudioOutputStream = speechStream;
v.Rate = 0;
v.Speak(toSpeak, SpeechVoiceSpeakFlags.SVSFDefault);
speechStream.Close();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
static void V_Word(int StreamNumber, object StreamPosition, int CharacterPosition, int Length)
{
Console.WriteLine(CharacterPosition);`
}
}
我试图让Word事件显示在控制台中。但这不起作用。
我在互联网上搜索了答案,但我找不到任何相关内容。
有人可以向我解释我做错了什么吗?感谢