简体   繁体   English

使用 NAudio 将 .vox 音频文件转换为 .wav 或 .mp3

[英]Converting .vox audio files to .wav or .mp3 with NAudio

I am trying to convert.vox to.mp3 or.wav with NAudio with the code below:-我正在尝试使用NAudio将.vox 转换为.mp3 或.wav,代码如下:-

var bytes = GetBytes(new FileInfo(@"D:\path\to\vox-file.vox"));

using (var writer = new WaveFileWriter(@"D:\path\to\wav-file.wav", new WaveFormat(8000, 8, 2)))
{
    writer.Write(bytes, 0, bytes.Length);
}

However the converted .wav file I am getting has very distorted audio and its not listenable.但是,我得到的转换后的.wav文件具有非常失真的音频并且无法收听。 Am I missing some configuration with NAudio ?我是否缺少NAudio的一些配置?

I was able to convert.vox files to.wav with the following:-我能够使用以下内容将.vox 文件转换为.wav:-

var bytes = GetBytes(new FileInfo(@"path-to.vox"));

using (var writer = new WaveFileWriter(@"path-to.wav", Mp3WaveFormat.CreateMuLawFormat(8000, 1)))
{
    writer.Write(bytes, 0, bytes.Length);
}

The important bit here is this part: Mp3WaveFormat.CreateMuLawFormat(8000, 1) , this is basically some kind of format/configuration for the.wav file which you want to be created and these values may vary depending upon your.vox files这里的重要一点是这部分: Mp3WaveFormat.CreateMuLawFormat(8000, 1) ,这基本上是您要创建的 .wav 文件的某种格式/配置,这些值可能会因您的 .vox 文件而异

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM