Good morning Petr,
An excellent question. It took me a few minutes to figure out how to get this working, but now I couldn't be happier. Hopefully this answers all of your questions...
Starting with what's given by Fellippe, we have a "sample rate" of 44100 samples per second. That is: every 1/44100 seconds, we are handed the instantaneous volume of the sound being played. By plotting the sound data horizontally, there is precisely one "piece of data" per pixel. This means that the so-called "speed of sound" is exactly 44100 pixels per second in this scheme.
Let me label the speed of sound on screen as C = 44100 pixels/sec.
Now for some terms. Suppose we are handed a very simple sine curve. No weird squiggles, no squares or sawtooth waves yet, just a sine.
The "period" ( T ) of the wave is the TIME taken, like in seconds, for the entire wave to repeat itself.
The "frequency" ( F ) of the wave, is one divided by the period. This is why we measure frequency in Hz, which are just inverse seconds.
The "wavelength" ( L ) of the wave, is the peak-to-peak span, measured in pixels.
Now the cool part: What ties the variables all together, is the following wave equation:
C = L * F
So that means we can measure L and calculate F.
Here is a full-blown example measurement of a 200-hz sine wave:
[ You are not allowed to view this attachment ]
Alright, so what about more complicated patterns?
Well, any complicated wave is actually the sum of simple waves, and each of those simple waves obeys the equation above. However, it's a little harder to discern what's happening by just looking at the sum of two of more waves. For an example, I chose to overlay a 400hz sine wave onto a 500hz sine wave, both having equal volumes. This gives rise to a "binaural beat" which you can actually hear at not 500hz or 400hz, but the difference of the two, aka. 100hz. I have measured the 100hz beat frequency in the image below.
[ You are not allowed to view this attachment ]
In conclusion: frequency can only be reliably understood using the construction(s) above. It's misguiding to try counting it from the number of times the graph crosses the the x-axis, or anything like that. It will only turn out correct by accident, and only for pure sine curves.
tldr:
(i) know what the speed of sound on screen is
(ii) measure the wavelength of the thing you're measuring
(iii) let the equation tell you the frequency