What is a harmonic?
Every sound is composed of one or more sine waves. Every sine wave that composes a sound is called a harmonic. The characteristics of these harmonics (like quantity, amplitude, and frequency) is what gives each sound a specific timbre. That's why a guitar and a piano don't sound the same.
What is a "dirty" sound?
It's all about harmonic content. A "clean" sound will have few harmonics, and a "dirty" sound will have many harmonics, the same way a dirty room has a lot of stuff all over the place.
The best example I can think of is the most pure of tones: the sine wave vs a tone with many harmonics: a square wave.
Seeing and hearing dirty and clean sounds. Seeing and hearing harmonics.
(before opening any link with sounds, check your sound levels)
This is how a sine wave sounds like:
This is how a square wave sounds like:
Both are at the same frequency (note): C 523.25Hz, but the square wave has much more harmonics than the sine wave (the sine wave only has one!). Can you notice how the square wave is much more "dirtier" than the sine wave, which is much more "cleaner"?
Using software, we can actually "see" these harmonics, and the waveform of the sound.
This is the waveform of a sine wave:
And this is the harmonic of the sine wave:
Here we can clearly see that the sine wave has only one harmonic. It's that peak at around 523Hz.
Now let's see the waveform of a square wave:
And the harmonics of the square wave:
The square wave has many more harmonics! It sounds "dirtier".
Making some dirt.
We can hear and see how a "clean" sound becomes "dirtier" over time. I've achieved this not by using an overdrive (or similar) effect, but by just adding each harmonic individually over time.
This is a sine wave (clean sound) turning into a square wave (dirty sound) over the period of 20 seconds, same note C 523.25Hz (WARNING, the sound levels at the end are significantly higher than at the start, be careful with your local sound levels!):
Notice how the sound becomes dirtier as we add more harmonics, as the sound turns from a sine wave into a square wave?
Here we can see how harmonics are being added over time. From top to bottom is: at 0 seconds, at 5 seconds, at 10 seconds, at 15 seconds, and at 20 seconds:
You can see how the wave form changes over time here: http://imgur.com/a/OYobG
Dirty and acoustic.
This difference in harmonics can be found in acoustic instruments too. Let's look at the harmonics of 3 instruments: a clarinet, a piano, and a trumpet, all played in C 261.62Hz.
We can see that the trumpet is much more richer in harmonic content than the clarinet and the piano; the trumpet is "dirtier".
You can see an album with more images of the harmonic content of different instruments here:
It's not all about quantity.
There are other dynamics that will determine the timbre of an instrument, therefore having an impact on how dirty or clean it sounds.
- Phase, frequency, amplitude, and envelope of each individual harmonic.
- Psychoacoustics, like Fletcher–Munson curves, masking effects, and even the position of the listener in relation with the instrument.
- Acoustics, surroundings, dimensions, ratios, materials.
A sound with few but very loud harmonics will sound dirtier than a sound with a lot of barely audible harmonics, for example.
While all these factors play a role, the sound with more harmonics will tend to sound dirtier than the sound with less harmonics, assuming both sounds are equally loud, ignoring external influences like reflections and subjective perception.
Clean sounds have less harmonics, dirty sounds have more harmonics. Adding harmonics can be achieved by using overdrive, clip, saturation, distortion, (etc) effects; but it can also be achieved using other synthesis methods like additive, AM, and FM. Some sounds and instruments are naturally dirty, like a square wave, a sawtooth wave, or a trumpet.