Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8839647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:16:59+00:00 2026-06-14T10:16:59+00:00

I have in c# and winrt: var stream = await speech.GetSpeakStreamAsync(SpeechText.Text, language); stream is

  • 0

I have in c# and winrt:

var stream = await speech.GetSpeakStreamAsync(SpeechText.Text, language);

stream is a Windows.Storage.Streams.IRandomAccessStream

So I am completly new to c# and winrt. How i save this stream containg a wav-file to a file?
Thanks in advance, Basilius

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:17:00+00:00Added an answer on June 14, 2026 at 10:17 am

    The IRandomAccessStream has a method called GetInputStreamAt http://msdn.microsoft.com/en-US/library/windows/apps/windows.storage.streams.irandomaccessstream

    IInputStream inputStream = stream.GetInputStreamAt(0);
    

    This gets you an IInputStream.

    The IInputStream interface defines just one method, ReadAsync, which lets you read bytes into an IBuffer object. Windows.Storage.Stream also includes a DataReader class that you create based on an IInputStream object and then read numerous .NET objects from the stream as well as arrays of bytes. http://www.charlespetzold.com/blog/2011/11/080203.html , http://msdn.microsoft.com/library/windows/apps/BR208119

    using (var stream = new InMemoryRandomAccessStream())
    {
        // for example, render pdf page
        var pdfPage = document.GetPage((uint)i);
        await pdfPage.RenderToStreamAsync(stream);
    
        // then, write page to file
        using (var reader = new DataReader(stream))
        {
            await reader.LoadAsync((uint)stream.Size);
            var buffer = new byte[(int)stream.Size];
            reader.ReadBytes(buffer);
            await Windows.Storage.FileIO.WriteBytesAsync(file, buffer);
        }
    }
    

    now you have a buffer containing all the read bytes.

    you can now save this buffer to a file http://blog.jerrynixon.com/2012/06/windows-8-how-to-read-files-in-winrt.html

    var file = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync("MyWav.wav", Windows.Storage.CreationCollisionOption.ReplaceExisting);
    await Windows.Storage.FileIO.WriteBytesAsync(file, buffer);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application I'm writing for Windows 8/WinRT that uses the StreamSocket API
I'm developing for Windows 8 (WInRT) and have problem with settings charm. Settings popup
I have a WinRT application for Windows 8 that contains several C++ static libraries
I currently have an issue with a file read in a Windows 8/WinRT application.
I have a WinRT Metro app (XAML/C#, Windows Release Preview) that manages documents. The
I have some existing code which I am porting to Windows 8 WinRT. The
I have a StackPanel in my WinRT C# Metro app that I want to
I have a program that still must target Windows XP (_WIN32_WINNT 0x501), as most
I have created a Windows Store class library. This contains some user controls and
I have the following scenario: Data lib in C# compiled as a Windows Runtime

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.