Generate live MIDI from Javascript [closed]

匆匆过客 提交于 2019-12-04 02:10:31

See the music embedding portion of this blog post by John Resig. (For some reason, the Mario game that Resig links to plays sound for me in Firefox but not Chrome or Safari; it'd be worth investigating why).

The idea is that you use a data URI to embed a base64 encoded version of your data within the HTML file itself. So you could write Javascript to continuously generate data in the MIDI format, then encode it in base64, and then inject it into an HTML5 <audio> element

I believe your best option at the moment is to communicate from your HTML application via an xhr or websockets to a backend system running on your server that can do the actual translation into midi events. You might find that one of the many comet servers that are already available can make this part of your life easier, however many midi applications require relatively low latency, and you'll struggle to get comet techniques down much below 100ms.

if html5 is an option, you could try to generate osc events using websockets and convert them to midi signals using a server proxy.

What i don't know is if the timers in javascript are stable enough for generating accurate timings.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!