C# WAV记录器功能,需要将格式更改为int16或int24

C# WAV记录器功能,需要将格式更改为int16或int24,c#,audio,format,record,wav,C#,Audio,Format,Record,Wav,此代码从我的麦克风录制,并将录制的WAV文件保存在项目的当前目录中。但是,这个WAV文件的格式不是我想要的。它不是int。我需要保存为“int 16”或“int 24”格式的WAV文件格式。有人知道如何以这种格式保存吗?或者将其转换为这种格式?这可能会起作用。。。我没有Window$,因此无法自己执行它 public class Worker { private static extern int mciSendString(string lpstrCommand, string lps

此代码从我的麦克风录制,并将录制的WAV文件保存在项目的当前目录中。但是,这个WAV文件的格式不是我想要的。它不是int。我需要保存为“int 16”或“int 24”格式的WAV文件格式。有人知道如何以这种格式保存吗?或者将其转换为这种格式?

这可能会起作用。。。我没有Window$,因此无法自己执行它

public class Worker
{
    private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);

        public void WavRecorder()
    {
        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 result.wav", "", 0, 0);
        mciSendString("close recsound ", "", 0, 0);
    }

你设定了吗?不,我怎么做?请在文件中使用媒体控制接口(MCI)。代码是C++的,但我需要C。另外,如果你不介意的话,你能告诉我如何理解任何文档吗?我必须一直阅读直到我理解其中的一个句子吗?我甚至不知道在读WinMM.dll时我在寻找什么,因为它是一个非托管库,所以为了在.NET中使用它,您需要这样做。如果您正在使用该接口,您应该已经意识到这一点。就文档而言,您不会是第一个发现MSDN文档难以理解的人。我真的帮不了你。您可能会考虑使用现有的包装器。实际上,我的代码表示“每个FLACK不支持每个采样8位”,所以WAV不是16?8点了?我想找到允许您使用16位录制的配置设置。。。避免尝试将8位WAV转换为16位您所说的配置设置是什么意思?这与msisendstring有关吗?事实上,我对您提供给我的代码感到困惑。我不太明白。我只是把它添加到我的函数中吗?我在上面的同一个问题中添加了一个链接。。。最初只需尝试添加bitspersample 16
public void WavRecorder() {

    mciSendString("open new type waveaudio alias capture", "", 0, 0);
    mciSendString("set capture time format ms bitspersample 16", "", 0, 0);
    mciSendString("set capture channels 1 samplespersec 8000", "", 0, 0);
    mciSendString("set capture alignment 1 bytespersec 8000", "", 0, 0);
    mciSendString("record capture", "", 0, 0);

    Console.WriteLine("recording, press Enter to stop and save ...");
    Console.ReadLine();

    mciSendString("stop capture", "", 0, 0);
    mciSendString("save capture \"" + result.wav + "\"", "", 0, 0);
    mciSendString("close capture", "", 0, 0);
}