I need to classify whether a product is passing or failing based on a noise check. I have 100 labeled "good" product and 100 "bad" product. For each, I recorded the sound for 3 seconds and each chunk is (n=1024), and my sampling rate is 20480 for a frequency resolution of 20Hz. I averaged the FFT magnitudes across the frames/chunks for each recording to cut down on variance.
I tried to use KNN classifier based on the FFT magnitude, treating each bin as a dimension and using the Euclidean distance across around 500 bins (I'm only interested in frequency up to 10000Hz). The plan is to calculated the closest 10 neighbor for each product and only "pass" a product is x number out of the 10 neighbors are passing.
Unfortunately using KNN directly on FFT did not perform too great. I suspect this is due to the high number of dimensions. For instance, even if two products sound similar, but one has a high magnitude at ,say, 5000Hz, and another one has a high magnitude at 5020Hz, the distance calculation would be high even though the difference is probably imperceptible.
So I want to decrease the frequency resolution by taking the average of multiple bins. For example, I may form a bin at 1000Hz by taking the average of the magnitudes at 960, 980, 1000, 1020, and 1040 Hz. The next bin at 1100Hz would be the average of 1060, 1080, 1100, 1120,1140Hz, and so on.
Is this a valid approach? (I heard they do this step for some speech recognition applications)
Another approach is to create a handful of my own features such as the mean of the magnitudes, standard deviation of the magnitudes and do KNN on those.