To a pretty good approximation, the frequency of a sound wave does not change as it travels. In a plane wave solution, all points along the wave are oscillating up and down with the same period; and so the number of cycles per second is the same at the source as at the observer, no matter where the observer is located.
There are some minor effects (due to non-linearities in the medium) which can cause frequencies to change. However, these are usually negligible, and are usually glossed over in introductory physics classes.
EDIT: You commented that there should be a relation between distance and frequency because the pitch changes when it comes closer. But that's not quite true; the pitch changes while it is moving, which is not quite the same thing.
Suppose you have a speaker that is 10 m away and at rest, and it is emitting a 440 Hz tone. While the speaker is at rest, you hear a 440 Hz tone. If the speaker then moves towards you, you will hear a higher frequency while the speaker is moving. But if it stops 5 m away from you, the frequency you hear will return to 440 Hz.
In principle, if you know what the "shifted frequency" was, you could figure out how fast the speaker was moving; and if you measured the amount of time that you heard the shifted frequency, you could multiply the velocity by the amount of time to find the distance the speaker travelled. But that only tells you the displacement of the speaker during its motion, not its initial or final distance from you.