Solved: FFT for guitar tuner on EVK1104

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello! I'm a new member!

 

So, I have an EVK1104 with AT32UC3A3256S microcontroller. I must build a guitar tuner with that, so I need to do a FFT into microcontroller to get fundamental frequency. The microphone that I use is MAX9814.

Guitar note has this frequency range: 0-1000Hz. I want to get foundamental frequency with 1 Hz resolution (maybe I should use 4096 samples). 

 

There is any library that can help me? Or anyone can give me any advice?

Last Edited: Sat. Mar 25, 2017 - 01:10 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sabruri1 wrote:
Guitar note has this frequency range: 0-1000Hz

Of-course not. If you want to detect 0 Hz you will have to wait for an eternity. Literally. (And I'd be amazed if you could have the microphone pick up, and the firmware to detect, low single digit frequencies (a few Hz).

 

The low B0 on a five-string bass guitar is something like 30 Hz. The lowest frequency on an ordinary six-string guitar (the E2, sixth string open) is about 82 Hz.

 

The high E string (first string open, a k a E4, is roughly 329 Hz. 12th fret of that (i.e. the E5) is (of-course) the double or about 659 Hz. Assuming your guitar goes to 22nd fret then that will be a D6 or 1175 Hz. It just might be interesting to check the tuning there, e.g. for purposes of adjusting the intonation of the guitar - but then you'd likely want sub 1 Hz resolution and accuracy.

 

All this assuming "standard tuning". I quoted all those notes and frequencies from here: https://www.seventhstring.com/re... , and hope I got everything right..

 

Speaking of accuracy, I see no mention of it at all in your post. Since you formulated yourself "must build a guitar tuner" I'm sort of assuming that you "must" do this as a school assignment. If so, then pick up some extra points by not only discussing resolution but also accuracy in your hand in report. :-) (I.e./e.g. you can display frequencies with "1 Hz significance" all you like, but it won't be much good if all measurements are actually off by 5 %... The "off by" is the (in-)accuracy.)

 

Apart from this, I'm sorry I'm not an AT32 user, so can't give much insight on the actual implementation. But I do play the guitar (sloppily ;-) ) and tune up two or three guitars most every evening. Any decent guitar player who knows the "quirks" of his instrument(s) (all instruments have them "quirks") can tune all strings to a fraction of a Hz given he's got one string (e.g. fifth, or A2) is tuned right (i.e. to 110 Hz). Interference is the key (pun intended!) to managing that. If you want more discussions of guitar tuning practices to go into a discussion in your report then just ask!

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Wed. Mar 22, 2017 - 08:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:

 

Of-course not. If you want to detect 0 Hz you will have to wait for an eternity. Literally. (And I'd be amazed if you could have the microphone pick up, and the firmware to detect, low single digit frequencies (a few Hz).

Yes, you are right! I can restrict Hz range into: 30Hz - 1175Hz.

 

JohanEkdahl wrote:

Speaking of accuracy, I see no mention of it at all in your post. Since you formulated yourself "must build a guitar tuner" I'm sort of assuming that you "must" do this as a school assignment. If so, then pick up some extra points by not only discussing resolution but also accuracy in your hand in report. :-) (I.e./e.g. you can display frequencies with "1 Hz significance" all you like, but it won't be much good if all measurements are actually off by 5 %... The "off by" is the (in-)accuracy.)

It's a university project. I do not get high accuracy. Tuner accuracy is not the exam's target.

@JohanEkdahl thanks for all your details.

 

So, I still need to know how to get fundamental frequency into 30 - 1175 Hz range from microphone (MAX9814). Someone can help me ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Suppose you know about FFT, windowing, etc before you attempt your implementation?

 

In terms of uC libraries, I know (I used) a fixed-point fft implementation for avr-gcc that may be portable on your controller (not an AT32 user either). I am in transit now and can't provide the link but google can help you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The MAX9814 is NOT a microphone.....it is a microphone pre-amp.

Jim

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sabruri1 wrote:
It's a university project.

So the University expects you to do it - yourself.

 

So, I still need to know how to get fundamental frequency into 30 - 1175 Hz range from microphone (MAX9814). Someone can help me ?

Surely, that is a fundamental part of the exercise that you need to do - yourself ?

 

You need to get down to your university library and start reading-up about the FFT and how to implement it. This is not new; it is well covered in The Literature.

Of course, there is also plenty of information available online these days ...

 

eg, http://www.dspguide.com/

 

If you really can't do this, then you should be speaking to your tutors - urgently.

Bluffing the test is not going to help you - it will just leave you further behind as the course progresses.

 

 

 I must build a guitar tuner with that, so I need to do a FFT

No, you don't need an FFT.

 

A typical guitar has only 6 strings; so there are only 6 frequencies you actually need to detect - aren't there ... ?

 

Try googling for old projects where this was done either without any microcontroller at all, or with something basic like an 8051 where an FFT might not have been practical ...

 

The microphone that I use is MAX9814

That's not a microphone - that's just an amplifier!

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

If you only need freq of the tone with most energy then just count peaks.

 

(next step would be a auto correlation near that freq. )

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparrow2 wrote:

If you only need freq of the tone with most energy then just count peaks.

 

(next step would be a auto correlation near that freq. )

Thank you for your suggestion. I solved