DIGITAL GUITAR AUTO-TUNER PROJECT

...

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
Loading thread data ...

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

...

Ah, come now! Even in the best of guitars, the frets are located by "the rule of nineteen". Pianos and fretted instruments have tuning similarities (although you can't "bend" a piano).

Do you know Roland Hutchinson? (He was quite taken with the selectable temperaments on my recently acquired Yamaha "piano".)

Jerry

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

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

I don't think you will see it: the enharmonic amplitude is too small and they run through at different rates. Maybe if you use bass cut to reduce the fundamental it will be visible.

--
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 read in sci.electronics.design that Jerry Avins wrote (in ) about 'DIGITAL GUITAR AUTO-TUNER PROJECT', on Mon, 25 Apr 2005:

Can this feature be retrofitted to s.e.d contributors?

--
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 know that you are right, but it puzzles me. It seems to me that the common bridge should enforce harmonicity, just as it locks together the slightly detuned piano doubles and triplets. (Exact tuning makes the note loud ans it's decay rapid. Slight detuning softens the attack, hoarding energy for better sustain. The same is true of a 12-string guitar.)

It is a real challenge to build 5.0000 and 5.0001 MHz oscillators on the same chassis, even with crystals, that will actually beat. The evaporation thickness/rate monitor I wrote of in another thread worked around that problem.

Jerry

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

Marching harmonics are not likely to affect any one period by more than ten percent. If you count the total time for 100 periods, the accuracy becomes one part per thousand. To that, you must add the uncertainty of your time measurement, up to perhaps two ticks on the counter.

In a way analogous to a bell's "clang tone", the harmonic structure changes rapidly when the string is first plucked. Don't measure the first part of the note, and don't try for such a long measurement that the note fades away.

Jerry

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

Re: inharmonicity in strings:

Yes, there is in fact a "lock-in" phenomenon that happens through the interaction at the bridge. But typical amounts of inharmonicity, at least in piano strings, exceeds the lock-in range. Inharmonicity is easily measured by precisely measuring the pitch of individual overtones and comparing them. Another way to verify inharmonicity is to observe the signal on a scope. If the overtones were all locked to the fundamental, the overall shape of the signal would be constant, just decaying in amplitude. Perhaps the individual overtones would decay at different rates. But it would be quite clear that the overtones are frequency locked. But that is not in fact what you will observe. If the scope is triggered by the fundamental, then the overtones will appear as higher-frequency components that are "riding to the left" as compared to the fundamental.

-Robert Scott Ypsilanti, Michigan

Reply to
Robert Scott

You are incorrect, because you didn't think of the real-world problem here.

You can't use as many points as you want, for two reasons: the guitar string signal doesn't last forever, and as I said, it evolves in various "nasty" (well, to the engineer) ways while it lasts.

To increase resolution, you have to increase the number of points, hence the duration of the take. As I just said, this is not a real option. Besides, even if the played open string lasted long enough (which is not that obvious), the longer the time it takes for your tuner to give you the pitch, the more useless your tuner is (just try to tune a guitar with a tuner that needs 5 seconds to give you the current pitch, good luck).

Padding with zeros to artificially increase the number of points without having to analyze a longer take will quickly prove not very useful either in this particular application because of all the transients.

But don't take my word for it. Just do it. I did and I claim it's not the way to go. You'll see. If you can come up with a usable and accurate guitar tuner using an FFT only, please show us. I'll be glad to hear from it. Meanwhile, no commercial tuner that I know of uses an FFT.

Reply to
Guillaume

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

How do they work, then? (The answer 'Very well' is not acceptable.)

--
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

This is where multiple methods come in handy. A low-pass filter and zero-cross detection gets you in the ballpark, then your method (looks like a PLL using a phase-accummulator DCO) gets good accuracy.

For a look at the competition (well not quite, you need a PC to run it on), here's a good tuner program with everything:

formatting link

-----

formatting link

Reply to
Ben Bradley

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

snipped-for-privacy@dont-mail-me.com (Robert Scott) wrote in news:426ce85a.8724019 @news.provide.net:

I observed this many years ago using an FFT analyzer. As I recall (25 years ago),I also noticed that the G string on my guitar was actually vibrating at two different frequencies that straddled the desired center. I think this is why I never think that a B created at the 4th fret of the G string ever sounds perfectly in tune with the B string. I attributed this to the fact that the G is a wirewound string and therefore has significant thickness.

As was mentioned earlier, the choice of temperment is always a compromise. The frets contribute to temperment as well, I wonder what the best compromise tuning is for a guitar given all the various parameters.

You might start with the fact that a guitar is usually tuned E A D G B E.

I suppose a smart tuner could have open tuning capabity as well. Open tunings might be easier to consider if you want fifths and thirds etc to be perfect (1.5 vs 1.4983 & 1.25 vs 1.25992)

Piano tuners fight the temperment issue all the time. If I have a piano tuner come out and tune my piano to even temperment (unfortunately, the typical situation), I hate the sound. I used to have a guy who tuned most of the pianos for the recording studios in my area tune my piano. When he did the tuning, my piano sung!

Too bad I can't actually play very well.....

Unfortunately (fortunuately) I have a pretty good sense of pitch.

--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
Reply to
Al Clark

Somebody called me that once, and I thought it was rather cute, so started using it, for the times that I'm consciously being a wacko. :-)

As to who's the asshole, ISTR responding to a "please do this for me" type of post, and I made a casual offer to do the work, for a price. Lessee...

Oh, yeah. Here it is:

----excerpt---- From: snipped-for-privacy@hotmail.com (dhaevhid) ... its actually a qualifying sample project for my first job. ... im tryin to do it all by myself but its taking me so long to understand the concepts...

----end excerpt---

So, in other words, you're not qualified for the job, so you want us to help you cheat your way in. _That's_ what the asshole part was for.

--
Cheers!
Rich
 ------
 "There was an old man of Tagore
  Whose tool was a yard long or more,
   So he wore the damn thing
   In a surgical sling
  To keep it from wiping the floor."
Reply to
Rich The Newsgroup Wacko

Most of them use a simple design. You can find one on CircuitCellar, and that's pretty much how this is done in commercial products.

It consists of an input stage, which is basically a good low-pass filter filtering everything above the maximum fundamental frequency it's supposed to deal with (probably something like 1000 or 1500 Hz), usually a 2nd order active filter. Then it's followed by a comparator set with some hysteresis, which can also be an amplifier based on some AOP with a lot of gain - so that the AOP clips the signal, which is easily transformed into a digital signal with a schmitt trigger, for instance. This circuit basically extracts the fundamental frequency of the input signal with a reasonable usability.

Then the comparator's output can be dealt with in various ways. Some can be rather crude (just measuring the frequency of the resulting digital signal), some are more clever, and I like the one that's used in the CircuitCellar project. The comparator's output goes to a digital I/O pin of a microcontroller, of course set as an input. The algorithm used consists of measuring the delay between two consecutive raising edges - but this is not all. To make sure the measure is meaningful, several consecutive measures are compared, and only if we get a few (like 10, for instance) consecutive measures that are close enough to one another, do we consider this is the fundamental frequency. The latter is computed from the period, using for instance an average of the 10 given "meaningful" past measures.

By comparing the frequency with a few preset ranges, the tuner can even guess what the string it is you're trying to tune, and automatically give you how far away you are from the nominal frequency for this string.

As to how the above input stage, based on a filter and a saturation stage, translates in the frequency domain (in other words, how the spectrum of the original signal is transformed), I'll let you think about it. It resembles, but is not quite like simply looking at zero-crossings - because the saturation on the signal actually tends to "ignore" the harmonics, whereas simple zero-crossing analysis has to deal with them.

All in all, this is a working approach and it's much simpler than any sophisticated DSP analysis you might try.

Reply to
Guillaume

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

Well, yes, that's precisely why equal temperament was invented.

--
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

My needle-based digital tuner reacts quite quickly. I can see the note appear sharp as it is first plucked, then watch it settle in to a fairly constant reading for several seconds until it fades away. In this case, it is up to me as the user to ignore that initial transient reading and wait for the steady state. Doing so is quite natural.

Reply to
Jon Harris

A digital filter is quite simple. It is just a bunch of multiplies and divides on each sample. However if you have to do the multiply in software, you'll never make it fast enough, at least with the tiny microcontrollers that are out there. A PIC 16 series requires between

500 and 700 instructions for a multiply. Using a Zilog Z8 Encore, or a PIC 18 clocked at 20MHz, you could probably do 6 simultaneous IIR filters using the same A/D channel (there are web pages that will write the 'C' code for you, given the frequencies and passband width. Translating that into asm is trivial.)

By filtering a 10Hz passband for each string, it's possible you will be able to do the zero crossing thing, and then both select the string, and give guidance on which way to tune as relative error. However, that is a guess, since I haven't tried it.

--
Regards,
  Bob Monsen
Reply to
Bob Monsen

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

Loose wrapping.

--
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 read in sci.electronics.design that Guillaume wrote (in ) about 'DIGITAL GUITAR AUTO-TUNER PROJECT', on Mon, 25 Apr 2005:

Thanks for the explanation. It gels with my thinking on the subject.

Indeed: a very cogent point.

You said it! Digits are NOT always the answer. Particularly FFT.

--
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

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.