DIGITAL GUITAR AUTO-TUNER PROJECT

Just so you know, using an FFT for this purpose is going to lead to huge disappointment. It's not the way to go.

- The frequency resolution will be too poor, because obviously you can only use a very limited number of points in this application.

- You will face having to decide what peak to choose when analysing the resulting FFT. This is not so obvious as you will notice there are nasty transients.

Reply to
Guillaume
Loading thread data ...

Dumbass,

He's only an asshole in his own wet dreams. He isn't smart enough to be a real asshole.

Ignore him. He's almost as stupid as Sloman.

Have a great day, Pup

Reply to
Precious Pup

I am reading "Musical Acoustics" by Donald Hall, and he has a graph on page 108 that charts Hz against "JND" (which stands for "Just Noticable Difference".) Within the frequency range of open strings on a guitar, 1 Hz appears to be 'noticable' for between 60 and 90 dB. For quieter sounds, it goes up to 3 or 4 Hz. This is for pure sine waves.

Thus, sadly, 2 Hz probably isn't going to be good enough. The maximum error should probably be 1/2 Hz, as Walter says.

--
Regards,
  Bob Monsen
Reply to
Bob Monsen

Pet subject of mine as I used to have a pipe organ I built. I could tell when the tuning was not good but I was not good enough to tune it by ear. 2 Hz would be horrible, 1/2 Hz poor. The target was to get to .02 Hz and tune with a strobe display. An array of 16 LEDs is used from a 16 bit latch which 'freezes' the phase of a clock running 512 times the desired pitch. The '0' crossing is the clock pulse to the latch driving the 4-16 decoder. When you're on pitch, the LED pattern doesn't move, just like a turntable strobe. Generating the scale is tough since the ratio note-note is 12th root of 2. In '94 I used a 16 bit counter chain which is OK even when used in the range of 32000 to 64000 but would likely be better with digital synthesis. The tuner was MIDI in and out with its own keyboard so I could plug it between the console and pipework. 'Playing' the tuner turned on the correct pipe to match the note selection for the strobe. Worked pretty slick. GG

Reply to
Glenn Gundlach

this is the exact reason why im still "hunting" the elusive precise algorithm on how to do this project the correct way. almost every project done( atleast those i see on the web) do not consider the harmonics that would surely cause trouble... i saw some samples though that used an FFT, IIR and all those stuff but i am yet to learn how to do all of those in assembly language. i did a project using those functions in matlab but its an included function in the library. so its quite a degree more difficult this time to do all the FFT, FIR, and IIR "hand written" on assembly.

but then again i must check in advance if these functions can be handled efficiently by the microcontroller in the first place...

anyway, thanks for all the suggestions, links, ideas and everything... these are all big help....

-carlo david

PS. i had to change my account in google cause my hotmail account was flooded...

Reply to
dhaevhid

Is this really true?

I know if you excite a string (or any mechanical resonance) to vibrate on an overtone, that the overtone is not exactly a harmonic of the fundamental mode, just like a quartz crystal.

But in this case the string is vibrating on the fundamental frequency and I would think that nay harmonics generated harmonics would be exact. If what you say is true, then you should be able to hear a beat note with only ONE string. The beat note would be between the true harmonics of the fundamental and the overtones. I don't think it works that way. Anybody know for sure?

Mark

Reply to
Mark

