Pitch is a perceptual feature of sound, quantized within a musical scale. It is relational, in the sense that pitch probably wouldn't have meaning outside of a musical context that defines multiple pitches.
Frequency is a physical measurement of a periodic waveform.
Generally, a tone is composed of harmonics, which have frequencies that are integer multiples of a fundamental frequency. The pitch physically corresponds to the fundamental frequency of harmonic sound (or a sound that is mostly harmonic). But the relationship is complicated, as we can perceive two tones as having the same pitch (and fundamental frequency) even if the actual spectrum of one of them does not actually contain a component at the fundamental frequency (see https://en.wikipedia.org/wiki/Missing_fundamental).
This is because our brain will fill in the fundamental frequency if a tone has most of its harmonics. This is why you can hear bass notes of a song even if the speaker you're listening to doesn't have the frequency response to actually reproduce the fundamental frequency.
I hope some of this nuance is making this make sense.
There's also a concept of "pitch class", which is the idea of what you might call "C-ness" of every C note on the piano. In other words, octave equivalance, or the fact that you can substitute nearby C for each other without ruining harmony. Pitch, in some ways, is the intersection of pitch class and a specific fundamental frequency.
Frequency is a physical measurement of a periodic waveform.
Generally, a tone is composed of harmonics, which have frequencies that are integer multiples of a fundamental frequency. The pitch physically corresponds to the fundamental frequency of harmonic sound (or a sound that is mostly harmonic). But the relationship is complicated, as we can perceive two tones as having the same pitch (and fundamental frequency) even if the actual spectrum of one of them does not actually contain a component at the fundamental frequency (see https://en.wikipedia.org/wiki/Missing_fundamental).
This is because our brain will fill in the fundamental frequency if a tone has most of its harmonics. This is why you can hear bass notes of a song even if the speaker you're listening to doesn't have the frequency response to actually reproduce the fundamental frequency.
I hope some of this nuance is making this make sense.
There's also a concept of "pitch class", which is the idea of what you might call "C-ness" of every C note on the piano. In other words, octave equivalance, or the fact that you can substitute nearby C for each other without ruining harmony. Pitch, in some ways, is the intersection of pitch class and a specific fundamental frequency.