okay sorry if any of y'all touched on this....but to me this is the single most helpful thing you can learn in theory....
for electronic music (including hip hop)...you rarely go outside the normal major and minor scales. sures there's numerous modes and they all sound fancy, but its more confusing than useful when you are trying to grasp the basics. so first off, just start with minor key...you'll use that the most i guarantee it.
just think of it as a series of intervals, forget the names of the notes. first, a half step is the ADJACENT NOTE ON A KEYBOARD (C to C# is a half step for instance). a whole step is 2 notes on the keyboard (C to D).
Now, every minor scale, whether its C# minor or A minor or E minor....ALL natural minor scales...follow this pattern of intervals...
w - whole step
h - half step
1 w 2 h 3 w 4 w 5 h 6 w 7 w 1
each number is a different scale degree. 1 is the ROOT of the key. Scale and key really don't mean anything different....it is a certain group of notes in a certain pattern.
so say you want to find out the notes in A minor. this pattern translates into:
1 w 2 h 3 w 4 w 5 h 6 w 7 w 1
=
A w B h C w D w E h F w G w A
ABCDEFGA is all the notes in the key of A minor. look at the pattern on the keyboard.
then do it for say...E minor
E w F# h G w A w B h C w D w E
E F# G A B C D E
thats e minor. that doesn't mean you can't play notes that aren't in this group just because they are "out of key"...in fact a lot of them can add a LOT of character and flavor. Even though Bb isn't "in" the key of E minor, if you play it in the right context (like playing Bb-A-G-E) it sounds WICKED!
hope this helps. this is the basis, if you know this you can construct chords and write melodies (and FIGURE OUT melodies) so much easier.