You do know that +2 Hz on the low E string (84'ish Hz) gets you halfway to F.

Reply to
Ralph Barone

Listen to a guitar string! Or better, a bass string, because they're thicker. New strings aren't so bad, but as they get older they get worse; that "out of tune with itself-ness" is one of the things that causes one to need new strings. The grooves that frets chew into strings also make the string sound out of tune with itself.

A guitar/bass string is not quite a perfect resonant system, because of its finite thickness, particularly at the witness points. The "length" of the string is effectively not the same at all frequencies.

I wouldn't swear I'm right about the underlying theory; but the end result is that a string definitely does audibly beat against itself.

There are also other problems - e.g., plucking a string hard tends to pull it sharp at first. The producer Jack Endino mentioned some of these issues in an interesting article a couple years back (maybe in TapeOp?) about the challenge of properly tuning a guitar; basically, his feeling is you have to tune for a particular song and playing style.

Reply to
Walter Harley

well, from all of the documents ive read so far, the guitar string vibrates at its fundamental frequency and also have harmonics that are multiples of 1/12th root of 2 that's (2^(1/12))... this is the first time that someone told me that the othet components of the guitar signal signal is not actually harmonics...

hmmm... another idea to take note...

carlo david dizon

Reply to
dhaevhid

Yup. But pipe organ is easy (depending on the pipe type), as its output is quite close to sine wave. Reed pipes are more difficult, but probably not as bad as the sound from string instruments.

Nononononnononoooooo! If you tune it to the "even-tempered" scale, the result is very bad-tempered. All the fifths are bad, all the thirds are bad.

And here we come to the point where a custom-made tuning tool would be useful. It is quite easy to go and buy a simple one which just shows the pitch on a scale. However, I'd like to have one which can be taught different temperaments.

There are some such instruments available, but they tend to be rather bulky, eat up a lot of batteries, and cost a lot. On the other hand, it should not be difficult to use different tempera- ments once a reliable frequency meter has been made.

---

There are a few challenges which have to be addressed. Here is my list:

- accuracy down to 1 cent (1/100 of a half note, around 0.6 permille of the frequency, i.e. 0.24 Hz @ 415 Hz)

- fast response (preferably in the 100s of milliseconds), because slow response makes it difficult to tune plucked instruments (rapidly changing pitch)

- freely adjustable a', at least from 390 Hz to 465 Hz

- custom temperations

- good response over four octaves (lowest string of a violone is at around 35 Hz, the highest string of a violin at 625 Hz)

I know this is not a trivial problem. Using FFT might be a solution. On the other hand, a sliding sampling window or some other trickery should be used, and there might be some better algorithms. In any case the first problem is to have a coarse idea of the basic tone and get rid of the harmonics. After that some time-domain algorithms might be good enough.

The good thing is that the relative accuracy requirement (1 cent) can be relaxed a lot in the low frequencies.

If someone comes up with a robust, fast, and relatively simple algorithm, that would be nice. Even nicer if the algorithm is simple enough to be realized with a few hundred kIPS, but OTOH MIPS are not so expensive after all.

- Ville (viola da gamba player)

-- Ville Voipio, Dr.Tech., M.Sc. (EE)

Reply to
Ville Voipio

I read in sci.electronics.design that dhaevhid wrote (in ) about 'DIGITAL GUITAR AUTO-TUNER PROJECT', on Sun, 24 Apr 2005:

Thos are the frequencies of the well-tempered scale, not harmonics. Harmonics are 2 times frequency, 3 times, 4 times etc.

I think this is a subject that you don't need to go into very much. It seems to me that a wholly digital tuner is rather difficult, and I would look at a hybrid design - using digital to get a series of stable frequencies (as in 'top octave generator' for organs), and then analogue methods for comparing the string frequency with the reference. A Lissajou display is a very good way of adjusting one frequency to be very near indeed to another.

--
Regards, John Woodgate, OOO - Own Opinions Only.
There are two sides to every question, except
'What is a Moebius strip?'
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Reply to
John Woodgate

Only if you use an FFT naively.

Incorrect. For single pitch detection, one can use as many points as the signal-to-noise ratio will allow.

Given a sufficient signal-to-noise ratio, one can always interpolate more points between FFT frequency bins (using a windowed-Sync, not a linear interpolation of course), and/or zero-pad the samples for a longer FFT with as many points as you want. There are also other methods, depending on the amount of memory and CPU cycles available.

One does have to determine which local maxima are nearest (or near multiples of) the pitch of interest, but there are several methods to help with this (autocorrelation, cepstral, template pattern matching or even back-propogation neural net techniques).

Not sure what you mean here. You do need to make sure your FFT output looks like it might represent a musical note of interest, and not just background noise between notes.

IMHO. YMMV.

--
Ron Nicholson   rhn AT nicholson DOT com   http://www.nicholson.com/rhn/ 
#include         // only my own opinions, etc.
Reply to
Ronald H. Nicholson Jr.
["Followup-To:" header set to sci.electronics.design.] On Mon, 25 Apr 2005 07:42:38 +0100, John Woodgate wrote in Msg.

Many years ago the magazine "Elektor" featured a very simple and clever design: An oscillator/counter (probably a 4017) stepped through a row of LEDs, but a LED would only turn on when the input signal had a zero crossing at the same time. Given an appropriate oscillator frequency, the right tuning of the string would be indicated by a standing light, whereas a deviation in frequency would cause the light to "wander" to one side or another.

Cheap, simple, and stage-proof. When I read the article I regretted that my hearing was perfect.

--Daniel

Reply to
Daniel Haude

i guess i have to correct myself for few mistakes;

  1. for the accuracy, that will be +/-2cents maximum. +/-1cent must be nice.. not +/-2hz. 2. for the harmonics, im wrong about the 12th root of two, that is the even tempered scale. the other components found in the guitar signal are supposed to be the harmonics factor of 2, 4, 6, 8 belongs to the higher octaves.

here comes another newbie question:

does anyone have an exact idea how to safely "count" the fundamental freq with all of these harmonics on the considerations?

Reply to
dhaevhid

High order lowpass?

Reply to
Aleksandar Kovacevic

If indeed the FFT's resolution is poor, that can have two reasons:

1) the FFT was done badly, or on insufficient input 2) the uncertainty principle on waves applies

