I recorded sounds with a microphone and I try to distinguish them in my Java program. The frequency works quite good, but if I look at the fourier transforms it seems like there should be more features to distinguish sounds. I don´t know very much about signal processing, maybe you can help me. Here is a picture of two fourier transformations.


I know that the frequency is determined by the index of the maximum magnitude (hope that is the right term). In the first fourier transform curve, its at 100, in the second at 12 (frequencies are 1102.5 and 132.3). But the two sounds look so differently when they are transformed, what else could I use to distinguish them?

  • $\begingroup$ What are the signals that you're trying to distinguish? $\endgroup$
    – endolith
    Sep 24, 2012 at 15:44

1 Answer 1


Two remarks:

  • I am assuming you are plotting the real (or imaginary) part of the Fourier transform. It is much more common to work with the magnitude or squared magnitude (power spectrum).
  • The peak in the spectrum is a very poor measure of fundamental frequency (pitch). Take a piano note at 440 Hz, apply a notch filter to it to remove the 440 Hz component. Even if the peak in the spectrum is now at 880 Hz (roughly), it will still sound like a 440 Hz note - yes, at a frequency totally absent from the spectrum!

To answer your question, timbre is the property that distinguish sounds of same loudness and pitch. However, it is not an unidimensional characteristic with a well-defined unit. What you can extract are features such that things that "sound similar" have similar features.

Common features used for characterizing timbre include:

  • Spectral centroid, which indicate how "dark" or "bright" a sound will be perceived, spectral spread (a measure of bandwidth, tonality vs noisiness), and moments of order 3 and 4 (kurtosis and skewness).

  • Energy in each Bark band, or ratio of energies between consecutive Bark bands.

  • Any low-dimensionality descriptors of spectral envelope, including autoregressive coefficients, or Mel-Frequency cepstral coefficients.

See section 6 of this document.

  • 1
    $\begingroup$ The perceived pitch of the piano note will be slightly sharp compared to the fundamental, since inharmonicity of plucked strings means the harmonics are slightly sharp from true integer multiples. $\endgroup$
    – endolith
    Sep 24, 2012 at 15:48
  • $\begingroup$ Is the magnitude spectrum calculated as sqrt(Re^2 + Im^2) and the power spectrum is Re^2 + Im^2 (for each index)? Because this thread confuses me since it says something different: (second answer) stackoverflow.com/questions/5010261/… $\endgroup$
    – Puckl
    Sep 24, 2012 at 17:55
  • $\begingroup$ yes. In practice it rarely matter whether you use one or the other, because you often have to take the logarithm of the result, so it only scales everything by a multiplicative constant. $\endgroup$ Sep 24, 2012 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.