Here's a basic theory starting point. I like talking so it'll probably be long winded and ramble-y. I might be wrong here and there so please forgive me if I make a mistake. I'm also not going to tell you all the extra things like because this is a basic guide. Weird stuff exists but
I don't play jazz so I don't know that stuff well you'll learn later on your own and it'll be magical.
All my examples will use the key of C because there are no sharps/flats in the major key and it helps me think.
I'll start with
keys:
While you have 12 notes in the "chromatic scale" (all of the notes), you will have only 7 total notes in a key. For example, the key of C major is C D E F G A B, and the key of C minor is C D Eb F G Ab Bb. When you write songs, you will use only those notes in your melodies and chords (unless you play jazz/blues/prog rock/etc).
Keys are build from intervals of your root note. For example, you have the
"Tonic"/Root (say, C),
your Major Second (D),
your Major Third (E),
Perfect Fourth (F),
Perfect Fifth (G),
Major Sixth (A),
and the "Leading Tone"/Major Seventh (B).
A minor key swaps the
Third,
Sixth, and
Seventh for their Minor counterparts (which are a
half-step/semitone lower).
'Course, that don't mean jack diddly unless you know how to count the intervals. So here's the scoop:
Each interval is made of semitone "leaps" I guess. Here's a quick and dirty chart of all of the basic ones:
Minor second: 1 semitone
Major 2nd: 2 semitones
Minor 3rd: 3 semitones
Major 3rd: 4 semitones
4th: 5 semitones
Minor 5th: 6 semitones
5th: 7 semitones
Minor 6th: 8 semitones
Major 6th: 9 semitones
Minor 7th: 10 semitones
Major 7th: 11 semitones
Octave: 12 semitones
So if you need to go from D to E, you know it's two semitones and a major 2nd, from C to G# is 8 semitones and a minor 6th, etc.
Chords are similarly structured. You will take the root of your chord and build with intervals using the key you're in as a guide. Most basic chords (triads) are built in 3rds starting on the root.
A minor = A (root), C (minor 3rd, 3 semitones above the root), E (perfect 5th from root, major 3rd from minor 3rd)
G major = G (root), B (major 3rd, 4 semitones above the root), D (perfect 5th, minor third from major third)
(tricky one) B minor diminished = B (root), D (minor 3rd, etc), F (minor third from the minor third)
Notice how the minor 3rd from B to D is the same minor 3rd in B minor diminished as it is in G major. It all works together! Awesome.
I threw in the diminished chord because that will usually (almost always) be your 7th chord in a key. It's always diminished, because say if it was a normal B minor chord, it would have F# (which is not in the key of C).
Now what about the really fun chords? Like Cmaj7, Dadd6, or Fsus2? It's easier than it looks. Find the root and count the intervals from there to the note.
Cmaj7 = C, E, G, B (major 7th from C)
Dadd6 = D, F#, A, B
Fsus2 = F, G (major 2nd from F), C
BTW: if it says "sus" you will "sustitute" the third for either a major 2nd (sus2), or a 4th (sus4). If it says "add", you'll add it in without replacing a note.
Melody is just using notes from the key that sound good when played in sequence. Accenting chord tones (eg playing a C note in the melody over a Aminor/Fmajor/Cmajor/Gsus4/etc chord) is a good idea but there's no real rules here. Humming/singing random stuff/playing random notes over chord changes is how I get most of my melodies so it's super non-technical.
So IMO (my opinion) the most important part of theory is intervals. If you can "get it" you'll have a much easier time writing music, which is what it's all about, man.
The other most important part is remembering that theory is not a set of rules, but it's just the language of music. Don't think you're "breaking the rules", because even then there is a term for
every "
broken rule" in music, so technically you can't break the rules

. If it sounds good, it sounds good, and chances are, if it sounds good, it doesn't "break" the "rules", but is a codified composition technique (or you're just
modulating in a non-jarring way).
Also to all the people out there smarter than me feel free to correct me or simplify something further if I made it worse. I'm 99% self-taught so I probably said something wrong.
Also I hope this all makes sense.