Okay, so super deep explanation tiemz.
All musical notes can be grouped at certain frequencies (measured by hertz). Certain musical notes sound nice together, and some do not. When two different frequencies do sounds good together, we say they harmonize well. When they do not, we call it dissonance.
There are twelve notes in an octave. C, C#/Db, D, D#/Eb, E, F, F#/Gb, G, G#/Ab, A, A#/Bb, and B. Once we hit C again, we say we have reached a new octave. The same note played with itself harmonizes perfectly with itself. This is because, in mathematical terms, if you were to measure the hertz of a note played at C4, and at C5, the note at C5 is exactly 2x higher in frequency to the one at C4. Humans like things that are exact
Now, here’s where it gets interesting. Not all sounds are created perfectly, and any sound that is not a straight sinewave will already have harmonic content within it, which give a sound it’s character. The sum of a sound being played and it’s harmonic content is called it’s Timbre (Pronounced “Tamber” btw). Note that this content is not produced by playing two notes together, it naturally exists within the sound itself. This harmonic content within in the sound are considered to be the sounds harmonic frequencies. The base frequency (the note being played) is considered the fundamental frequency. And just in case you were wondering, a sinewave is the only sound that consists of only the fundamental frequency of the note being played.
So, we now know two things, one, a sound played by itself harmonizes perfectly with itself, and adding notes in octaves adds perfect harmony. Add the timbre of the sound and you can sometime stop here and have enough to create good harmonies, melodies, and basslines (i.e. when playing the low piano, too many notes can sound muddy and unclear because of how much harmonic content a piano has, which means playing in octaves is usually preferred). But what about imperfect harmonies?
For sounds with less harmonic content, it can be desirable to add more notes to increase the richness of a sound, giving it true harmonies instead of the base harmonic frequencies already present within the sound. Remember how I told you there are only twelve notes in an octave? Well certain notes have certain other notes, within the same octave, that sound good together, and also have notes that do not. Provided the original sound you have has good harmonic content (that is to say, it does not sound dissonant in any way when played one note at a time), the only true way to create dissonance is to intentionally choose notes that do not harmonize well.
I’ll continue using C as an example. As you already know, C harmonizes with itself. The next best note that harmonizes with C is G, which is 7 steps (called semi-tones) away. This is considered the perfect fifth of C, and a chord consisting of only a C and G note are called C5 collectively (when naming a chord, the base note is always the beginning of the name, and the consecutive letters and numbers indicate the harmony notes within the chord). Again, the word perfect comes up. The perfect fifth of the note is almost directly 1.5x the base note of a chord (i.e. G5 is 1.5x higher in hertz than C5). Because of this, the perfect fifth is often mistaken for the base note itself.
The most dissonant note you can play will be the note directly preceding the perfect fifth of a note. F#/Gb is the 6th semi-tone up from C (one below C’s perfect fifth, G), and this note is considered it’s tritone. It’s also worth noting that a tritone’s perfect fifth is also extremely dissonant to the original note (in this case, C#/Db). Almost every other note can be safely played with C and will have varying levels of pleasantness to them to the human ear.
The most important thing is that a collection of notes played together give a sound tone, definition, and character. Depending on what you are going for, understanding what notes sound good together and what notes sound bad together is great for allowing you to achieve what you are desiring to convey and will also allow you to avoid mistakes.
To summarize, I have a neato color coded octave detailing notes that work well and notes that are dissonant in relation to C, just remember that if you are using a different note, replace C with whatever it is you are using and go directly from there, i.e. A# to B to C, etc.
Blue indicates the base note
Red Indicates notes that are dissonant
Yellow for notes that are not dissonant but not perfectly harmonic either
Green for notes that are harmonic
C (Base, harmonizes perfectly with itself. Perfect clarity is good for lower sounds; when they have too many harmonies they tend to sound muddy, but in higher frequencies, perfect harmonies can sound dull and empty, lacking richness).
C# (1 semi-tone above base, very dissonant. No major or minor scale includes this semi-tone in it, with good reason. Use when inducing cringes from your listeners)
-D (2 semi-tones begins to sound decent, and some chords with these notes can sound quite beautiful. Note that this note is the perfect fifth of the base notes perfect fifth, and thus chords with this notes, the base, and the perfect fifth, are quite nice sus 2 chords)
—D#/Eb (3 semi-tones is the beginning of a minor chord, and harmonizes well. Use this for sadder and intense themes in your music)
—E (4 semi-tones is the beginning of a major chord, and makes a more cheerful and light sound)
—F (5 semi-tones, and if you did your math, the base note is this note’s perfect fifth.)
F# (6 semi-tones, the dreaded tritone. A chord consisting of a base note and it’s tritone is considered a diminished chord. Can be used creatively to add tension to a section)
—G (7 semi-tones is the perfect fifth. the mathematically perfect harmony note to the base, it is called the fifth because it is generally the fifth note in the scale (again, the two notes in red are generally skipped in all main scales). These chords sound powerful and upfront, but often are skipped for more interesting variations for the same reason that playing the same note an octave up is skipped. It’s boring :P)
-G#/Ab (8 semi-tones is a tone included in the minor key of the base note, and it’s worth noting that the base note is 4 semitones away from this note, making it a major chord. This can sound good or bad depending on certain situations)
-A (9 semi-tones is similar to 8 because, again, the base note sounds like the upper one. In this case, the sound is minor, making it sound sad)
-A#/Bb (10 semi-tones is part of a 7th chord, and generally sounds better with another note in-between for it to harmonize with. These chords general sound inquisitive and unique, and were very common in jazz)
-B (you might think that 11 semi-tones, being one away from the note itself, would be dissonant, but it is included in major keys with good reason. Again we have 7th chords, and while I personally prefer minor seventh chords, major sevenths have their place as well. Again, the sound is very different from others, and can be used to generate tension in a song).
The real fun begins when you throw in a third note, as it has to harmonize with both the base note AND whatever second harmony you chose. But this post is long enough :]