So late!
Why now? The persistent and frustrating Unity issue with looping inside a sample from a web build has finally been resolved by Unity. https://issuetracker.unity3d.com/issues/webgl-a-looping-audio-sounds-different-on-webgl-than-in-the-editor-slash-native-desktop-player
MPTK build has been tested with Unity 6 and Unity 2022.3 with MPTK version 2.16.0
Working mode and Historics
When webGL build is selected in the editor, some changes are applied to MPTK version 2.16:
- Core mode is set to false: each couple note / instrument are played in a dedicated AudioSource.
- Coroutines are used for MIDI sequencer (threads are not allowed with webGL, perhaps one day …).
The MPTK non core mode was the legacy mode for playing generated samples. The initial version released in 2018 achieved significant success, despite sound quality was suboptimal. So, I have decided to build a real synth process based on the OnAudioFilterRead callback.
With core mode enabled, one AudioSource is able to play all samples (so, for each note-on) with a very low latency and an excellent stable timing. Also, there is only one AudioSource for each MIDI Synth (MidiFilePlayer, MisiStreamPlayer, …).
The legacy mode was notified as deprecated and to be removed in a future major version. Unfortunately, callback OnAudioFilterRead with AudioSource is not implemented for web. Therefore, non core mode is mandatory for webGL build … and finally this mode will be retained with next MPTK versions and named Legacy Mode!
Limitations
- Coroutine for MIDI sequencer is not perfect for very precise tempo.
- Sound effects real-time modification by the MPTK API when playing is unavailable (but there is a solution, perhaps for a future version).
- The sound quality is inferior to other platforms such as macOS, iOS Windows, and Android. Look above Working Mode chapter to understand why..
- Audio Spatializer plugins like Steam Audio seems not implemented, so prefab MidiSpatializer will not work.
- Real-time loading soundfont from the web is not working (not yet compliant with legacy mode) but switching on local soundfont do the job.
- The plugins MidiKeyboard is not available for WebGL build. Some tests in progress with this Unity package …
Good points
- The interactivity between your gameplay and the music works well. This is one of Maestro MPTK’s strengths: influencing the music by script (or the inverse!) according to the scenarios you have imagined.
- Spatialization based on distance between MPTK Prefab and Listener is working.
- Real-time loading soundfont from local soundfont is working.
- SoundFont effects by the MPTK API is working but not dynamic change.
- Low latency on user action!
- Compatible with the Free MPTK! If you publish a web app, I’d be happy if you could give credit to MPTK somewhere in your app.
Quick how-to from a newer project
- Create a fresh project with Unity version >= 2022.3
- Import Maestro MPTK Pro or Free version >= 2.16.0
- Switch to WebGL build (Build settings) if not already done.
- From the menu Maestro / SoundFont setup,
- import a SoundFont,
- extract samples with default choices “Compressed In Memory” and “PCM”
- Select the project you want to build (try with MPTK demos like TestMidiFilePlayerScript).
- Build and run your project. When the webpage pop up, your project will be loaded and run. A first user action is requested to activate the sound in the web page.
Tip: If you want to build for another platform, switch back to ‘Windows, Mac, Linux platform’. Unfortunately, all audio files will be converted by Unity to be compliant, and that takes time — but the conversion will run only once per platform.
Want to test?
The demo scene (Demo/Builder/ScenesDemonstration) has been build for webGL and deployed on itch.io
See here: Unity MIDI Player Tool Kit on WebGL
This demo contains all the scenes available with the Pro version

Next Step
- Improve Legacy mode with your input.
- A full game with music as a key role. I have the ideas – therefore, now to be transformed in the real world, summer will be hot!
Mega Bundle
2 comments on “WebGL build with Maestro MPTK”
Free Nano Banana
25.9.2025 at 10:34这篇文章详细介绍了Unity MIDI Player Tool Kit(MPTK)在WebGL平台上的应用和改进。作者清晰地解释了新旧模式的区别,特别是核心模式和非核心模式在性能和功能上的差异。对于WebGL开发者来说,非核心模式的保留是一个重要的更新,尽管它在实时加载音色和音效修改方面存在一些限制。不过,文章也强调了MPTK在交互性和空间化处理方面的优势,这对于游戏开发非常有吸引力。总体来说,虽然WebGL版本有些遗憾,但MPTK仍然是一个强大的工具,值得尝试。期待未来版本的改进!
admin
25.9.2025 at 17:56Thank for this analysis.
A demo build as a game for web is in progress. It is based on the free MPTK and available on git.
A translate of your kind article in english and french.
This article details the application and improvements of the Unity MIDI Player Tool Kit (MPTK) on the WebGL platform. The authors clearly explain the difference between the old and new modes, especially the difference in performance and functionality between the core and non-core modes. For WebGL developers, the retention of non-core patterns is an important update, although it has some limitations in loading sound and sound modification in real time. However, the article also highlights the advantages of MPTK in terms of interactivity and spatial processing, which is very attractive for game development. Overall, while the WebGL version has some regrets, MPTK is still a powerful tool and worth trying. Looking forward to future improvements!
Cet article détaille l’application et les améliorations du kit d’outils de lecteur MIDI Unity (MPTK) sur la plateforme WebGL. Les auteurs expliquent clairement la différence entre les anciens et les nouveaux modes, en particulier la différence de performance et de fonctionnalité entre les modes de base et les modes de non-critères. Pour les développeurs de WebGL, la rétention des modèles non-cores est une mise à jour importante, bien qu’elle ait certaines limites dans le chargement de la modification sonore et sonore en temps réel. Cependant, l’article souligne également les avantages de MPTK en termes d’interactivité et de traitement spatial, ce qui est très intéressant pour le développement du jeu. Dans l’ensemble, alors que la version WebGL a quelques regrets, MPTK est toujours un outil puissant et vaut la peine d’être essayé. Attendre avec intérêt les améliorations futures