从头开始创建 mp3 文件 C#

发布于 2024-12-16 18:37:44 字数 141 浏览 4 评论 0原文

作为一些实验的一部分,我想到了一些事情,如何在 C# 中从头开始创建一个 .mp3 文件,这实际上听起来像什么,例如,创建一个播放音符的 mp3 文件:C# 或 B 降调?

我怎样才能实现这一点,它必须是 mp3 文件,而不是 wav 或其他任何文件。

As part of some experimentation, I thought of something, how can I create a .mp3 file from scratch in C#, that actually sounds like something, e.g, create an mp3 file that plays the note: C#, or B flat?

How can I achieve this, and it must be an mp3 file, not a wav, or anything else.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

疾风者 2024-12-23 18:37:44

所以我无法给你确切的代码,但我可以给出一个起点。

所以基本上步骤是

  1. 找到你想要的波的频率。看看这个。 C#(顺便说一句,不错的选择!)为 17.32HZ
  2. 将频率转换为 LPCM,这只是一系列幅度值。
  3. 将 LPCM 编码数组转换为 MP3 文件。这可能是最难的,但 LPCM 构成了 WAV 格式 的基础,并且有转换器可以将其转换为 MP3。看看发现的 NAudio baalazamon。它支持PCM。

So I'm not going to be able to give you exact code, but I can give a starting point.

So basically the steps would be

  1. Find the frequency of the wave you want. Look at this. C# (nice choice by the way!) is 17.32HZ
  2. Convert the frequency to LPCM, which is just a series of amplitude values.
  3. Convert the LPCM encoded array to an MP3 file. This is probably the hardest, but LPCM forms that basis of the WAV format and there are converters to convert that to MP3. Have a look at the NAudio baalazamon found. It supports PCM.
撞了怀 2024-12-23 18:37:44

我会尝试使用 NAudio 它非常强大。主要目的是操作音频文件,但值得尝试。

I would try using NAudio it's quite powerful. The main purpose was to manipulate audio files but it's worth to try.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文