Just playing with a MIDI reader: https://github.com/grimmdude/MidiPlayerJS that triggers events that D3 uses to draw an SVG.
A better option would be using d3 to trigger the events too (it would be cleaner).
The “song” score is taken from this page: http://www0.cpdl.org/wiki/index.php/Jesu,_meine_Freude,_BWV_227_(Johann_Sebastian_Bach) and converted to MIDI with MuseScore.