如何使用NAudio在Windows 10中存储.wav文件 [英] How to store a .wav file in Windows 10 with NAudio

查看:310
本文介绍了如何使用NAudio在Windows 10中存储.wav文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的16000hz 16位单声道PCM音频字节存储到Windows 10应用程序中的wav文件中.

I'm trying to store my 16000hz 16bit mono PCM audio bytes to a wav file in a Windows 10 app.

NAudio通常具有WavFileWriter,但似乎在Windows 10版本中已消失.我似乎只能找到对新的WaveFormat(16000,16,1)的访问权限;来自 https://www.nuget.org/packages/NAudio/1.7.3/

NAudio normaly has a WavFileWriter, but it seems to be gone in the Windows 10 version. I can only seem to find access to new WaveFormat(16000, 16, 1); from https://www.nuget.org/packages/NAudio/1.7.3/

是否存在可用于创建Wav文件或其字节的流?

Is there a stream I can use to create the Wav file or its bytes?

推荐答案

是的,在UWP中WaveFileWriter不可用的原因是,因为您不能在UWP中使用旧的File API,所以WaveFileWriter需要被重新编写以在UWP中工作.

Yes the reason WaveFileWriter is not available in UWP is because you can't use the old File APIs in UWP so WaveFileWriter would need to be re-written to work in UWP.

正如Tommaso所指出的那样,UWP实际上具有使用AudioGraph创建WAV文件的能力,但是它的选项非常有限,因此您可能无法指定所需的确切采样率.您可能会发现AudioEncodingQuality.Low通过WAV使用较低的采样率. (我不记得了)

As Tommaso has pointed out, UWP does actually have the ability to create WAV files using AudioGraph but it's options are very limited, so you may not be able to specify the exact sample rate you want. You might find that AudioEncodingQuality.Low uses a lower sample rate with WAV. (I can't remember off the top of my head)

这篇关于如何使用NAudio在Windows 10中存储.wav文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