Musical instruments fall into five broad categories according to how they generate sounds:
This classification system, known as the Hornbostel-Sachs system, was originally created by Erich Moritz von Hornbostel and Curt Sachs to describe musical instruments all over the world. If we limit ourselves to the western music tradition, we find groups that may be more familiar to you; some that correspond with the Hornbostel-Sachs classifications, and others that do not.
Instrument Families in Western Music
Instruments like the piano, harpsichord, and organ use a keyboard as the interface between the performer and the instrument. The piano and harpsichord are chordophones, and the organ is an aerophone that uses air columns flowing through pipes to create sounds, but all three are traditionally operated by a single musician at a keyboard, so they are typically considered part of the keyboard family.
Most chordophones are part of the string family of instruments in the western system. These are divided into groups of instruments that are bowed (ex. violin, cello), plucked (ex. harp, guitar), and hammered (hammered dulcimer). Although pianos are hammered chordophones and harpsichords are plucked chordophones, they are typically considered part of the keyboard family rather than the string family.
Woodwinds and Brass
Aerophones are divided into the woodwind and brass families in western music. Both use vibrating air columns, but they use different mechanisms to start the vibrations. Playing a brass instrument (like a trumpet, trombone, or tuba) requires the vibration of the musician's lips against the mouthpiece of the instrument. In the case of woodwinds, the vibration begins either with a vibrating reed (ex. clarinet, bassoon, saxophone) or by the movement of a column of air against an edge (ex. flute, recorder). Although organs are edge-blown aerophones, they are considered part of the keyboard family rather than the woodwind family.
In western music, we group membranophones and idiophones into a single group: percussion. We distinguish between percussion instruments that create specific pitches and those that do not. The xylophone and timpani are pitched percussion instruments, and the tambourine, snare drum, and cymbals are unpitched percussion instruments.
Electronic instruments can be organized into three groups: instruments with electronic action, instruments amplified electronically, and instruments that actually produce sound using electricity. An example of an instrument with electronic action is an organ that uses electronic valves (openings to the sounding pipes). An electric guitar is an example of an instrument that is amplified electronically. Theremins and synthesizers, whether analog or digital, produce sound using electricity directly.
Analog vs. Digital
Put very simply, in analog instruments the electricity vibrates* in the circuit in a way that is analogous (hence the term 'analog') to the way that sound vibrates in acoustic (non-electronic) instruments. In digital music, the sounds for each small slice of time are encoded as numbers (or digits, hence the word 'digital'). The encoding allows the music to be easily stored and manipulated as data, but it also gives an underlying 'stair-step' quality to the sounds when they are played back, which may or may not be noticeable to most listeners.
Originally, instruments such as synthesizers and theremins were analog, but now they are mostly digital. Computer-generated music, such as MIDI (Musical Instrument Digital Interface) music or sampled music (a composite of pre-recorded music clips), is also digital. Most modern recordings are also digital, with CDs and MP3s having largely replaced formats such as analog magnetic tapes and vinyl records.
* Technically speaking, the electrical waveform does not vibrate, but modulates in such a way that the frequencies and amplitudes of sounds can be represented.