in reply to Re: Music and FFT
in thread Music and FFT

There's also another tough issue: what I'm going to hack is a piano music. As piano has rich harmonics even you press only one key, I need to distinguish fundamental frequency from harmonics.
Any clue to do that? Maybe only through my ear and brain?

Replies are listed 'Best First'.
Re^3: Music and FFT
by bart (Canon) on Oct 21, 2010 at 11:15 UTC
    Harmonics always have frequencies that are multiples of the base frequency. So, if in a result you have a lot of frequencies, you can simply ignore those that are multiples of another frequency which is also present, and strong. Note that after FFT, those frequencies will be approximated, and thus, not exact multiples... But if you have enough sample points, the resolution shoul become fine enough.

    Also, a piano has several strings per key, which are tuned in almost the same frequency... which produces the phasing effect you generally hear. The ribbles on strings, especially the lower strings, have a similar effect.

    Start experimenting with it. You'll probably get familiar with the results from the FFT, soon enough. Note that if you edit the values from the FFT data, you can convert it back to sound, and hear if your approximation is close enough.

Re^3: Music and FFT
by BrowserUk (Patriarch) on Oct 21, 2010 at 12:16 UTC
    I need to distinguish fundamental frequency from harmonics. Any clue to do that?

    If you are recording the music you are analysing, yourself. Record directly into a non-lossy format (like.wav) and use as high a sample rate as your software allows. Many recorders can create .wav files with much higher sample rates than the stand 44,100 hz. Some will even allow you to specify any rate you type in, so FFT friendly powers of 2 are possible.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.