A midi file interpreter, written in just over 1000 lines of MIPS assembly.
Because Mars has a syscall to play midi notes, I figured it would be interesting to create a midi file interpreter in assembly that implements most1 of the midi file specification.
These resources proved immensely useful in my implementation:
Warning
The sound quality is not good in the slightest. I unfortunately can't do anything about this since I am limited to the midi player MIPS uses internally.
There are many pops and crackles, and the instruments are poor quality. This is especially noticable in the videos below.
Nonetheless, I think it sounds pretty good for the limitations it has.
Video Demos (turn on sound)
mario.mp4
pirates.mp4
-
Clone this repository.
-
Download the Mars Mips simulator.
-
Edit
main.asm
in your editor of choice and changeFilename
to a path to a midi file, relative to the root directory.
- FileName: .asciiz "./examples/mario.mid"
+ FileName: .asciiz "./path/to/file.mid"
-
Open Mars in the directory you cloned the repository into.
-
Make sure these settings are turned on.
-
Open
src/main.asm
usingFile > Open
. -
Run the program using the run button at the top of the screen.
Footnotes
-
Currently only format 1 files are supported, but in the future format 0 will also be supported. ↩