Somebody in alt.comp.freeware told me it may be a good idea to post
this here. This is what my original post there said:
I need a program that will allow me to accurately read the frequency of
a pitch that is being input into my sound card. I need exact numbers.
Note: Electroning tuning programs (unless they meet these requirements)
do not work. I need Hertz, if at all possible down to decimal places,
not cents below a pitch. If it is at all possible, I need it to be
real-time as well.
I am not limited to software however. If there is some alternative
electrical solution, I am all ears for that as well.
Thanks for any help you can provide.
The search term you should probably use is "spectrum analyzer". There
are several shareware/freeware programs that do this. All of them
display a graph of input level vs. frequency; some of them will tell
you the exact frequency of the loudest tone in the input.
A thing called a frequency counter is such a piece of hardware. It
has a jack for the input signal, some switches to set the range, and
a digital display of frequency. You can get them in hand-held or
bench-top models. Price is around US$200 and up new, and maybe US$100
and up used.
Note that some of these are designed for radio frequencies only and
don't go down into the audio range, so check the specifications carefully.
Usually the short description will give the frequency range, so something
like "5 Hz - 400 MHz" would work, but "1 MHz - 1100 MHz" would not. You
may need to dig a little deeper to find out how many decimal places you
get in the audio frequency range.
There are several solutions - depending on what kit you can
get your hands on.
1) You could just connect the signal to an lf frequency
counter. The accuracy would depend on the resolution and
calibration of the frequency counter.
2) You could connect it to an oscilloscope - but that on its
own would not give you the measurement accuracy you need.
However, connecting a very accurate and calibrated lf signal
generator to the 'scope's z axis would generate a Lissajous
figure - you could then very accurately match the frequency
of the generator to the signal. Although a bit more
complicated, this gives a very useful (and pretty!)
graphical representation of the "quality" of the signal.
Here the accuracy of measurement depends almost entirely on
the accuracy and calibration of the lf generator.
3) You can do an equivalent of (1) and (2) using the sound
card and pc software (in association with a precision lf
signal generator for (2)):
Again, the accuracy is dependent on the lf generator.
4) A simple modification of (3) is to use the computer to
generate a variable frequency signal and use that to replace
the precision lf signal generator, above. You then use a
Lissajous display on either the pc (using the pc software)
or the oscilloscope. The accuracy will depend on the pc
master clock accuracy - which should be good enough for your
There are other ways if none of these will do. Let me know
if you need more.
The more accuracy you need the harder it is to achieve.
Getting accuracy down to a Hertz and decimals of a Hertz
as you mentioned is not trivial or cheap. Run of the mill
frequency counters won't do it, nor will free (or any?) software.
You have the added problem of an unknown signal source.
Even with a theoretical "perfect" measuring device, if the signal
you are trying to measure is distorted, noisy, varying etc your
results will be other than accurate. So you need to specify
the tolerance for error you can live with. You could start
out with something you can download for free as a baseline,
and work form there. Here's one site:
Look for Frequency counter 1.01 close to the bottom
of the page.
I can't say that I agree with you here - almost any
digitally synthesised lf generator, including a pc software
based one, will be able to provide this accuracy - combined
with a Lissajous display will easily allow a fraction of a
Hertz to be resolved. It is, with respect, very trivial and
Here, using a graphical Lissajous representation has great
advantages. It does cope very well with distorted and noisy
signals in allowing the lf generator to be tuned to the
fundamental frequency present, or a harmonic of it.
That is, of course, paramount. The Op does need to determine
how much accuracy (s)he wants before attempting to measure
I need as much accuracy as possible, though, since it is not the most
important thing to have it be really past the tenths place, I suppose
accuracy is really determined by that. The recordings I am using are
not one smooth generated tone. I think, though I am in no way certain,
that I may need to filter out some background noise. I will have to see.
you don't get accuracy for free, you have to pay for. The measuring time
must be long enough. If the frequency counter is counting full periods
only, it is not possible to get in 1 second time of a 1000 Hz tone a
resolution of 0.1 Hz, only 1 Hz is possible. For a resolution of 0.1 Hz,
you would need a measuring time of 10 seconds and if you want 0.01 Hz,
you have to wait 100 seconds.
Show me a *frequency counter* that yields accuracy at the 100ths of
a Hertz. He said decimals, plural. For accuracy at 2 decimal places,
you have to measure to *at least* 3 places.
A Lissajous display does not meet his requirement. He said
"I need exact numbers." The Lissajous display is a graphic,
which must be interpreted to yield a number. In my experience,
it is highly doubtful that he will get a known to be accurate
number to two decimal places of a Hertz. Further, it is
my *assumption* that a PC sound card will not be able to
produce a tone with known frequency accuracy at the thousandths
of a hertz level.
1 hertz is a bitch. It takes a looooonnggg time to get a lot of samples
and the signal has a lot of opportunity, time wise, to vary within the
sampling period. It's ten times worse at 1 decimal place, 100 times
worse at 2 decimal places, 1000 times worse at 3 decimal places
and so on. If you sample for 1 second, you get to "see" 1 complete
cycle at 1 Hz. Suppose I happen to sample exactly from the start to the
end of that cycle. My measurement says 1 Hz. Now suppose, in
a string of 100 pulses, 99 of them are at 10 Hz and 1 is at 1 Hz.
The sampling error means that my measurement is ~ 90% *innaccurate.*
So - what software do you have in mind? How accurate can he
get cheaply and easily with Lissajous figures, even though that
was not within his requirements? Will a PC card as a signal
generator be accurate to thousandths of a hertz? Will a
Lissajous figure be able to be accurately interpreted to
say 700.003 Hz? To 700.03 Hz? To 700.3 Hz?
All within the "very cheap" and "very trivial" parameters?
A frequency counter is not an option and so is not really
worth mentioning. At that end of the spectrum one would
measure period, rather than frequency, anyway. Getting
accuracy down to a Hertz and decimals is trivial and cheap
using a computer-synthesised frequency reference and
comparing it to the unknown, however. A Lissajous display is
a good visual way of matching a signal generator (in phase
as well as frequency) to an unknown. It is particularly good
if the signal is noisy.
The graphic purely shows when the reference signal is very,
very closely matched to the unknown in frequency and phase
- the numbers come from the synthesised signal generator.
Allowing the figure to rotate from a circle to a diagonal
line and then adjusting the reference to hold it to that can
show changes in phase as small as 5 degrees every 10
seconds, without any problem at all - equivalent to an error
< 0.01 Hz.
Once the unknown signal has been brought in and quantised by
the sound card, everything else is done in software,
including the generation of the Lissajous figure. Whilst
working in a Windows multi-tasking interrupt driven system
would be problematic for this measurement, if it has to be
real-time, a DOS-environment program, using the main system
clock, would be more than capable of maintaining a
resolution at the thousandths of a Hertz level in a few
The problem is not in measuring an input signal of ~1Hz. It
is in measuring an lf signal to an accuracy <1Hz. Using a
system which displays the difference from a reference works
very well for this.
As stated, there is no need to use the sound card as a
signal generator, so its accuracy is irrelevant. The
accuracy would be determined by the accuracy of the computer
The Lissajous figure shows the frequency difference (even
better, it shows the phase difference) - so 0.3Hz in 700 Hz
is absolutely no problem - 0.03Hz wouldn't be a problem,
The whole point of a Lissajous figure is that no
measurements are taken from it (usually) - the accuracy of a
result is almost totally dependent on the accuracy,
precision and calibration of the reference signal. The
reference signal is adjusted to match the unknown's
fundamental or harmonic and then the signal generator
frequesncy is read off.
We are talking at cross purposes, here, regarding counters..
I said: "Run of the mill frequency counters won't do it"
and you disagreed. To cover the possibility that you may have
thought a frequency counter would do it, I asked you to show
one. I take it that it is not an issue - that we agree that a run of the
mill frequency counter won't do it.
So, what free PC program - or cheap commercial program - do
you have in mind? What additional hardware is needed? What is
the accuracy spec of the setup? I have always assumed that a PC
sound card produces a *fairly* accurate representation of the tone
in either direction, but further assumed that it would not be necessarily
accurate to decimals of a Hertz. So you're telling me that a sound
card does A/D (and D/A?) to accuracy equivalent to thousandths of a
Hertz or better?
I further thought that you had the following in mind:
produce an audio tone in the sound card and stuff it into the H
or V scope input, and stuff the signal he is interested in into
the other. I now understand you do not have that in mind,
you are apparently thinking of a PC oscilloscope.. So my
original posting about the Lissajous was also cross
purposes with what you are talking about.
I'll learn something here. I've heard of PC oscilloscope programs,
but I haven't heard too much good about them. Also, I didn't know
they included the ability to do Lissajous figures. And I'm eager
to hear about the accuracy specs and how they are determined.
OK, I should have chopped your reference to frequency
counters. From my words I thought it was pretty obvious that
I was disagreeing with the "trivial and cheap bit", whilst
proposing how to do it trivially and cheaply.
Sorry, I never even thought twice about using a frequency
counter. It was so obviously inappropriate. I deliberately
never mentioned one and always mentioned something that
I gave the reference to the software package I was proposing
in my first post. No extra hardware is needed. The accuracy
of measurement of the signal fundamental frequency is
determined by the accuracy of the PC master clock (see
below). It doesn't use the sound card frequency synthesiser
directly - only its A/D and D/A. The Windows Sound API
produces the digital data stream in real-time and only uses
the D/A of the sound card but with timing from the PC
software. Your assumptions of the capabilities of the
frequency synthesiser in a sound card are misplaced - most,
but not all, sound cards are crystal controlled to better
than this tolerance but this is irrelevant to this problem.
Some (strangely, particularly the cheap ones) use the PC
master clock as reference.
True, the process does introduce amplitude error and
quantisation noise. However, timing and hence frequency is
purely determined by crystal controlled clocks - in this
case the PC master clock. The accuracy of a sound card's A/D
or D/A in terms of frequency, when being used directly under
PC control, is not a function of the card but of the PC itself.
That will certainly work. It is perefectly valid but the OP
asked for a program.
I now understand you do not have that in mind,
This will also work and is what the reference I posted does.
It matters not if the PC is used as the scope or an external
one is used, in this particular instance. The theory is
identical to the method mentioned above, but just uses the
PC as a scope as well as as a generator.
Have a look at the reference I posted with my first post.
Using a PC as a scope is generally a bad idea - but you can
use them at audio frequencies with some success. Some do
Lissajous - some do not - the reference I posted was to one
Accuracy is a different matter. If absolute amplitude
accuracy matters, forget it. Calibration will wander faster
than a teenage boy's hands in a cinema.
The one thing that they can get right is time-dependent
measurements - eg relative phase and frequency.
So how is frequency and phase accuracy determined? The
absolute resolution on a Windows machine is one
ten-thousandth of a millisecond (0.0000001 seconds). Its
absolute accuracy is very roughly better than 100 parts per
million - although its stability is typically better than 50
parts per million. Although Windows can report time in
hectonanoseconds, it is more usual to use 1mSec slices -
each of which will typically be repeatable to 0.1uSec and
accurate to 0.2uSec.
I've enjoyed reading all of this. I don't know the PC sound card
and learned from you that it uses the PC clock. I did look at the software
you mentioned, but dismissed it based on what I have heard in general about
PC 'scopes. You verified that, but also pointed out more detail which I
did not know: "The one thing that they can get right is time-dependent
measurements - eg relative phase and frequency. " That is something
I did not know - I assumed, from what I have read, that PC 'scopes
were/are a fun toy, but not particularly useful. Put another way, my
thinking was that my Tek 475 was *always* better than a PC scope
for any scope function. From what you say, that's not true. And,
from what you said, I now have "un-dismissed" that software. I
might even download and play with it.
But back to the issue. What I still don't know, and don't know
how to find out, is the accuracy specification for measurements
delivered by the software. From the original post it seemed that
the only way to deliver what was required was with instrumentation
with a traceable standard. You can't get known *exact* without
that. But set that aside. The closest I came in searching was in
finding a package whose stated measurement accuracy was down
to 2/3 of a Hertz. The question isn't so much whether the software
will display so many decimal places, it is how accurate will it be.
Did you use it (or find a spec on it for accuracy)? If you've used
it, your feel for how accurate it is is good enough for me.
They generally have their own clocks for signal synthesis.
But you don't have to use these clocks.
A software-generated lf , say 1Hz, signal from a
bog-standard PC can be expected to have a frequency accurate
to better than 0.002 Hz. Its harmonic content is a different
In this case I was/am proposing using a Lissajou figure so
that the OP won't be using the PC to measure the incoming
signal's frequency. The OP will adjust the software
generated signal to match the incoming signal in frequency
and phase. IMHO, that works very well when the input signal
(and the reference) has harmonic content or noise and/or a
dc offset. Then the OP reads the frequency of the software
generated signal - which will be accurate to decimal
fractions of a Hz, as required.
This technique avoids trying to measure the frequency of the
incoming signal itself - which is very difficult, as you
mentioned. Other techniques, such as measuring the period
orf very many cycles of the signal and taking an average,
take much longer and use much more expensive kit. It
certainly doesn't produce results in real time. The
refrerence signal for a Lissajous figure can be continuously
altered in frequency and even phase to match the input signal.
You can use a PC to measure period - accurate to 0.2uSec per
mSec. However, the problem comes in determining the trigger
points at the beginning and end of the period. But it will
beat your analogue scope - for audio frequencies and below.
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.