- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我对音频或 mp3 的东西很陌生,一直在寻找一种方法来具有在 C#、asp.net 中拆分 mp3 文件的功能。在没有太多帮助的情况下用谷歌搜索了 3 天,我希望这里有人能给我指明正确的方向。
我可以使用 NAudio 来完成这个吗?有没有示例代码?提前致谢。
最佳答案
我在 C# 中拆分 mp3 文件的最终解决方案是使用 NAudio。这是一个示例脚本,希望它对社区中的某个人有所帮助:
string strMP3Folder = "<YOUR FOLDER PATH>";
string strMP3SourceFilename = "<YOUR SOURCE MP3 FILENAMe>";
string strMP3OutputFilename = "<YOUR OUTPUT MP3 FILENAME>";
using (Mp3FileReader reader = new Mp3FileReader(strMP3Folder + strMP3SourceFilename))
{
int count = 1;
Mp3Frame mp3Frame = reader.ReadNextFrame();
System.IO.FileStream _fs = new System.IO.FileStream(strMP3Folder + strMP3OutputFilename, System.IO.FileMode.Create, System.IO.FileAccess.Write);
while (mp3Frame != null)
{
if (count > 500) //retrieve a sample of 500 frames
return;
_fs.Write(mp3Frame.RawData, 0, mp3Frame.RawData.Length);
count = count + 1;
mp3Frame = reader.ReadNextFrame();
}
_fs.Close();
}
感谢 Mark Heath 对此的建议。
所需的命名空间是 NAudio.Wave。
关于c# - NAudio 拆分 mp3 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6094287/
在 dotnetcore 3.0 Blazor 应用程序中,我希望能够使用 NAudio 录制音频,而不是在 Javascript 中实现 HTML5 控件。 NAudio 支持吗? 我已经尝试过下面
我们可以使用 NAudio 播放 mp4 歌曲吗?请提供一些播放mp4歌曲的代码我需要一个 c# 代码来帮助我播放 mp4 歌曲 最佳答案 可以用NAudio播放.mp4文件,官网有demo。 下载演
前几天我刚刚发现了 NAudio,并且一直在玩它。我编写了一个简单的 Windows 窗体程序,它有一个加载按钮(加载特定的 .wav 歌曲)和播放、暂停、停止、淡入声音的按钮(我自己使用计时器和逐渐
我们可以使用 NAudio 播放 mp4 歌曲吗?请提供一些播放mp4歌曲的代码我需要一个 c# 代码来帮助我播放 mp4 歌曲 最佳答案 可以用NAudio播放.mp4文件,官网有demo。 下载演
如果我的问题听起来很幼稚,我很抱歉使用 NAudio。 我的项目是使用 WPF MediaElement 控件播放视频文件,然后访问播放视频的音频流(使用 NAudio)以表示播放时视频的音轨(波形等
我一直在到处寻找答案,但我只能找到一些零碎的东西。我想要做的是加载多个 mp3 文件(暂时合并它们),然后使用静音检测将它们切成碎片。 我的理解是,我可以为此使用 Mp3FileReader,但问题是
我希望能够通过 NAudio.WaveIn 从麦克风设备获取输入,然后通过 NAudio.WaveOut 将准确的输入输出到输出设备。 我该怎么做? 最佳答案 这是对我有用的代码: using Sys
我已经有了 mp3/wma 音频播放/停止和浏览的代码。我只需要知道如何循环播放歌曲? 谢谢你。 最佳答案 这是我写的一篇关于如何操作的博客文章 loop audio using NAudio . 关
我正在使用 NAudio DLL,我正在寻找音高转换声音的示例代码。 最佳答案 有一个使用 NAudio 的例子用于开源中的音高转换 Skype Voice Changer项目。见我的文章 Codin
我正在构建一个应用程序,用于将麦克风的音频记录到一个文件 (.mp3) 中。我希望我的应用程序仅在检测到足够高的振幅时才将数据写入文件。我在尝试保存所选数据时遇到问题。我得到的只是快速失真,甚至与录制
我需要播放RTP数据包中的解码音频有效负载。 我能够将解码后的有效负载存储到内存流中 但是我不知道如何使用NAudio之类的库来播放它。 我有这样的代码: MemoryStream payload =
我跟随this NAudio Demo修改为播放ShoutCast。 在我的完整代码中,我必须对传入的音频进行重新采样,然后再次通过网络将其流式传输到网络播放器。由于出现了很多“喀哒声”,因此我回到了
这是我的简单代码 var reader = new Mp3FileReader("Audio/Battle Wild Intro.mp3"); var reader2 = new Mp3FileRea
An unhandled exception of type 'System.ArgumentException' occurred in NAudio.dll Additional informat
如here所述,可以使用OffsetSampleProvider来播放音频文件的特定部分。像这样: AudioFileReader AudioReader = new AudioFileReader(
创建WaveOut对象并使用WaveOffsetStream对其进行初始化时,在播放结束时不会引发PlaybackStopped事件。码: WaveOut myWaveOut = new WaveOu
我们正在使用用 c# 编写的 NAudio 堆栈,并尝试以 PCM 8kHZ 和每个样本 16 位的独占模式捕获音频。 在以下函数中: private void InitializeCaptureDe
在我的应用程序中,我使用WaveIn从mic进行录音,并允许我的客户端使用AudioEndpointVolume调整录音级别。到目前为止,我还没有任何问题,但是由于我的客户可能有其他声卡,因此我想问一
我决定尝试使用 NAudio 和虚拟音频电缆创建一个与 Discord(或类似软件)一起使用的音板。我能够将音频从麦克风“注入(inject)”到音频电缆,这样我就可以通过在 Discord 中选择虚
我正在实现一个程序,该程序从输入设备读取音频流并使用 NAudio 将其发送到输出设备。为此,我使用 WaveIn 从输入流中获取数据。和它的 DataAvailable事件。写数据,我准备用Wave
我是一名优秀的程序员,十分优秀!