How is MIDI used with a keyboard? I have a roland d-20, and I've heard that it connects with MIDI through USB. But what exactly is MIDI? How does it differ from a microphone input?
You will need some sort of MIDI connection on your computer. I'm not sure which MIDI interfaces are available for the Mac, but For the PC most every sound card has a MIDI connection. Usually the joystick port doubles as a MIDI interface and requires an adapter cable.
You will then need to plug one MIDI cable from the MIDI Out on your keyboard to the MIDI In on your computer, and another from the MIDI In on your keyboard to the MIDI Out on your computer.
Now that your computer is hooked up to the keyboard, you need software on your computer to talk to the keyboard via MIDI. On the Mac you can use Garage Band. Reaper is an inexpensive program which works on Mac or PC.
Using the software, you will be able to record and play back music from the keyboard. The software also should allow you to send information to the keyboard including sounds and other system data (see the D-20 manual volume 2 chapter 5).
Friend of George answered perfectly, and this will probably be the most useful application of MIDI for you in the long run.
But there are many other things you can do with MIDI prior to hooking it up to a computer.
First off, let's face it, the D-20's sound engine leaves much to be desired. It's pretty bad. But the keyboard and on board controls are fine. You can find countless used sound modules at music stores and on Craigslist. If you are just starting out, look for a module that has a good complement of sounds you may enjoy and are appropriate for your style of music. Then it's just a simple matter of hooking up the MIDI out of the D20 into the MIDI in of the module. Be sure to hook up the audio outs of the module as well...MIDI doesn't transmit any audio whatsoever...think of it as the D20's keys telling the module what notes to play. If you also hook up the audio outs of the D20 into a mixer with the module, you now have a very versatile synth that has several layers utilizing several different methods of synthesis. Now the brash attack of what the D20 laughlingly calls a piano sound becomes a really evocative attack for a warm analog pad from the module. This USED to be the way things were done prior to powerful computers, and I would argue that, even with cheap synths, it creates a sound that is hard to get from any single software synth no matter how powerful.
You can also use MIDI to sync up a drum machine with the built in sequencer on the D20. I don't know that I would have the patience to program full songs into the UI nightmare that is the circa 1990 Roland on board sequencer, but it's perfect for patterns, and it's great for hooking up to a drum machine to lock them in time with each other. If you are a guitarist, it provides a nice canvas on which to try ideas and motifs. You can hook up the MIDI ports in either direction depending on which device is assuming tempo and meter control. If you do decide to do this, there is ample documentation out there on the Net.
Eventually, you are going to want to hook up to a computer, but in the meanwhile, there are many other live applications that you should play with to get a comprehensive overview of MIDI.