1
我正在嘗試對文本通用應用程序發表演講,但卡住了一件事。我看遍了所有的互聯網,找不到合適的解決方案。所以我來到了這裏..基本上我想讓應用程序保存文本框中的文字爲mp3。這是我到目前爲止的代碼:Windows RT /通用應用程序,文本到語音「另存爲Mp3」
private void Speak_Click(object sender, RoutedEventArgs e)
{
SpeakText(Text.Text);
}
public async void SpeakText(string TTS)
{
SpeechSynthesizer ttssynthesizer = new SpeechSynthesizer();
//Set the Voice/Speaker
using (var Speaker = new SpeechSynthesizer())
{
Speaker.Voice = (SpeechSynthesizer.AllVoices.First(x => x.Gender == VoiceGender.Female));
ttssynthesizer.Voice = Speaker.Voice;
}
SpeechSynthesisStream ttsStream = await ttssynthesizer.SynthesizeTextToStreamAsync(TTS);
//play the speech
MediaElement media = new MediaElement();
media.SetSource(ttsStream, " ");
}
做的是如何保存SpeechSynthesStrem爲.wav文件?對不起,我是新東西 – ProgrammingPotato 2014-11-24 18:35:14
@ProgrammingPotato查看鏈接的cpp文件,它在事件處理程序'BtnSaveToFile_Click'下 – 2014-11-24 21:47:35
謝謝,但我一直在尋找c#代碼,而不是C++。我會放棄它,直到我更多地瞭解編程。 – ProgrammingPotato 2014-11-24 22:40:04