Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Making a Guitar Tuner with HTML5 (bergknoff.com)
55 points by jbergknoff on Nov 3, 2014 | hide | past | favorite | 5 comments


Pretty cool, but a Fourier transform is overkill! Many commercial hand-held tuners use a cool trick that works exceptionally well: zero-crossing.

While far less accurate than your implementation, it can still help nail the note (I've written an implementation in awk before... disgusting, but worked!). Simply look at the raw data, and see when it crosses over from negative to positive (or vice-versa). Count the number of crossings in some interval, and now you have the frequency. Usually a little input fuzzing is required, but it works exceptionally well.

Regardless, nice job.


True, and cool (I hadn't heard of zero-crossing before, thanks!) but an FFT gives you the ability to do interesting things like chord recognition.

I may have to play around with the code here and see if I can get it to pick out multiple notes being played simultaneously, and maybe get it to measure how fast I can do chord changes (like Justin Sandercoe's "1 minute changes" practice method[1]).

[1]: http://justinguitar.com/en/BC-115-1MinuteChanges.php


This seems like it's vulnerable to noisy signals creating spurious zero-crossings. If you have some high-amplitude harmonics, isn't it possible for them to create several crossings in a few samples as the wave for the fundamental tone is near zero?


If you are interested in guitars/music and HTML5, I wrote a transcribing tool (looper, slow downer, etc) that runs in a browser and uses the Audio APIs. Wasn't sure if it would be possible, but was able to do quite a bit:

http://www.tunetranscriber.com/


Pretty cool. Do you have source or any writeup of your techniques for the kind of phase vocoding you are doing?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: