Results 1 to 2 of 2

Thread: Frequency of sound data

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Frequency of sound data

    Hi, I want to implement a simple application for tuning a guitar. For that I need to know how to extract the frequency of the incoming microphone data. Any hints or suggestions on how to do that?


    Thanks in advance

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Frequency of sound data

    There's no simple way to do this. Pure sine waves are rare in the real world; the sound emitted by a single guitar note is actually a fairly complex composite of many sine waves, although your ear easily picks up the fundamental frequency.

    Basically, you need to run your sampled sound through a Fourier transform. This will convert the time-domain signal recorded by your microphone into a frequency-domain signal, with each individual component sine wave in the original signal represented as a sharp "spike". In general, you would select the spike closest to zero, since this is normally the fundamental, although for some sound emitters (bells, for instance) the situation is more complex and you should find the tallest spike, which may occur farther from zero than others. With proper scaling, the location of the spike corresponds directly to the frequency of that component.

    A good C-based library for performing Fourier transforms is FFTW. It's free, well documented and ought to compile just about anywhere. Note that if you're unfamiliar with the mathematics of signal processing, the documentation may be a somewhat rough climb.

Similar Threads

  1. Replies: 0
    Last Post: 21st January 2010, 14:35
  2. Sound Recorder
    By davejh in forum Qt Programming
    Replies: 3
    Last Post: 20th March 2009, 13:00
  3. Getting sound data from a wave file
    By ko9 in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2007, 11:23
  4. MP3 Sound / OGG Sound Play on GUI
    By patrik08 in forum Newbie
    Replies: 3
    Last Post: 1st September 2006, 19:01
  5. Sound on KDE 3.5
    By jaynewpeng in forum KDE Forum
    Replies: 6
    Last Post: 2nd February 2006, 13:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.