如何在 C# 中将 midi 转换为 wav/mp3?
我开始了一个小项目,其中包括处理 MIDI 文件。 我一直想知道,是否有任何 C# 或 VB.Net 代码可以在 MIDI 和 WAV 文件之间进行转换?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我开始了一个小项目,其中包括处理 MIDI 文件。 我一直想知道,是否有任何 C# 或 VB.Net 代码可以在 MIDI 和 WAV 文件之间进行转换?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
您可以尝试以某种方式与开源的 Timidity 进行交互:
FluidSynth 是一个最近更新的开源项目,其风格类似:
您可以从 此列表。
You could try to somehow interface with Timidity, which is Open Source:
FluidSynth is a more recently updated Open Source project in a similar vein:
You can download some free SoundFonts (the actual PCM data used by these synthesizers to "render" the MIDI files) from the sites on this list.
MIDI 文件仅包含音符和控制器信息,不包含声音。 为了从 MIDI 文件中获取声音,您必须将该文件传递给音乐合成器或采样器,这会将音符和控制器信息转换为实际的声音。
实际上,这意味着任何给定的 MIDI 文件都没有特定的声音。 将 MIDI 文件转换为音频所产生的声音将根据合成器或样本库的质量以及选择执行转换的声音而有所不同。
许多声卡都能够从 MIDI 文件产生声音。 他们可以做到这一点,因为许多 MIDI 文件遵循称为通用 MIDI 规范< 的标准/a>. 通用 MIDI 规范提供了映射特定乐器分配的标准化方法。 如果您的 MIDI 文件符合此标准,您可以通过通用 MIDI 声音发生器播放它,并期望军鼓听起来像军鼓,而不是像小号。
如果您有复杂的音乐制作包,例如 Cakewalk,您可以加载 MIDI文件放入其中,它将使用其板载声音库为您渲染声音文件,这实际上可以比实时更快地完成(即它不必通过声卡播放声音并捕获输出)。
我想我想说的是这里面有很多变化的部分。 没有任何一段代码或类模块可以为您执行此操作。
MIDI files contain only note and controller information, not sounds. In order to get sounds from a MIDI file, you have to pass the file through a music synthesizer or sampler, which will convert the note and controller information into actual sounds.
In practice this means that any given MIDI file doesn't have a specific sound to it. The sound that results from converting a MIDI file to audio will vary depending on the quality of the synthesizer or sample library, and the sounds that are selected to perform the conversion.
Many sound cards have the capability of producing sound from MIDI files. They can do this because many MIDI files follow a standard called the General MIDI specification. The General MIDI Specification provides a standardized way to map specific instrument assignments. If your MIDI file conforms to this standard, you can play it through a General MIDI sound generator and expect a snare drum to sound like a snare drum, and not like a trumpet.
If you have a sophisticated music production package like Cakewalk, you can load a MIDI file into it, and it will use its on-board sound libraries to render a sound file for you, and this can actually be done faster than real-time (i.e. it doesn't have to play the sound through the sound card and capture the output).
I guess what I'm trying to say is there's a lot of moving parts to this. There isn't a single piece of code or a class module that will do this for you.
您可以购买许多程序来执行此操作(谷歌“将 midi 转换为 WAV”),但我从未遇到过可以执行此操作的公开可用的 .Net 代码(我认为其中一些程序是用 . Net,但源代码不可用)。
我有一个在线朋友正在开发一个商业 MIDI 到 WAV 转换器,但它不在 .Net 中,也不会开源。 正如罗伯特·哈维(Robert Harvey)提到的,这根本不是一个简单的任务,因为它基本上涉及编写自己的软件合成器(这是我自己内心的任务)。
There are a number of programs you can purchase that will do this (google "convert midi to WAV"), but I've never come across publically-available .Net code that does this (I think some of these programs are written in .Net, but the source code is not available).
I have an online friend who is working on a commercial MIDI-to-WAV converter, but it isn't in .Net and it won't be open source. As Robert Harvey mentioned, this is not a simple task at all, as it basically involves writing your own software synthesizer (a task after my own heart).