Open niccokunzmann opened 4 years ago
Great input, thanks :pray:
@niccokunzmann I've think I understood most of your code (quite well documented, thanks a lot!) and I'm currently trying to port it to the app. I'm unsure though what samples per wave cycle are:
Is it just another word for sample rate or does it mean something completely different?
I'm able to detect 8000Hz, take a look :tada: https://d1o1i.csb.app Testing it with a tone generator app, I get spikes up to 80,000, where as a couple hundreds of Hz less (aka a semitone), I only get peaks of 6,000. With no tone, it's sitting at ~1,000. Pretty neat!
The only thing I now have to figure out is how to change the frequency that I want to detect (which seems to be determined by the samples per wave cycles that I don't understand yet).
A usual sampling rate would be 44khz = 44000 values of microphone positions called "samples". If you want to have a 440 hz tone "a", your samples per wave length is 100. 100*440 = 44000. This means that the sine wave of the 400hz tone will start again after 100 samples.
The reason why I pre-compute the sine wave is that the sin()
command is quite costly.
Could I bring clarity?
There should be several challenges ahead until this works smoothly in the app - overtone, tone disctinction, disctinction of tones from silence, ...
Yup, that makes sense! I'll give it a shot tomorrow. I'm worried about those issues as well, but I hope I can come up with some solutions around them (collecting averages, listening for more than one frequency, user calibration) and well... also implement them. Thanks for your help!
I will be there watching and helping. Once this works, I take my guitar to use the webapp.
I would like to the app recognize the sound I play on the guitar. A lot for reading: http://www.dspguide.com
This is what I worked on: https://github.com/niccokunzmann/positioning_system
Essentially, you multiply the audio signal with a sine and a cosine wave of the note. You sum it up over the time span when you like to recognize it. This results in the square strength of the note. If you use integers, you do not loose precision and the operations do not cost much. You can reply here or write @niccokunzmann to ask me.