Electronic Guitar Tuners

formatting link

I didn't get the question until now. By auto-correlation you mean a sliding correlation so that each result is with a different delta in time. No, I think that has comparable computation to a DFT and the advantage of the DFT is that it can be done over a subset of the full frequency range rather than always having to calculate the full range like an FFT.

However, to find the frequency of interest a broader auto-corr or xFT would need to be performed initially. Then a detailed analysis could be done to hone in on the exact frequency.

I'm also intrigued by some of the "stroboscopic" methods, but I haven't looked at how to implement them yet.

My current thinking is that no matter what method I go with, it needs to be very high "performance", meaning highly accurate and reasonably fast. I believe the market is not large for this particular device. So better to go Cadillac and charge a price premium than to try to find a spot in a crowded, high volume market.

So that means, will an auto-corr approach do a good job of resolving a fraction of a cent for a tuner in less than say the two or three seconds a note will sustain? I would have to consider just how accurate the auto-corr might be.

Rick

Reply to
rickman
Loading thread data ...

yup. i call that "delta" the "lag".

you can compute the autocorrelation with a subset of lags. you don't need to do it for every possible integer lag, but only the lags of interest.

yah.

then i'm pretty sure that autocorrelation or AMDF or ASDF is what you'll want to do.

pretty accurate, but *any* pitch detector *can* possibly have octave errors (it's what can happen if you have inaudible sub-harmonics). then you need to program the thing to have a little bit of common sense to avoid some of the dumber octave errors. i think that looking for energy at the frequency of the fundamental is a dumb octave error because there could be more energy at the 2nd harmonic or the 3rd harmonic and your alg might think that either of those is the fundamental frequency.

does your DSP or whatever processor have conditional branch instructions? you don't need to compute the whole autocorrelation (all of the lags) for each and every sample. in fact, you might just compute

*one* lag per sample and have a couple of special states where you set up the autocorrelation and where you process or scan the results of the autocorrelation to come up with a period length. and you can do some interpolation-like stuff to get the period to a precision of a fraction of a sample period. i.e. look for the peak where it falls between two integer lags. it's not hard.

that's all you get for free.

--
r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."
 Click to see the full signature
Reply to
robert bristow-johnson

Yes, that is what I meant, the auto-corr and the DFT are the same in that regard, but the FFT - not so much.

I'll have to lookup the AMDF and ASDF.

Yes, but the harmonics will fall at certain ratios which won't match if you pick a harmonic in place of the fundamental. Also, won't the energy of the harmonics add into the lag for the fundamental?

I get the interpolation thing, that's fairly obvious, but I don't understand the comment about the one lag per sample and special states. The problem with interpolation is that it can only interpolate to some extent. Essentially this is a method of measuring the period of signals. The sample rate has to be fast enough to provide a decent resolution. There are also the same issues found in the FFT of energy splattering across bins. I suppose a window function can help with that.

Thanks,

Rick

Reply to
rickman

Average Magnitude/Squared Difference Function

then you'll be sweeping some kinda comb on the data.

it's a programming issue. some samples you will compute *one* point of the autocorrelation. and when you have filled up the table, you need to examine what you computed, that is a special mode of your program and you won't have time to compute a new point of autocorrelation and you won't need to. it's a manner to distribute the work over many different sampling periods to reduce the worst-case timing cost.

yup and that period may very well not be an integer number of samples.

--
r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."
 Click to see the full signature
Reply to
robert bristow-johnson

Yes, I found the name easily enough. I need to read up on how to calculate it and why it is different from the auto-corr.

Not sure what you mean by this. I am suggesting that with an auto-correllation the harmonics of the frequency that corresponds to the lag will also be added into the sum. Any frequency with an integer multiple of its period being approximately equal to the lag should accumulate. So when the lag is tuned to the fundamental of a note, all harmonics should add into the result giving this the largest peak, no?

Sorry, I'm not following this. For each input sample, I need to accumulate a product for each of the lags being computed. I don't think I will have a timing issue, if by timing you mean enough processor speed. The device I am considering has 144 CPUs with >200 MIPS each.

Yes, but interpolation can only improve the resolution by some factor, what, 5x? 10x? Noise and processing resolution will limit this at some point.

It seems the frequency resolution of the human ear is not as good as I thought. One source says it is 1 Hz below 500 Hz and about 0.6% above

1000 Hz. They don't mention the range 500 to 1000 Hz, but I assume it is within this range. That should be entirely workable without interpolation if the sample rate is high enough and I am pretty sure I can do that.

Rick

Reply to
rickman

I've run some simulations on using auto-correlation to detect the pitch and it has some very desirable properties. It seems to be relatively immune from noise and out of band signals. It is not as sensitive to the exact frequency as I would like, but likely this is more a fundamental limitation of measuring frequency with a short time sequence.

I am going to try the measurement over a longer multiple of the frequency of interest. I should be able to reason out the result, but it is easier to just give it a try...

Rick

Reply to
rickman

I did some simulations looking at a tone in the presence of harmonics and in the presence of noise using the autocorr, the ASDF and the AMDF with the sample rate far above what is required by the Nyquist criterion. The autocorr gives big fat peaks that are hard to pinpoint. The ASDF has somewhat fat valleys but is not much disturbed by the noise. The AMDF without noise has very sharp valleys which are very easy to pinpoint, but with noise these get rounded. But with even high amplitude noise the valleys of the AMDF are easier to distinguish than the ASDF.

I read somewhere here that another poster preferred the ASDF in the presence of noise. The values of the AMDF are more affected by the noise than in the ASDF, but it looks to me like pinpointing the proper peak (or is it anti-peak?) value is easier with the AMDF even with the noise. I still have some other testing to do.

Meanwhile I expect my customer to pick the low cost spread and not do the tuner option at all. But who knows? Customers can be strange beasts.

Rick

Reply to
rickman

Didn't see the beginning of the thread, but if anyone wants a Guitar tuner you can get the PolyTune from TC Electronics.

formatting link

It should retail below $100.

There is also an iPhone app at $3.99

formatting link

TC Electronics is a professional audio company. (U2 is/was one of their customers) so it is not a cheap gizmo. They have applied for a lot of patents on this technology, which you would want to avoid.

BR Ulf Samuelsson

Reply to
Ulf Samuelsson

there is no doubt of that.

the use of autocorrelation for pitch detection has existed long before TC existed as a company. lotsa prior art. but i believe, especially when they were involved with IVL and Helicon, that they developed some patented pitch detection techniques.

if anyone is experimenting with pitch detection, either with AMDF, ASDF, autocorrelation (which is ASDF turned upside down), feature detection and matching, zero-crossing (which i don't recommend), etc. there is little danger of stepping on someone else's *valid* patent.

--
r b-j                  rbj@audioimagination.com 

"Imagination is more important than knowledge."
 Click to see the full signature
Reply to
robert bristow-johnson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.