surikov / webaudiofont

Use full GM set of musical instruments to play MIDI and single sounds or effects. Support for reverberation and equaliser. No plugins, no Flash. Pure HTML5 implementation compatible with desktop and mobile browser. See live examples.
https://surikov.github.io/webaudiofont/
GNU General Public License v3.0
891 stars 92 forks source link

Allow offline midi playback, cache js files in indexed DB #60

Closed alextekartik closed 4 years ago

alextekartik commented 4 years ago

Hi and thanks for the project. I have not played a lot with it but I have been impressed to see that it works well on mobile (iOS and Android).

I'm interested in writing a dart wrapper to allow playing midi files in Flutter Web application.

My main target is basic playback of midi files. I'm not sure my question is relevant yet so sorry if my understanding is wrong.

It seems (looking to the midi player exampler) that all instruments are loaded by adding javascript script by WebAudioFontLoader.

Since I would like my web app to work offline, I would like to be able to cache the instrument scripts in indexedDB (this would require CORS access to the js file but let's assume that this work or could be solved). I'd like to know if it is possible to load an instrument in a different way (for example by allowing loading an instrument with a raw javascript content string) or if it would better make sense to a write a new loader since your architecture looks very clean.

Thanks!

surikov commented 4 years ago

WebAufioFont is a library for the Web Audio API. Flutter does not support the Web Audio API. Use Cordova for multi-platform music applications. See an example for Android https://play.google.com/store/apps/details?id=surikov.riffshareii CORS issue does not affect WebAufioFont. You can download sampled instruments from the project host, you can use them locally, you can embed them in code.