none
in windows 10, how to record audio? RRS feed

Answers

  • how to record audio by c# or c++?

    Hi BillQu01,

    As fas as I know, you could use mciSendString function:Probably it is easiest.  This function will access the  winmm.dll.

    public class Program
    {
        [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
    
        static void Main(string[] args)
        {
            mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
            mciSendString("record recsound", "", 0, 0);
            Console.WriteLine("recording, press Enter to stop and save ...");
            Console.ReadLine();
    
            mciSendString("save recsound c:\\work\\result.wav", "", 0, 0);
            mciSendString("close recsound ", "", 0, 0);
        }
    }

    Note: Based onmciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string. It means mciSendString function records only microphone sound. if no mic is connected it will record nothing.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Kristin Xie Monday, September 21, 2015 8:17 AM
    • Proposed as answer by Kristin Xie Tuesday, September 22, 2015 1:06 AM
    • Marked as answer by BillQu01 Tuesday, September 22, 2015 10:37 AM
    Monday, September 21, 2015 8:17 AM

All replies

  • the windows user forums are on answers.microsoft.com

    this forum has nothing to do with audio.



    Visual C++ MVP

    Saturday, September 19, 2015 4:16 AM
  • how to record audio by c# or c++?
    Saturday, September 19, 2015 5:25 AM
  • how to record audio by c# or c++?

    Hi BillQu01,

    As fas as I know, you could use mciSendString function:Probably it is easiest.  This function will access the  winmm.dll.

    public class Program
    {
        [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
    
        static void Main(string[] args)
        {
            mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
            mciSendString("record recsound", "", 0, 0);
            Console.WriteLine("recording, press Enter to stop and save ...");
            Console.ReadLine();
    
            mciSendString("save recsound c:\\work\\result.wav", "", 0, 0);
            mciSendString("close recsound ", "", 0, 0);
        }
    }

    Note: Based onmciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string. It means mciSendString function records only microphone sound. if no mic is connected it will record nothing.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Kristin Xie Monday, September 21, 2015 8:17 AM
    • Proposed as answer by Kristin Xie Tuesday, September 22, 2015 1:06 AM
    • Marked as answer by BillQu01 Tuesday, September 22, 2015 10:37 AM
    Monday, September 21, 2015 8:17 AM