Say I have a song that I recorded in C major to a wav file. And then I open that file with Audacity (or some other audio program) and I increase the pitch. And as a result now the song is in E major. Then aren't pitch and key similar?
I'd like to add to some of the good answers here, this reddit one sums it up well for me
Pitch is the human perception of frequency. Key is the familiar system of scales and chords with a tonic.
A piece or excerpt can be atonal--i.e. it can be in no key whatsoever--and still have its pitch changed. I can change the pitch of a 12-tone serialist piece up 3 semitones and its pitch will differ, but it still won't be in any key.
The key of a piece encompasses what its tonic is and whether it favours the flattened or natural/sharpened third, among other things. Changing the pitch of all of a piece's notes by the same number of semitones will change its key...if it has any.
Pitch and key are similar in the sense that changing the key of a piece means changing the pitch by multiples of a semitone.
Of course it's possible to change the pitch by any amount, not necessarily multiples of a semitone.
Pitch is simply a measurement of frequency, it's a quantification of sound.
Key is a musical concept describing the collection of pitches that form a framework for melody and harmony and tension/resolution, which may be based around any root pitch.
When referring to single musical notes, the pitch may be a pure waveform of that frequency if it's coming from a synth, or if it's an analog instrument it's the single most dominant frequency from the sound (ignoring the other harmonics and overtones from the timbre of the instrument). But when you're editing an audio clip and "pitching up" or "pitching down," you are modulating or transposing the key of the song by changing the pitch of every note by the same value.
Changing the pitch in audacity will probably mean to transform (transpose) a wave-file by "adding" + or - the pitch values up(+) or down(-).
When changing the key in a notation program you have 2 options, you may transpose the notes up or down like the movable do: The tune will be unchanged, but the pitch will be changed.
When changing the signature you may have the option:
a) to keep the notes where they are: the result will be a different mode: e.g. C -> the notes keep the original position, but E => Eb and B = Bb, and the song will be in Bb-Dorian. The pitch of the tune will be unchanged, only the altered tones referring to the new key signature will be changed, and this means: The tune will be changed!
b) to transpose the notes up or down with the key signature, (then you still have the option of diatonic or harmonic transposition like playing the same printed notes with a transposing instrument).
This latter case 3b): harmonic transposition by changing the signature is identical with changing the key, that means to change the key with transposing the notes is a short cut).
So it looks like pitch change and key change are the same. In any case you have to decide the direction (up or down) of the changed result.