I am wondering if when writing a chord progression, all the notes fit within a single scale.
If not, what is the logic behind chord progressions?
In your average chord progression, most of the time all of the notes will stay in the scale that correlates with the key of your song. If the song is in G major, your chords will contain notes that are found in that scale- G major, C major, D major, E minor, A minor, B minor.
When you find a chord in a progression that contains some note that is not part of your original scale, it is most likely from a "related" key. This term refers to keys that are a perfect fifth away, in both directions, from your original key.
Let's continue to use G major as our original key: A perfect fifth up from G is D and down is C. You will sometimes see the chord A major sneak into a G major chord progression. This chord is taken from the key of D major. The same with an F major chord. F is sharp in the key of G major, but is natural in the key of C major. Usually these chords lead in a certain direction when used in a foreign key (In the key of G, A major would resolve to D major; F major would resolve to C) but they do not have to.
Another set of related keys from which you can borrow chords are relative majors/ minors and parallel majors/ minors. The relative minor key uses the same key signature as the major key it is derived from (G major and E minor). However, using the harmonic minor mode of the minor scale gives us a raised seventh scale degree. In E minor, D would become D# allowing us to use a B major chord.
Parallel minors/ majors are simple: G major's parallel minor is G minor; E minor's parallel major is E major.
In the rock song Creep by Radiohead, the key of the song is G major; the chord progression is G major-B major-C major-C minor. This progression repeats throughout the entire song.
If you are interested in going further down the rabbit hole, you can also use parallel and relative major/ minors derived from the related keys as well. I hope this is a good resource for the logic behind chord progressions.
That's probably a much more interesting question than you think it is, with the ever-so-useful answer, "It depends."
I'm going to assume that you're playing Western, common practice music in a pop (Jazz/Rock/R&B/et al) idiom, the sort of music with harmony that harks back to Renaissance counterpoint. Basically, the music you hear on mainstream radio or performed by the cast of Glee.
Under that assumption, the answer is "No." As to the logic?
Consider a good Little Richard chord progression: C F C F C G F C
All of those chords have scale-tone roots (we're in C...) and only have scale-tone pitches in them. Now a VERY common sound in Western music is that G-C transition. That's the dominant-to-tonic transition.
One very common alternative would be to play a series of dominant-to-tonic transitions using what are called "secondary dominants," as you'd hear here:
C A7 D7 G7
The logic in this case is that A7 is the dominant of D, D7 is the dominant of G, and G7 is the dominant of C, which brings us back home.
Mozart did this in his 40th symphony (KV 550), Gershwin did it in "Someone to Watch Over Me"
There's a couple dozen metric tonnes of background info I'm glossing over, as well as a myriad of other Western and non-Western musical styles, each with their own rules and conventions.
Google is very much your friend here.
It depends entirely on the genre, and that is actually one of the defining characteristics of genre.
most pop: probably, and mostly. Sometimes augmented by the occasional secondary dominant. Part of why they are so "easy to hear". But if it's torch-songy pop, probably not because they borrow a lot from the style of standards
musical theatre or standards or jazz: no way, modulations are a key part of the genre
blues: no, because a blues uses dominant seventh chords on the root, and if doesn't, it won't sound like a blues
rock: it depends, a lot of rock has a basis in a blues, but lots of other rock has simple harmony. Punk for example is almost always harmonically simple on purpose, prog rock will likely use short modulations, and anything blues derived will be using dominant seventh chords all over the place
A very large part of what makes a certain genre sound a certain way is the typical chord voicings used (just triads? are there sevenths? are there ninthes? are there altered upper notes?) and the kind of progressions used (purely diatonic? some tonicization? modulations to IV and V? distant modulations?)
"...what is the logic behind chord progressions?"
Woah! That's a BIG question!
Here's a few things that can make a chord not sound too left-field.
If it's surrounded by other chords that all use the notes of a particular scale. Basic, but can be boring.
If it has one note different to an 'in scale' chord. For instance, if we're in C major, D minor is an 'in scale' chord. (Let's start calling it a 'diatonic chord'). So D Major - with one note different to D major - is good. We could then change ANOTHER note... still good.
If it has at least one note in common with the preceding chord. For instance, C major to Eb major. They have the note G in common, so they fit together nicely. You can come straight back home, or you can use the Eb chord as a starting point for further exploration. C, Eb, Abmaj7, Db, C. Sweet!
That last example illustrates another possibility. You can 'plane' up or down to a chord of the same shape, but a semitone away. Db to C. Way out 'harmonically'. But very close physically. And it brings us back home, which is always acceptable.
There's more. Much more. But perhaps I've got across the point that you DON'T have to stay 'in scale'. And I haven't needed to use the excuse of 'borrowing' from another scale.
Almost all the answers above are 'correct' in one way or another, but in the hope of providing an answer that may be a bit simpler . . .
I assume you know what a circle of fifths is. (By the way, I draw mine with the sharp keys on the right side and the flat keys on the left. If you draw yours the other way around, you'll need to reverse all the 'rights' and 'lefts' in what follows, as well as swapping 'clockwise' and 'counterclockwise':
Draw a wedge around the key you're in. That is, Draw a piece of pie that includes the key you're in and the ones to the right and left of it. If the key you're in is C major, then the wedge will include C major, a minor, F major, d minor, G major, and b minor.
If your chord progressions use only chords that are within the wedge, you may very well not need to alter any notes in the melody, unless it's modulating to one of those keys and not really staying in the key you started in.
But if you LEAVE the wedge, you'll need accidentals in the melody. In Standard Practice traditional Western harmony, it's considered 'legal' to 'leap' out of the wedge to the right, that is clockwise (if your sharps are on the right side). Up to five positions. That is, it's legal to leap from C major to B major. But you then have to work your way back step by step counterclockwise. (Bearing in mind that you can do enharmonic substitutions on the way back.) But if you want to go counterclockwise, you can only move one 'notch' at a time, and walk back as well. Either direction though, you need accidentals. This applies no matter what key you're in.
Of course, good composers and songwriters break these sorts of rules all the time. But if you want to consider what happens when a songwriter sticks to the 'rules,' consider the song "Red Roses for a Blue Lady." The song begins by leaping five notches clockwise, and walks back entirely 'legally' making only perfectly legal enharmonic substitutions along the way. (If you're in C, there's a sub of a d minor where there should be a D major, and one other sub a bit later.) Notice what this extreme example does to the melody. Several accidentals are needed. The harmonic progression explains why.
Hope that helps.
Not necessarily...and this deviation is called chromatic alteration in music theory...and you can alter by a semitone the fifth, the seventh, the ninth or eleventh to give some different coloration to some of the chords in the progression