If I understand the melody notes and chords you describe, I came up with this notation:
X: 1
K: Gm
L: 1/4
%%staves {(RH) (LH)}
V: RH clef=treble
V: LH clef=bass
%
[V: RH] "5th"d/2"nt"c/2 "5th"d/2"nt"c/2 | "nt"d/2"5th"c/2 "nt"d/2"5th"c/2 | "3rd"d2 |
[V: LH] "i"[G,2B,2D2] |"V7/III"[F,2A,2E2] |"III"[B,,2B,2D2]|
The term "function" has a very specific meaning in harmony where we have tonic, pre-dominant, and dominant functions.
"Function" in a melodic context is sort of generic, but a few specific functional melodic ideas apply to your question:
- chord versus non-chord tones, various labels are given to melodic tones that do not belong to a chord like appoggiatura, suspension, neighbor tone, etc.
- tendency tones, some melody tones have a tendency to move a certain way, for example the ^7 scales degree - the leading tone - has a tendency to move up to the tonic.
- chord tone role (I'm not sure role is the best word, but I don't know a standard term) chord tones have names like root, third, fifth, etc. and can receive special consideration depending on the role, for example the third of a chord is general required because it defines the major or minor quality of the chord while the fifth can sometimes be omitted as not absolutely essential for defining the chord.
I labelled the music to show...
- neighbor tones (nt)
- and chord tones which were fifths and third
To get to your main question...
Does the function of the notes change during chord changes
...the answer is: yes.
Notice of the "C" in the melody is a non-chord tone when played over Gm
but becomes a chord tone of the fifth when played over F7
. And while the "D" in the melody is a consonant chord tone of a fifth over the Gm
it becomes the chord third over the Bb
chord.
I made a slight change to the harmonic context you gave and made the second chort a D7
the dominant in G minor.
X: 2
K: Gm
L: 1/4
%%staves {(RH) (LH)}
V: RH clef=treble
V: LH clef=bass
%
[V: RH] "5th"d/2"nt"c/2 "5th"d/2"nt"c/2 | "root"d3/2"7th"c/2 | "3rd"b,2 |
[V: LH] "i"[G,2B,2D2] |"V7"[^F,2A,2D2] |"i"[G,2B,2D2]|
I did this to illustrate a point about tendency tones with the two specific melodic tones you gave: "D" and "C". In your original harmony the "C" isn't a tendency tone. In fact, over the F7
chord it is a stable fifth of the chord. But, when the "C" is played over D7
it becomes the seventh of a dominant seventh chord which is a tendency tone that resolves down to the third for the following Gm
tonic chord.
Note that in both examples the second chord is a dominant seventh chord. Merely selecting any dominant didn't determine how the "C" would function. We need to know specifically where each dominant would resolve to truly understand the function of the "C".
By changing the harmony we made the pitch "C" stable in one context but an un-stable tendency tone in another context!
Most harmony textbooks will include sections about non-chord tones, tendency tones, and other functional ideas where melody intersects with harmony. Try to review those topic in a textbook for more examples and explanation.