It seems like converting MIDI into sound should be simple enough: record all possible notes, and then just superimpose the individual sounds according to the MIDI data (offsets, duration and volume), and compress the result into MP3 or send it to the sound card.

Yet, the MIDI synthesizers I tried (timidity on Ubuntu, and a few others I don't recall) sound distorted and overall much worse than MP3 recordings of actual musicians.

Why is that?

Update: I just tried Fluid Synth on Ubuntu, which uses about 100MB worth of "sound fonts", compressed. It seems to be vastly better, but still rather bad.

  • Sound cards don't usually decode MP3. MP3 is decoded into PCM before being sent to the sound card, and software synths just go right to PCM (or samplers just read from PCM files). – Todd Wilcox May 25 '15 at 7:27
  • 2
    I think you're vastly over-simplifying. One off-the-shelf midi file played on another off-the-shelf sample set has little hope of matching the nuance even an unskilled creator could make using the same source for both creation & playback. – Tetsujin May 25 '15 at 7:27
  • 1
    Check out professional MIDI software, like trillian bass, Steven Slate Drums or Vienna Symphonic Library. – el.pescado May 25 '15 at 19:27
  • 2
    The software instruments you tried aren't in the appropriate weight class. A decent "sound font" for a single instrument generally takes up a DVD or a dozen DVDs, and costs comparably to a decent physical instrument. – Peteris May 26 '15 at 12:14

MIDI is only a specification for what instrument (patch) to use, what notes to play, how long and loud to play a note and other things like tempo, time signature and text lyrics. The concept is very similar to how an old player piano works. The midi data is like the piano roll, the sound you hear is from the physical sound produced when the hammers strike the strings. Likewise, the way music sounds when played via the MIDI specification is up to the quality of the patch sounds. Its possible to even hook up a MIDI connection to a machine that played physical acoustic instruments and that could sound great. Likewise I could give you a set of my singing for every instrument patch and it would sound awful. It all depends on the patch set you have or the instrument that you've hooked up the MIDI sequencer or controller too.

An example of how the sound quality can be different is back in the 90s there was a game called Doom II which used MIDI files for the music. Depending on what sound card you had the game would sound better or worse because of the quality of the instrument patches that your sound card included. It was even possible to hook up MIDI cables from your computer to an external synthesizer and use the sound synthesis there. One time we hooked it up to a Kurzweil K2000 and it was kinda like having a live band playing the Doom II music for you while playing the game.

As a protocol and file format, MIDI has been surprisingly adept and has required little revision over the last 30+ years. Although in the beginning of 2015 the MIDI Manufacturers Association announced that there is a new MIDI "HD Protocol" under development.

| improve this answer | |
  • 1
    There is a Wurlitzer organ in Phoenix (in a pizza place of all things) that does exactly what you describe; a complex software/hardware MIDI-based system controls not only the several dozen actual organ stops the thing has, but an additional complement of instruments from pianos and xylophones to various woodwinds and brass and even a couple guitars. – KeithS May 27 '15 at 15:43
  • 2
    However, the MIDI standard is under review; the idea is first to increase resolution of various continuous controls like velocity and modulation, and second to standardize some uses of MIDI for software control, such as HUI, which currently use a more or less proprietary combination of NRPNs. All this, while maintaining backward compatibility with the 30+ years of gear and software designed to use MIDI "1.0". – KeithS May 27 '15 at 15:46
  • 1
    This might also be of interest. I made a video for climagic a couple years ago that demonstrates how compact the MIDI file format can be: youtube.com/watch?v=zRF1S-8P6_k I was able to fit a short MIDI file and its decoder into a 140 character tweet. – deltaray May 27 '15 at 15:58
  • “MIDI has been surprisingly adept and has required little revision over the last 30+ years” welll... I'd put it less flatteringly: people have developed ever more workarounds to compensate for the inadeptnesses of MIDI, because nobody could be bothered to implement a proper replacement standard. – leftaroundabout Aug 6 '15 at 18:43

MIDI is not sound. The MIDI specification does not dictate what any instrument sounds like, it's up to the synthesizer to generate the sound. Free synths sound like crap, but good ones can sound as good as the creators can make them. For example, the Pirates of the Caribbean soundtrack is entirely synthesized, yet most people don't even realize it.

| improve this answer | |
  • 3
    “MIDI is not sound.” – indeed, and that's really the whole answer to the question. — I don't quite agree with how you contrast free/bad synths with good ones – truth is, some of the more expensive ones make it more feasible to achieve results close to a human performance on a real instrument; but ultimately the quality depends a lot on how well the arranger knows the particular synth. Professional synth-only productions are usually not just MIDI, at least not in the traditional GM sense: there's a lot of dynamic tweaking of all the parameters required. – leftaroundabout May 25 '15 at 16:15
  • (And FWIW, I don't think the final soundtrack of Pirates of the Carribean is entirely synthesized (though Zimmer apparently rendered a full-synth preview); at least some of the less bombastic passages are played on real instruments.) – leftaroundabout May 25 '15 at 16:18
  • Indeed - there are MIDI controllers with many sources of modulation modeled after real instruments, so players can impart all kinds of expression that is then translated into computer code. With even a very modest synth this can result in totally unique and ultimately expressive music. It's all in how you use it. A typical MIDI file from the internet contains nothing but note values and durations, whereas there's a LOT more information than that in most music performances. – Darren Ringer May 26 '15 at 1:52
  • *In theory there's no reason you couldn't translate every single bit of information from a music performance into MIDI if you had working models of the acoustics and sound generators. – Darren Ringer May 26 '15 at 1:53
  • 1
    According to Wikipedia there were real musicians (mixed with sequenced sounds) for the first Pirates soundtrack, at least. – Meaningful Username May 26 '15 at 7:47

MIDI is just a stream of instructions, like:

  • "Tell channel 1 to turn on note 60"
  • "Tell channel 2 to turn off note 72"
  • "Tell channel 3 to set parameter 1 to value 231"

There is a set of conventions such as:

  • Channel 1 is piano, 34 is electric bass, etc.
  • Parameter 1 is modulation, 7 is volume, 64 is sustain, etc.

This is called General MIDI (Wikipedia).

General MIDI was specified later than MIDI itself. Users of MIDI are free to use any instrument on channel 1. You don't even have to control an instrument -- MIDI can be used to control lights, or anything else.

If you get a MIDI file from the internet, it's likely to be written for GM, but sometimes it's not.

Imagine the simplest case of a MIDI file - a recording of one person playing a piano part on a keyboard. It's a bit like getting a robot to exactly mimic the movements of a pianist, then putting the robot at the keyboard of a different instrument.

If the robot is at a good piano, it'll probably sound good. This piano might not have exactly the same response of key velocity to volume, so expression will sound subtly different. But it'll sound pretty good.

If you sit the robot at a toy keyboard, it's likely to sound awful. A good musician could probably coax a decent sound out of that toy keyboard. But here the musician has "played" a nice instrument and had their input moved to a different instrument, so they can't take account of its limitations.

Then there's all the other parameters. What effect does "modulation 127" have on the sound? How much does "100 pitch bend" change the pitch? Even when GM specifies these, not all implementations get it right.

Then multiply it by a number of instruments, and take into account that if you were mastering your own piece of music you'd be tweaking aspects that GM doesn't specify, and it becomes obvious why MIDI playback can sound terrible.

A high quality "sound font" -- the set of things that translate events into sounds -- can improve matters, but even then you don't reach the standards of a full professional recording.

Many electronica records are made entirely from MIDI sequenced instruments -- but the musicians are also carefully configuring their instruments and effects to get the sound they want.

There is great fun to be had sending MIDI files to the built-in sounds of the cheapest sound card you can find, and playing "guess the tune". Or swapping instruments around.

| improve this answer | |

It seems like converting MIDI into sound should be simple enough record all possible notes, and then just superimpose the individual sounds according to the MIDI data (offsets, duration and volume), and compress the > result into MP3 or send it to the sound card.

And this kind of thinking (the wrong kind, that is) gives you exactly the results you hear.

First and foremost, you have two main problems here.

a. Crappy sound chains.

b. Crappy sequences

Let's see why.

  1. On instruments other than piano, no two notes sound alike. Say, guitar. There are a million ways to change the sound of a note on a guitar. Choose between pick, fingers, fingerpicks and you have different sounds. Choose where to fret the same note and you have different sounds. - or registers.

  2. Electric instruments and effects in widespread use in music production are often nonlinear. If you input two notes into an overdriven guitar amp, the ouput will not be the sum of the single notes. Even good old acoustic pianos have so-called sympathetic resonance.

You address this with a good ad hoc instrument+effect chain, solving problem a - but timidity doesn't even qualify.

I'm saying ad hoc because to play Limp Bizkit you need a different setup than you need to play gospel, in real life and on the computer too. You need to chain the right effects, the right samples, etc. You don't want to play back your Limp Bizkit thrashing midi part with a piccolo snare sample, do you? If you want to do it properly, you also want your virtual instruments to be able to interpret articulation data (picking position, etc), usually fed via CC. This is very tricky. So tricky that in fact people just prefer to record a real guitar.

  1. Articulation and expression. Even on something comparatively non-tricky like a piano, a real pianist does not play in a robotic fashion like a badly programmed sequencer where every note is exactly 1/8th, 1/16th and glissandos or "bendings" are perfectly linear.

  2. The folks who make the midifiles you can find on the Internet are usually pretty lazy and provide you with poor transcriptions to boot, where even trivial articulation is omitted.

If you just take the output from a sequencer the performance will sound robotic and devoid of expression, unsurprisingly, even if you get articulation and ornamentation right. But if you record the notes played by a real player with, say a MIDI keyboard and a MIDI guitar, the results will be very different.

This takes care of b.

And now I'm dropping the bomb, friend.

Most of what you hear on the radio these days is MIDI.

Recording and editing equipment does use MIDI and most backing tracks are either sequenced or recorded via MIDI. Even the autotune for vocal track probably is driven by MIDI events.

And if you go to a live concert they probably use MIDI timecode and events to drive the light show and the effect chain on the guitarist's pedalboard.

Thing is, Celine Dion does not use timidity for her backing tracks and her producers spend some time on the sequences.

| improve this answer | |

The free sound fonts typically installed with Timidity are of very mixed quality. Routing playback through some vintage Midi expander of good quality will greatly improve results, routing it through some reasonably current good quality offering will give some more improvements at much more portable hardware size. Naturally, the analog paths involved here will decrease quality again.

You can improve Timidity's action somewhat by working with other sound fonts and adjusting its parameters, but it does not really compare.

There may be some commercial software MIDI expanders doing a good job but their expected useful life time is a lot less than hardware expanders (hardware expanders are likely to continue running in 20 years, software expanders not unless you keep some hardware+OS around with them) and there is a lot of variation regarding pricing and quality. And they will not likely run on GNU/Linux, and may get on your nerves with DRM/licensing schemes.

Feeding a good MIDI expander with good MIDI data will actually produce sound that's rather useful for a number of purposes (partly depending on what the MIDI expander specializes in). Some instruments with continuous and "analog" controls like solo strings are pretty hard to do convincingly particularly when not using continuous MIDI controllers (analog pedals, MIDI accordion or wind instrument with pressure sensor etc): string sections work better in that regard.

| improve this answer | |

there are 2 possible problems here.

1) The midi file is created straight from sheet music. every note starts at exactly the right time and lasts the exact duration and all the note velocities are 100. That makes for a song with absolutely no feel. If you have a musician play the song with expressive velocities, tempo variations, arrangement improvements then it'll sound much much better.

2) The synth you're using may be lame. Timidity uses soundfonts I think. That's a pretty old tech where the sample rate is not always CD quality, the samples are short loops, and not very many samples per instrument. Modern softsynths usually have a ton of overlapping samples per instrument.

