通过网络在客户端上播放 MIDI?
我阅读了 这篇 文章,其中解释了如何播放 MIDI。 我需要制作一个根据用户需求播放 MIDI 序列的 Web 应用程序。 如何做到这一点?我应该简单地制作一个播放 MIDI 文件的 Silverlight 播放器吗?那么如何将文件传输到播放器呢?或者,也许有一种方法可以与客户端的 MIDI 系统进行交互。
注意:我需要创建 MIDI 序列,我的服务器还没有准备好文件(或者应该先创建它们)。
任何方法都将受到欢迎。
I read this post, which explains how to play MIDI.
I need to make a web-application that plays MIDI sequnces on users demand.
How to do this? Should I simply make a Silverlight player that plays a MIDI file? So how do I transfer the file to the player? Or else, maybe there is a way to interact with the client's MIDI system.
NOTE: I need to create the MIDI sequences, it's not ready files from my server (or they should be created first).
Any approaches will be welcommed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,应该非常清楚的是,MIDI 文件本身的“播放”方式与 MP3 不同。 MIDI 文件中没有实际的音乐;相反,它们只包含应该由合成乐器演奏的音符。
我不确定 silverlight 是否有内置的 MIDI 合成器(就像 QuickTime 那样,如果您将 MIDI 文件拖到它上面),以及一些快速谷歌搜索 似乎证实了这一假设。
因此,如果您要对任意 MIDI 数据进行排序,并且无法首先将其弹回 MP3,那么您应该在服务器端生成声音。如果您有权访问 .NET 后端服务器,则可以使用 VST.NET 框架 创建一个VST 主机,通过乐器发送 MIDI,并将生成的音频输出压缩为 MP3。如果您使用 Java,则可以使用 jVSTwRapper,一个类似的库。
在最坏的情况下,您可以将某些内容与 C/C++ 粘合在一起来加载 VST 插件来处理您的声音。然后,无论您使用什么服务器技术,都可以将其作为外部进程启动。
但在所有这些方法中,策略基本相同:
请注意,第 3 步可能是此过程中最难的一步。互联网上有很多关于 如何制作自己的 VST 主机,包括我写的那个。 ;)
First, it should be made perfectly clear that MIDI files are not themselves "played" in the same manner as an MP3. There is no actual music in a MIDI file; instead they just contain the notes which should be played by a synthesized music instrument.
I'm not sure if silverlight has a built-in MIDI synthesizer (like QuickTime does if you drag a MIDI file on top of it), and a bit of quick googling seems to confirm this hypothesis.
So if you are going to sequence arbitrary MIDI data, and do not have the ability to first bounce it down to MP3, then you should generate the sound on the server-side. If you have access to a .NET backend server, then you could use the VST.NET framework to create a VST host, send the MIDI through an instrument, and compress the resulting audio output to MP3. If you are working with Java, then you can use the jVSTwRapper, a similar library.
In the worst case, you can glue something together with C/C++ to load the VST plugin which will process your sound. This could then be launched as an external process by whatever server technology you are using.
But in all of these approaches, the strategy is basically the same:
Note that step 3 is probably the hardest one in this process. There are lots of guides out on the internet about how to make your own VST host, including that one which I wrote. ;)