我只是嘗試運行簡單的微軟示例文本到語音使用Microsoft.Speech.dll;Microsoft.Speech.Synthesis不適用於文本到語音但System.Speech.Synthesis works.Why?
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與 微軟語音平臺使文本到語音轉換(TTS)?我應該做一些 額外配置?
我安裝了服務器tts的聲音......和我的Microsoft.Speech測試程序列出它們。我看到了無聲的聲音,並在Windows註冊表中檢查它們。 –
你有沒有調用[SetOutputToDefaultAudioDevice](http://msdn.microsoft.com/en-us/library/lync/microsoft.speech.synthesis.speechsynthesizer.setoutputtodefaultaudiodevice(v = office.13).aspx)?默認情況下,Microsoft.Speech引擎不會發生這種情況,而System.Speech引擎會引發這種情況。 –