Find the MIDI interface or port on your instrument (most new models have a standard MIDI in and MIDI out port on the back). Some devices have a third port, called a Midi Thru, which copies any data coming through the MIDI in port.
Next, determine how your computer can connect to the MIDI device. Some computers have soundcards equipped with MIDI ports, which require nothing other than a MIDI cable to connect. Other computers allow you to connect your MIDI cable into your soundcard through a gameport.
If your computer does not allow these options but has an open USB port, purchase and use a MIDI-to-USB connector. These are usually "plug and play" and require no other action than connecting the MIDI cables from the USB port to the instrument.
While these connectors can be expensive, they provide a convenient solution for musicians who want to plug into a variety of laptops.
Connect the MIDI cables. Although it seems counter intuitive, you connect the MIDI out connector to the MIDI in connector on both your instrument and your computer.
Generally, once your instrument and computer are connected via the MIDI cables, you just need to select the device from your computer's menu and run the appropriate music software.