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 7001277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:46:57+00:00 2026-05-27T20:46:57+00:00

This question is not a duplicate of Get data file from microphone in windows

  • 0

This question is not a duplicate of Get data file from microphone in windows phone 7 or any other referenced in it.

In Windows Phone, I record the microphone data in a following manner:

  1. I start a Dispatcher.Update timer to simulate an XNA game loop.
  2. I subscribe to Microphone.BufferReady and set a buffer duration. Then, I start the microphone.

    // Event handler for getting audio data when the buffer is full
    _microphone.BufferReady += MicrophoneBufferReady;
    
    // Get audio data in 1/2 second chunks
    _microphone.BufferDuration = TimeSpan.FromMilliseconds(100); 
    
  3. Then, each time I get a chunk of audio data from a mic, I record it to a data stream.

    // Retrieve audio data
    _microphone.GetData(_buffer);
    
    _stream.Write(_buffer, 0, _buffer.Length);
    
  4. Whenever the recording is over, the data stream is saved to an Isolated Storage as a file.

    var soundFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".wav";
    using (var isStore = IsolatedStorageFile.GetUserStoreForApplication())
    {
        using (var isfStream = new IsolatedStorageFileStream(soundFileName, FileMode.Create, isStore))
        {
            isfStream.Write(data.ToArray(), 0, data.ToArray().Length);
            isfStream.Close();
        }
    }
    

    Where data is a MemoryStream holding all the microphone buffers, that were collected during the recording.

The problem is, that the file actually saved isn’t a wav file. If I copy it to a desktop using an ISETool, I can’t play the sound.

How do I save the microphone recording to a file, so that it is saved in a .wav format?

P.S. I can play it on the device just fine if I read the data from IS and pack it into a SoundEffect instance.

_soundInstance = new SoundEffect(_data, Microphone.Default.SampleRate, AudioChannels.Mono).CreateInstance();
  • 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-05-27T20:46:58+00:00Added an answer on May 27, 2026 at 8:46 pm

    The format of the buffer is raw PCM.
    Adding the WAV header to the start of the file is al that is required.
    However the file is uncompressed and a better solution would be to zip the file on the device(to reduce its size) and send in to a web service for conversion to a compressed WAV format

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Title borrowed from this question , of which this one is not a duplicate.
I hope this question is not a duplicate but I didn't find anything equivalent
Duplicate of this question . update - This is not an exact duplicate. See
This question is about removing sequences from an array, not duplicates in the strict
This might be a duplicate question but as you can see they didn't get
Possible Duplicate: File to byte[] in Java I want to read data from file
Maybe this question is duplicate, but I can not find an answer for my
Okay this is not a question of how to get all uniques or How
This question is not so much programming related as it is deployment related. I
This question might not seem programming related at first, but let me explain. I'm

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.