Why didn’t this MIDI file import properly?

Sheet music showing articulations and partial bars.

Because MIDI is an audio format, and does not store notation.

Reverse engineering

Suppose you have a video of someone playing piano.

If the video is good enough to should every key being pressed, could you reconstruct the sheet music?

While you can certainly notate something internally consistent, it may not match what the musicians started with.

  1. Piano keys are ambiguous.  Does the black key between G and A represent G♯ or A♭?
  2. Rhythms are ambiguous.  Are they playing crotchets ((Crotchet = quarter note.  Quaver = eighth note.  See Wikipedia – Note value for other translations.)) in 4/4 or quavers in 2/4?
  3. Dynamics are relative.  A crescendo is obvious, but has it gone from from mf to f, or pp to ff?
  4. Structural elements (repeats, dal segnos, codas) may be represented in different ways, or written out in full.

If we know enough music theory, we can infer the probable answers to questions like this.

  1. The combination of other keys pressed can tell us if the piece (or current section) is in a specific key.
  2. Stylistic elements may tell is what the specific beat is.  Viennese Waltz?  It’s 3/4.  The exact same notes played as an Irish Jig?  It’s 6/8.
  3. Given volumes for the entire piece, we can assign dynamics to the loudest and softest moments, and interpolate the rest.
  4. If any sections are repeated, choose the representation that minimises the number of pages, as long as it doesn’t jump around so much that it becomes unreadable.

When a notation editor imports a MIDI file, it must make choices like these.

What is MIDI, anyway?

MIDI stands for Musical Instrument Digital Interface.  This may seem odd, since the MIDI file on your computer isn’t interfacing with any instruments.  However, the name was originally accurate: it was a way for different electronic musical instruments to communicate.  You could connect a keyboard with MIDI output to a synthesizer with MIDI input.  Pressing keys on the keyboard would send MIDI events to the synthesizer, telling it which notes to play.

What if you want to store your performance?  You could just record the audio output from the synthesizer, but it would be much more compact to store the sequence of events from the keyboard to the synthesizer.  This became a standard of its own: the SMF (Standard MIDI File) ((MIDI Manufactorers Association – MIDI Files)).  These files usually have a .mid extension ((What is a file extension?  Why does it matter?)).

So, the MIDI file we are trying to import contains MIDI events (such as which key was pressed on a keyboard) and time-stamps (when that key was pressed).

What does this look like?

Let’s start with a dance set that changes both rhythm and key.  For the source files, go to The LYCO Sheet Music Archive – Haymaker’s Jig Set.  We will export from Sibelius 7.1.3 to MIDI, then back to Sibelius.

Sheet music showing articulations and partial bars.

Sheet music before exporting from Sibelius to MIDI file

All nicely formatted, and then…

Sheet music showing no articulations and partial changes of key.

Sheet music after importing from MIDI file to Sibelius

What went wrong?

The exact changes you see will vary between applications, and even versions of the same application. Sibelius is used here as an example, but it is not specifically good or bad at MIDI import or export.

Clefs

The very first symbol in the music changed from treble clef to alto.  Some combination of instrument name, synthesizer number ((While the General MIDI format has 128 named instruments, Sibelius did not export the “Violin melody” part using instrument 40 (“Violin”).  Instead, it used instrument 48 (“String Ensemble 1”), which has better tone on most synthesizers.)) and range turned this instrument into a viola.

Time signatures

Partial bars have received a separate time signature.  For some reason the first full line incorrectly became 3/4 time, while the following lines turn into 6/8.

Tempo

MIDI stores tempo and time stamps in a way that causes rounding problems.  When converted back into beats per minute, there are slight changes – which are displayed her to 6 significant figures.

Key signatures

The imported piece correctly starts with D major, but turns the single C♮ into an accidental.  This is fairly common: pieces with key changes will be imported with the correct starting key, but acquire accidentals towards the end.

Articulations

Staccato symbols on the original piece have become notes followed by rests.  Slurs and bowing symbols disappeared.

Repeats

Repeats, including first and second time bars, have been written out in full.

Text

Most text – the subtitle, movement titles and chord symbols – disappeared.  The piece title survived, but the apostrophe was not an ASCII character, and became corrupted.

What if the MIDI file I’m trying to import looks even worse, with no obvious rhythm?

If your MIDI file was recorded “live” by a pianist without specifying the tempo they were recording at, notes may appear apparently at random.  You will need to tell your notation program to quantise it.  This tells it to make a further attempt at rounding notes to a sensible positition.

Can I do anything to help?

When you import a MIDI file, you may be asked to choose import settings.  Choose these to match what you know about the piece, and it will be easier to clean up.  For example, if you know there are no triplets, don’t let it turn rhythmically ambiguous passages into triplets.

MIDI import settings for rhythms and tuplets

Sibelius MIDI import settings

If any sheet music exists, obtain it.  Even if you can only find a low-resolution scan on the IMSLP/Petrucci Music Library, or grab a picture of the start of the score on your phone, it will help you resolve ambiguous cases like this.

Tidying up the MIDI file is still often the fastest way to get music into your preferred notation program, but you can make it easier and faster if you understand the features and limitations of the format.

Leave a Reply

Your e-mail address will not be published or shared with third parties.

First comments from new name/e-mail combinations will be held in moderation.