|
 |
On 15-3-2009 5:42, triple_r wrote:
> I know there are better places to ask this, but there's been a fair amount of
> signal processing talk around here in recent history, and everything I google
> comes up with patents and microprocessor talk.
>
> The basic situation is that I want to program a piano tuner (we'll see about
> having the guts to tune the thing). It didn't take more than a couple hours to
> write a c program that takes audio input, FFT's it, and tells you the closest
> pitch. The problem is the frequency resolution. I essentially get the refresh
> rate for resolution, e.g. 10 updates per second -> 10 Hz resolution.
That is not true. Your resolution mainly depends on your sampling
frequency. The only way you can get a resolution of 10 Hz with 10 Hz
updates is by sampling at 1kHz, which is much too low for your
application anyway.
Your resolution can be computed by dividing your sample frequency by the
number of samples.
> This
> resolution won't cut it. G#4 is 415.3 Hz, A4 is 440 Hz, and A#4 is 466.164 Hz,
> so you can see what I'm up against. Here are my ideas:
>
> 1) Zero-pad the data pre-fft. (I'm not sure whether this actually improves the
> quality of the information.)
It might sharpen your peaks as would using a Hamming or Hanning window.
I think I would also use overlapping windows to increase the number of
samples. I.e. if the sampling is more a problem than the computational
power.
>
> 2) Use a feedback loop to control the frequency of a test wave. (I don't know
> what the controller should look like.)
Me neither ;) I actually don't know what you mean.
> 3) FFT. Locate max. Band-pass. Inverse-fft.
You know what frequency you are expecting, so you don't need to locate
your maximum. Then the problem is more easily solved by a filter in the
time domain.
> Count zero-crossings? (Not robust for noisy signals?)
depends on the bandwidth of the filter. Can be very robust. Note that
some instruments have higher amplitude for harmonics than at the
fundamental frequency. There is also no guarantee that you get only 2
zero crossings because of the harmonics. A narrow bandwidth filter will
indeed solve most of these problems. BTW how are you going to count
exactly 93.2328 crossings with your 10 updates per second?
>
> As I said, my lack of knowledge in this area makes it difficult to locate the
> relevant resources. Does anyone know of a feedback loop
Do you want a pure digital solution or an mixed distal/analog or even a
pure analog?
You may want to have a look at phase locked loops, because you can
digitize the voltage that drives the frequency.
> or other more
> sophisticated tools for this purpose?
I think you can buy them, at least I knew them for guitars... Yep, you
can find them by googling. Not as much fun as building one oneself though.
Post a reply to this message
|
 |