Hit a group of keys right next to each other on the keyboard. You might find the sound jarring, tense or agitated. Now play a major chord. The sound might feel calming. Here we have dissonance and consonance. The tension and release. The drama. The drama of harmony. A dissonant chord has frequencies that chafe, that cause tension that needs resolving. A consonant chord has frequencies that fit together more comfortably. They sound harmonious. Try playing a C chord over a B. The sound should feel like it needs resolution. Like something is up in the air.
A daily exercise could be to invent and release tension. Begin with a triad. Add a single note not in the key, sustain for a few seconds, then release the extra note. Repeat, but hold longer. Notice how the resolution seems more powerful with more tension? Repeat for about 15 minutes, with different extra notes, and see which ones just give you a slight “misfit” feeling and which ones feel painful. This will help you learn to hear relative “wrongness.”
An initial pitfall is the idea that dissonance implies incorrectness. Novice composers will immediately stop upon hearing a discordant note and thereby forgo an important learning opportunity. Rather than backing away from the note, simply sit and determine whether or not the note would sound harmonious if the rest of the chord were to shift. Many musical phrases that sound dissonant in the moment are meant to sound that way in anticipation of later resolution. A second adjustment can be made in your overall volume – if you find that you are hitting a lot of dissonant tones, try playing a little more softly. Volume will increase dissonance.
It’s also confusing when a note seems dissonant when you’re playing it alone, but sounds perfect when you’re playing a scale. Play a scale and stop at the seventh scale degree, then come back to the tonic. This second to last note is not so perfect alone, but it sounds nice as a precursor. This shows that there is such a thing as context-dependent “perfect” sounds. Repeating this in every key, you will come to feel what it means to “lean into” a sound in order for it to be consonant, which is a fundamental component of tonal music.
The more you explore, the more dissonance ceases to be something that needs to be “fixed” and the more it becomes something you can use. You start to discover that sometimes you want to create tension to build expectations and sometimes you want to resolve things with something smooth. Try writing a few tiny 2-chord phrases where you hold off on resolving, then resolve. Sometimes having just one more beat before resolving dramatically changes the effect. As you get more attuned to this, you develop the ability for your ear to judge this naturally, and harmony becomes a dynamic thing.