A key simply determines the amount of sharps or flats in a particular progression or scale.
You can figure out the key by knowing the major and minor scale patterens. Each note in a scale has a number assigned to it. The first note of a scale is called I and the last note VII. The scale then repeates.
Once you know the patterens of major and minor scales, determine which Major scales contain the same notes as your song. It is possible for your song to fit into more then one Major scale.
You can figure out the exact key of the song based on the voicings of your chords (major verses minor chords are voicings) since you already know which chords are minor and major. The patteren for voicing in the major scale is as follows:
I - Major | ii - minor | iii - minor | IV - Major | V - Major |
vi - minor | vii - Diminished
The easiest way to remeber this is that their are only 3 major chords. I IV and V which also happens to be the most commonly used chords in rock progressions.
Once you know which Major key your song is in you can find out which minor key it is in. The minor key of a Major key is often refered to as the relative minor.
To find the relative minor of a Major key start on I of the major scale. Then count three frets down. The I is not counted in this process, but the counting starts on the first fret after I and ends on the note of the relative minor. For example in the key of C Major, A minor is the relative minor. The relative minor is always on the 6th degree of a scale (vi) in a Major key. The relative minor of any key contains the exact same notes, and voicings of the Major scale it is derived from.
With your chord progression you already know that 3 of the chords are minor. From what you've read above you already know that only 3 minor chords can exsist in a Major Key (unless one of your chords is the vii which is condisered minor in addition to Diminished, but these chords sound funny and you will know if it is.) So lets assume that your minor chords are the ii iii and vi of a particular key and that B Major must be I IV or V. However, it does seems as if your in the Key of C Major/A minor and the B Major chord doesn't fit into that key theoretically, although that doesn't mean that it can't sound good. I can't think of any established keys that contain a B, Am, Dm, and Em.
In the key of C Major/A minor the B note falls on the 7th degree of the scale and that would make it diminished. You can replace the B Major chord with the V or ii and it should retain the feeling of the Key (but probabily not that of the song since B Major isn't in the key of the rest of it.) You can replace any chord with either another chord in the same key 3 degrees up or down from it on the scale. For example: vi = I = iii but vi doesn't = iii. Another example: iii = V = vii but iii doesn't = vii.
Bass guitar is the answer to everything