Regardless, if you're a musician, that might be the only sheet music you'll find of your favorite pop song. I find those things invaluable.

| improve this answer | |

MIDI-based music will be as good as its designer. It's not that MIDI-based music sound quality is inherently bad; the final results depend on whoever designed the MIDI, and whoever is using it. In other words, if it sounds bad it is because of the people involved with it. Even if you didn't design it and you are just using it you are responsible of its output quality since you are deciding which device with which settings will be used.

There's two distinct areas in MIDI music design:

  1. The MIDI file. If it was captured the quality will depend on the performer. If it was programmed the quality will depend on the designer/programmer. There's no sound involved here (yet), so you can think of this step as the quality of the carving of the instructions that will later be interpreted by a device that understands MIDI.

  2. The sound design. Now the instructions need to be interpreted by something like a sampler, a drum machine, a synth. The quality here depends in both the device you are using and your skills as a sound designer.

If you don't like the output then something went wrong in these steps.

You don't give much details, so it's hard to know for sure what's wrong in your case. I'm not familiar with Timidity, but if it's a synth (subtractive, FM, etc) you are the one programming it, so the quality of the output is a reflection of your skill. If Timidity is a sampler, maybe the samples are low quality. Maybe the distortion comes from clipping, it can be many things.

There shouldn't be distortion, so try using a good quality synth and/or a good quality sampler with good quality samples.

| improve this answer | |

They sound 'bad' because they are not naturally created sounds. They are not the sounds of acoustic instruments, which have a much wider array of characteristics as compared to just some particular frequencies sounding for a particular time.

| improve this answer | |
  • 2
    Wrong and easily falsifiable. Also, the only "naturally created sounds" out there is birdsong, Mother Nature doesn't make pipe organs. – Some Dude On The Interwebs Jun 24 '15 at 15:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.