MIDI Player

Play MIDI files in Snap!

https://snap.berkeley.edu/snap/snap.html#present:Username=joecooldoo&ProjectName=MIDI%20Player

What it supports:

  • Single-track MIDIs
  • Multi-track MIDIs

What it doesn't support:

  • Multiple instruments

@glenbull, add something like this to the Tunescope library, please!

I can probably add multiple instruments... with my tunescope mod... oh, and also, there's a lot more stuff that your project doesn't support, like volume.

This is fantastic! Yes .... definitely needs to be added to the library.

We have a weekly TuneScope meeting each Mon morning, and this will be at the top of our list of things to discuss.

This summer we will have more time to work on enhancements and refinements. There's a long list of enhancements that need to be explored when we have time.

If you want, I have many things that I think would improve the tunescope library a lot, so if you want to hear it, I'll gladly tell you.

We're only a few weeks away from the end of the semester. As soon as we finish our classes and turn our grades in, we're eager to hear your ideas and suggestions. We know that you have some great ideas.

How can I remove the drum track (channel 10)?

I think you can remove the track in the tracks item in the midi result.

this is super cool!! although there seems to be some peculiarities with the midi files i've been feeding into it, because the rhythm isn't correct when played through this.

Yeah, I'm not sure what's causing it. Try running it with turbo mode. Sometimes the FOR EACH block is too slow, and the MIDI track catches up with the FOR EACH block causing occasional breaks in the music.

That didn't fix my issues with the midi of bob-omb battlefield that I have.
https://snap.berkeley.edu/snap/snap.html#present:Username=ego-lay_atman-bay&ProjectName=MIDI%20Player%20-%20Bob-omb%20Battlefield

Yeah, I'd have to take a deeper look at the MIDI that gets outputted by Tunescope.

It can also be lag; the project depends on the timer block, and checking for it in several processes might create lag.

Looking at the javascript, it looks like it just uses Tone.js midi importing, so I'd look into that.

Maybe it's not lag; look at this screenshot:
image
This is with your MIDI file playing.
It might be the blocks loading in sounds creating delays, the memory for the webpage goes up significantly when I start the MIDI.

It seems that it's probably the loading of the MIDI; when I play with the PLAY NOTE block that comes with Snap (it's fast), it still has those weird breaks in the song.

probably, actually, I think it's probably just waiting for the timer to be greater or equal to the time (well, just the wait block in general).

Harsh, the lead TuneScope developer, has been in Toronto for a CS conference, but now that he is back, I'll ask him to take a look.

Thanks!

@joecooldoo This looks awesome. I think you're digging into one of the biggest problems we had when we were developing TuneScope.

Multiple tracks, when played together using a launch block, have a tendency to drift in and out of synch with one another due to latency in the calls to the WebAudio API. This can create numerous problems, including pauses at unexpected times, irregular note lengths, and other issues you may be encountering. We got around this by creating the Play Tracks block. When multiple tracks are played in the Play Tracks block, TuneScope checks the time signature to see how many beats should be in a measure. It then plays all tracks and pauses at the end of the measure until the slowest track has caught up. In then repeats the process for each subsequent measure. This keeps the tracks in synch with one another.

Here's an example of the Play Track block in use:

https://snap.berkeley.edu/snap/snap.html#present:Username=maketolearn&ProjectName=Rainbow%20(Ver%203.2)

Also, I highly recommend checking out the TuneScope Reference Manual at the following link:

https://maketolearn.org/music/

Also on that page are chapters from a book that will walk you through the process of building a song from the ground up using TuneScope blocks.