Hacker News new | past | comments | ask | show | jobs | submit login
A Web Audio experiment – detecting piano notes (medium.com/david.gilbertson)
18 points by bubble_boi on Aug 22, 2016 | hide | past | favorite | 6 comments



I’ve thought about making an analogue polyfill for the Web MIDI API using pitch detection of the Web Audio API, ideally polyphonic. But it’s a fair way down my long list of things I’d love to do but will probably never make the time to do.

That the black notes aren’t centred is something I was reminded of when making an SVG keyboard myself a few years back. It’s rather important to comfortable playing.


A nice read and the explanation felt pretty easy to follow. Nice to have such a laid-out type of examination of the approach and whatnot.


Thanks!


Think of the ad synergy you could get with local piano tuners. Our algorithm has detected that you're overdue for a tuning!


Learning question: The next steps would be to take a discrete Fourier transform to help in the frequency detection, yes?


If I was to carry on with it, I would look into using byteFrequencyData rather than timeDomainData. My initial attempts with the frequency data weren't great, but a few people have mentioned it so I'd take another look and see if I just wasn't doing something dumb.

I felt like the most fiddly work would be accurately sampling the sound. E.g. not recording when it was under (or maybe over) a particular volume, ignoring the initial thud of a key (particularly with the phone sitting on the piano), and making it so that the correct 'note' stayed blue as the sound trailed off and got less reliable.




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

Search: