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.
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
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...
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?
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.
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.
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...
i guess i have to correct myself for few mistakes;
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?
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.
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.
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
["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.
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.
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?
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.
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.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
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.
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.