MIDI sounds drunk in html5

Is there a FMOD MIDI html5 demo/example anywhere that shows this working?

My game Dink Smallwood (open source at svn://rtsoft.com/rtsvn/projects/RTDink ) uses FMOD and it runs fine on Win/Mac/iOS/Android, but the html5 version plays notes out of tune.

I’m using the latest HTML5 FMOD studio (1.10.05) (low level lib)

I’ve tried a few different dls instrument packs, but they all play with incorrect pitches and sound out of tune.

If you want to hear it, click https://rtsoft.com/web/dink then click “New”. (the title music is an mp3 so that won’t show any issue, but after clicking new, a MIDI is used, it will sound weird/bad on firefox/chrome/etc)

I’ve tried with various setDSPBufferSize/voices, but this doesn’t seem related to performance, more like … mixing buffers using wrong sample rate for midi notes or something.

http://www.fmod.org/public/js/ doesn’t appear to have a MIDI example

Sorry, I can’t figure out how to add tags to this message. Maybe my many ad blockers are doing something.

Hi Seth,
Looks like we’ve run afoul of precision issues in emscripten. I found this https://groups.google.com/forum/#!topic/emscripten-discuss/JqopAJKSaFo which funnily enough even mentions the same midi pitch function that has gone wrong in FMOD.

I’ve worked around the issue, ive put a fix in for the next release.

1 Like

Excellent, will be eagerly waiting for the next build!

Edit: Adding -s PRECISE_F32=2 to my emscripten build script did correct it for now - although I believe this has some performance implications so I’ll remove this flag after the updated build that doesn’t require this is ready

I’ve updated the fmod.org/public/js example folder with a new build.

Check http://www.fmod.org/public/js/load_from_memory.html - I have added a dls so it can load midi files.