gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Tuner

#101292 - falcon!!! - Mon Sep 04, 2006 7:47 am

Would it be possible to do a guitar tuner for ds?
I mean something that hears from the mic the frequency of the sound and display the Hz and the note.

#101295 - melw - Mon Sep 04, 2006 8:42 am

Sure, why not? Record mic input, possibly trim+gate+normalize the sound first, apply FFT and compare with equivalent frequencies - like A to 440Hz etc.

#101296 - spinal_cord - Mon Sep 04, 2006 8:42 am

Should be.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#101297 - falcon!!! - Mon Sep 04, 2006 8:51 am

whould someone do it or explain me how to do it?

#101301 - melw - Mon Sep 04, 2006 9:15 am

falcon!!! wrote:
whould someone do it or explain me how to do it?

Google is your friend... But since I play guitar myself and might find a use for a guitar tuner on DS as well, here's the same reply in more detail:

- For usability, it would be good to have resemblance to normal tuners - i.e. the mic records all the time and analyzes the data on the fly, displaying the results on the screen.
- FFT works better on longer clips, you may want to experiment what works best - for example record for 1 second, then analyze the recorded data and update the screen with the info.
- Gating: Strip all the recorded input that is below certain volume - this is most likely just background noise and not the guitar playing.
- Normalizing: Pump up the volume to 100%, recorded sound might not be using the whole range.
- After processing the input, you need FFT algorithm for finding out the frecuencies - select the loudest frecuency and skip the rest.
- Compare input frequency to guitar string frecuencies:
Code:
E: 83Hz
A: 110Hz
D: 146Hz
G: 202Hz
H: 248Hz
E: 330Hz

It's not rocket science to do this, although doing FFT on the fly might be tasking for the DS cpu... No idea since I've never tried doing one on any other platforms than PC with much more horse power. If you get the FFT working, doing the rest should be trivial.

#101324 - Lick - Mon Sep 04, 2006 12:38 pm

Wow, I really want to code this as well. Seems like a very cool project to learn microphone capturing with.
_________________
http://licklick.wordpress.com

#101328 - headspin - Mon Sep 04, 2006 1:02 pm

Neimod posted a microphone example in this thread.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#101357 - Mota - Mon Sep 04, 2006 6:49 pm

Nice idea, I'd probably use it now and then. It'd be nice if it could recognise any note, not just concert tuning.