Play Midi File from URL

Thank you very much, that was exactly what I was looking for.

What I did in addition to the above steps now (in case someone else is interested in this thread in the future and a javascript+Anvil newbie like me):

I added the following under Native Libraries:

<script src="https://cdn.jsdelivr.net/npm/web-midi-player@latest/index.js"></script>

<script>
const { 'web-midi-player': { default: MidiPlayer } } = window;
</script>

<!-- Audio playing -->
<script>
function PlaySound(url) {
  		  const midiPlayer = new MidiPlayer();
		  midiPlayer.play({ url: url });
      } 
</script>

From the client code, I can now access this with

self.call_js('PlaySound', audio_file.url)

Thank you, hope this helps someone else in the future :slight_smile:

2 Likes