使用 NAudio 将 .vox 音频文件转换为 .wav 或 .mp3 [英] Converting .vox audio files to .wav or .mp3 with NAudio

查看:140
本文介绍了使用 NAudio 将 .vox 音频文件转换为 .wav 或 .mp3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 NAudio 将 .vox 转换为 .mp3 或 .wav,代码如下:-

I am trying to convert .vox to .mp3 or .wav with NAudio with the code below:-

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);
}

但是,我得到的转换后的 .wav 文件的音频非常失真并且无法收听.我是否缺少 NAudio 的一些配置?

However the converted .wav file I am getting has very distorted audio and its not listenable. Am I missing some configuration with NAudio?

推荐答案

我能够使用以下内容将 .vox 文件转换为 .wav:-

I was able to convert .vox files to .wav with the following:-

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);
}

这里的重要部分是这部分:Mp3WaveFormat.CreateMuLawFormat(8000, 1),这基本上是您要创建的 .wav 文件的某种格式/配置以及这些值可能因您的 .vox 文件而异

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

这篇关于使用 NAudio 将 .vox 音频文件转换为 .wav 或 .mp3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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