Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Windows;
- namespace SampleSynthesis {
- class Program {
- static async System.Threading.Tasks.Task Main(string[] args) {
- var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
- Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream =
- await synth.SynthesizeTextToStreamAsync("I want to listen to this text");
- using (var reader = new Windows.Storage.Streams.DataReader(stream)) {
- await reader.LoadAsync((uint)stream.Size);
- Windows.Storage.Streams.IBuffer buffer = reader.ReadBuffer((uint)stream.Size);
- Windows.Storage.StorageFile file = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync("audio.wav");
- await Windows.Storage.FileIO.WriteBufferAsync(file, buffer);
- }
- }
- }
- "C:Program Files (x86)Microsoft Visual Studio2019BuildToolsMSBuildCurrentBinRoslyncsc.exe" /r:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5.2System.Speech.dll","C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETCorev4.5System.Runtime.WindowsRuntime.dll","C:WindowsMicrosoft.NETFramework64v4.0.30319System.runtime.dll","C:Program Files (x86)Windows Kits10UnionMetadata10.0.17763.0Windows.winmd","C:WindowsMicrosoft.NETFramework64v4.0.30319System.Threading.Tasks.dll" tts.cs
- Unhandled Exception: System.InvalidOperationException: The process has no package identity. (Exception from HRESULT: 0x80073D54)
- at Windows.Storage.ApplicationData.get_Current()
- at SampleSynthesis.Program.<Main>d__0.MoveNext()
- --- End of stack trace from previous location where exception was thrown ---
- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
- at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
- at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
- at SampleSynthesis.Program.<Main>(String[] args)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement