2
votes

I'm currently developing a percussion tutorial program. The program requires that I can determine what drum is being played, to do this I was going to analyse the frequency of the drum recording and see if the frequency is within a given range.

I have been using the Apache math commons implementation for FFT so far (http://commons.apache.org/math/) but my question is, once I preform the FFT, how do I use the array of results to calculate the frequencies contained in the signal?

Note: I have also tried experimenting with using Autocorrelation, but it didn't seem to work to well with sample from a drum kit

Any help or alternative suggestions of how to determine what drum is being hit would be greatly appreciated

Edit: Since writing this I've found a great online lesson on implementing FFT in java for Time/ frequency transformations Spectrum Analysis in Java

2
A recording of a drum will contain audio spectrum content at a whole bunch of frequencies, which will change/evolve over time. So your subject line is a little misleading, as there is no single "frequency".hotpaw2

2 Answers

5
votes

In the area of music information retrieval, people often use a related metric known as the mel-frequency cepstral coefficients (MFCCs).

For any N-sample segment of your signal, take the FFT. Those resulting N samples are transformed into a set of MFCCs containing, say, 12 elements (i.e., coefficients). This 12-element vector is used to classify the instrument, including which drum is used.

To do supervised classification, you can use something like a support vector machine (SVM). LIBSVM is a commonly used library that has Java compatibility (and many other languages). You train the SVM with these MFCCs and their corresponding instrument labels. Then, you test it by feeding a query MFCC vector, and it will tell you which instrument it is.

So the basic procedure, in summary:

  1. Get FFT.
  2. Get MFCCs from FFT.
  3. Train SVM with MFCCs and instrument labels.
  4. Query the SVM with MFCCs of the query signal.

Check for Java packages that do these things. (They must exist. I just don't know them.) Relatively, drum transcription is easier than most other instrument groups, so I am optimistic that this would work.

For further reading, there are a whole bunch of articles on drum transcription.

0
votes

When I made a program using a DFT, I had it create an array of Frequencies and Amplitudes for each frequency. I could then find the largest amplitudes, and compare those to musical notes, getting a good grasp on what was played. If you know the approximate frequency of the drum, you should be able to do that.