2014-12-25 57 views
0

我在Windows Phone 8.1 Store應用程序(XAML應用程序/ Windows運行時應用程序/通用應用程序)中使用SpeechSynthesizer類。它輸出一個SpeechSynthesisStream,我需要將它保存爲手機本地存儲器中的mp3 /音頻文件。這裏是我用來生成流的代碼。如何將其保存爲音頻文件?如何將SpeechSynthesisStream保存爲Windows Phone 8.1本地存儲器中的音頻

using (var speech = new SpeechSynthesizer()) 
{ 
     var voiceStream = await speech.SynthesizeTextToStreamAsync(text); 
} 

回答

1

沒有在twitter上看到你。請原諒我。我認爲你應該做的第一件事是在一個wav文件保存的音頻作爲

 var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); 

     SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Hello World"); 

     using (var reader = new DataReader(stream)) 
     { 
      await reader.LoadAsync((uint)stream.Size); 
      IBuffer buffer = reader.ReadBuffer((uint)stream.Size); 
      await FileIO.WriteBufferAsync(outputFile, buffer); 
     } 

你做完這些後,你可以轉碼這一個MP3。爲此,我相信這個: http://msdn.microsoft.com/library/windows/apps/hh452795http://go.microsoft.com/fwlink/p/?linkid=242136 是需要調查的地方。 ;)

相關問題