DIGITAL GUITAR AUTO-TUNER PROJECT

The trouble with using zero-crossings is that what you call harmonics are not really harmonics. That is, they are not exact multiples of a fundamental frequency. Since these overtones are not locked to the fundamental, they float through the fundamental waveform, causing time-varying distortion to the zero-crossing point. If you want to use zero-crossings, you must first bandpass filter (either in software or in hardware) for on particular narrow range of frequencies so that the effect of these inharmonic overtones will have mininal effect on the zero-crossing time. Of course you could just sample for a longer time so that the individual errors in zero-crossings would be averaged out. But that would contradict your stated goal of getting a response from the device as soon as possible. Good luck.

-Robert Scott Ypsilanti, Michigan

Reply to
Robert Scott
Loading thread data ...

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

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

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

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

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

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

Reply to
Ralph Barone

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

this is interesting..

I look forward to the next opportunity I have to connect an oscilloscope to a bass (guitar) or a mic'ed piano to observe this phenomenon in the form of the beat note of the off frequency overtone to the fundamental.

thanks

Mark

Reply to
Mark

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.

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
 Click to see the full signature
Reply to
John Woodgate
["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'll bet this varies according to the type of string also. i.e. The lower wound strings will have different harmonic properites than the upper 'piano wire' strings.

Bob

Reply to
Bob Stephens

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

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:
 Click to see the full signature
Reply to
Ville Voipio

You can's emphasize that too strongly. When my job was designing special laboratory equipment (from satellite echo simulators to diffusion furnaces with 1C repeatability at 1800C) the very best way I could serve a client was showing him a page in a catalog.

Jerry

--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply to
Jerry Avins

...

If it's any good, you can also use it to tune an oboe.

Think again. Once you have a squarewave, the time between successive zero crossings in the same direction is the period.

...

Jerry

--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply to
Jerry Avins

At times I've experimented with "open" tuning on my acoustic guitar, such as tuning the strings to form an E major chord. In that context, I can tune it to "just intonation" so the third is low, the fifths a bit high, etc.. Unfretted, it sounds brilliant! However, if I fret some of the strings to play a different chord where, for example, a string that was the third now becomes the fifth, it is horribly out of tune! So while for strumming a single chord, just intonation is great, I have to use a compromise closer to equal-temperament if I want to actually play a song.

Reply to
Jon Harris

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.