You can’t. At least not without a lot of work.
The idea is seductive: it’s easy to convert MIDI to sheet music, so if it were possible to extract a MIDI file from an MP3, then you would have easy access to the sheet music of your favorite songs.
The problem is this: An MP3 — or WAV or any other type of audio file — is like an apple pie. It’s easy to make apple pie from apples: you cut them up and put them into the pie. But it’s impossible to get back the original apples once you have the pie!
In a recording all the instruments are mashed together and it’s nearly impossible to get back the separate tracks.
Even if you have the separate instrument parts — for example in a solo piano recording — then it’s still incredibly hard to identify the notes being played.
Most instruments, like the piano, have a very complex sound. Each note is made up from the fundamental frequency (the pitch) and several harmonics. Each of these harmonics is also a frequency.
Now, it is pretty straighforward to compute the frequencies that are used at a particular point in the recording.
The tricky part is determining what each of these frequencies represents: a fundamental (i.e. a real note), a harmonic (not a unique note), or background noise.
That being said, there are programs that can take a recording and turn it into a MIDI file. However, because of the difficulties described above, you can expect to do a lot of cleanup on the generated file.
My favorite is AmazingMIDI, a free program that can come pretty close depending on the quality of the material that you feed it.
Another option is to transcribe the recording by hand, something I actually recommend because it helps to train your ear, and having a good ear is important for a musician. Transcribing is a very time-consuming process, though.
There is an awesome, and inexpensive, program called Transcribe! that can slow down recordings so they are easier to follow, can transpose them to different keys, and has a frequency analyzer that attempts to recognize the notes in the recording.
Read more articles on Piano Clues: