An audio interface transfers sound from instruments to your computer. While some computers feature one or more audio inputs built in to the internal sound card, external audio interfaces allow greater customization and typically result in higher quality audio transmission. The central components of an audio interface are a connection to the computer, an analog-to-digital conversion, a digital-to-analog conversion, audio inputs and audio outputs. Most audio interfaces connect to a computer through a USB port, though some models also support FireWire connections. If the signal is traveling to the computer, the ADC converts it to a digital signal. If the signal is traveling from the computer, the DAC converts it from digital to analog. Lastly, each interface typically has some way of outputting an audio signal for monitoring and playback.
Depending on the nature of the signal that your instrument generates, you may need to use a preamp. A preamp boosts the level of an audio signal so that it is similar to that of other instruments. Most microphones require an external preamp. Therefore, if you are going to record an acoustic instrument into a microphone, you may need a preamp. Some audio interfaces have built-in preamps. Others require you to run an external preamp between the microphone or instrument and the audio interface, to boost the signal before it reaches the interface.
Once the audio signal has passed through your audio interface to your computer, you must have some way of recording and manipulating sound on your computer. DAWs are specialized programs for doing this. A standard DAW has the ability to record audio input, edit that audio, and save it or play it back through any number of channels. Audacity, Ardour and Wavosaur are three different free sound editing programs. Both Audacity and Wavosaur can be used for basic recording and editing, whereas Ardour has functionality similar to that of commercial DAWs.
MIDI is another important aspect of hooking up instruments to a computer. It involves a separate type of cable, over which MIDI messages are sent between different devices. A standard MIDI message involves data about which notes are to be turned on and off, note duration, note velocity, other controller values that have changed, program changes on an instrument and many other parameters. You can send MIDI data from a DAW to an external, MIDI-equipped instrument in order to make that instrument play sounds. On the other hand, you can use a MIDI-equipped instrument to send MIDI data to the computer in order to control a virtual instrument.