我只是尝试使用Microsoft.Speech.dll 为 Text To Speech 运行简单的 Microsoft 示例;
using System;
using Microsoft.Speech.Synthesis;
namespace TTS
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Testing TTS!");
// Initialize a new instance of the SpeechSynthesizer.
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
// Output information about all of the installed voices.
Console.WriteLine("Installed voices -");
foreach (InstalledVoice voice in synth.GetInstalledVoices())
{
VoiceInfo info = voice.VoiceInfo;
Console.WriteLine(" Voice Name: " + info.Name);
}
// Select the US English voice.
synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)");
// Build a prompt.
PromptBuilder builder = new PromptBuilder();
builder.AppendText("That is a big pizza!");
// Speak the prompt.
synth.Speak(builder);
}
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}
虽然我有正确的声音,但它不会发出任何声音。没有文字转语音 (TTS) 语音。
当我使用 Microsoft System.Speech.dll时,我可以听到声音。所以没有声音问题。
using System;
using System.Speech.Synthesis;
namespace TTS
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Testing TTS!");
// Initialize a new instance of the SpeechSynthesizer.
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
// Output information about all of the installed voices.
Console.WriteLine("Installed voices -");
foreach (InstalledVoice voice in synth.GetInstalledVoices())
{
VoiceInfo info = voice.VoiceInfo;
Console.WriteLine(" Voice Name: " + info.Name);
}
// Build a prompt.
PromptBuilder builder = new PromptBuilder();
builder.AppendText("That is a big pizza!");
// Speak the prompt.
synth.Speak(builder);
}
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
}
不久
为什么我听不到任何声音或使用 Microsoft.Speech 使用 Microsoft Speech Platform 进行文本转语音 (TTS)?我应该做一些额外的配置吗?