When samplerate is fixed, different pitches show up as waveforms having a different number of samples (per cycle). Each sample is a constant time step apart; you can count the number of samples (= length of time) of a period. Frequency is inversely proportional to period.