If a correctly done FT fails to deliver the necessary frequency resolution on the given data, then no other technique is going to work. The fundamental problem is not the FT, it's the data: the frequencies found in a given data sample are *undefined* beyond a certain accuracy.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

This phenomenon has been well-studied for pianos where precise tuning is much more important. It is called "inharmonicity", and it is due to the stiffness of the strings. The overtones are theoretically pure harmonics only for an infinitely thin string with zero stiffness, where the restoring force is totally due to the tension in the string. When part of the restoring is force is due to stiffness in addition to tension, then higher overtones will be higher in pitch than pure multiples because higher overtones involve more bending than lower overtones. A typical overtone series might be:

1.000 (fundamental) 2.003 (second partial) 3.008 (third partial) 4.015 (fourth partial) 5.024 (fifth partial) 6.035 (sixth partial) ...etc.

The effect may be less on guitars than on pianos because the length to thickness ratio is not as bad on a guitar. But it is still enough of an effect to be considered in the design of a tuner.

-Robert Scott Ypsilanti, Michigan

Reply to
Robert Scott

I read in sci.electronics.design that dhaevhid wrote (in ) about 'DIGITAL GUITAR AUTO-TUNER PROJECT', on Mon, 25 Apr 2005:

2,3,4,5,6,7... Not only even-order.

If your input signals do not cover as much as an octave, you band-pass filter them before you FFT them. That gets rid of the harmonics.

--
Regards, John Woodgate, OOO - Own Opinions Only.
There are two sides to every question, except
'What is a Moebius strip?'
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Reply to
John Woodgate

I've read (most of) the answers here and they've gone for the first things I'd try, so it's out-of-the-box time [*]. What about an optical interrupter (or reflection) at the center (maxima) of the string feeding a microcontroller's timer?

[*] ...or was that off-the wall time ;-)
--
  Keith
Reply to
Keith Williams

Keep in mind that many guitar players tune their open strings to the harmonics rather than to the frets.

This doubles (or quadruples, in the case of the B-string) the apparant beat frequency.

Reply to
Charles Krug

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.