VB.NET / C# – Microphone input frequency(db, hz)

15 pts.
Tags:
C#
Programming
Visual Basic .NET
Windows Mobile
Hi, i am looking for a way(code example) to be able to get the microphone input frequency(hertz) almost in real time(timer maybe?) and show it in a label.text. Can be in VB.NET or C#. Functional exemple: I say something in the microphone, the timer do his job and the label show something like "400 hz". This is for an application running under Windows Mobile. Thanks in advance!
ASKED: August 10, 2009  1:17 AM
UPDATED: December 29, 2010  10:23 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

That’s a pretty simplistic description of a complex requirement. Playing a 400 Hz sine wave in front of a microphone for one second is one thing, but if I sing or say “something” into a microphone, you might have a complex, 500 ms waveform that includes a mixture of many changing frequencies and harmonics. How do you pick out the frequency that you plan to measure?

[kccrosser]
There is no short and simple answer here. If you are getting a sound sample from a microphone, and want to determine the fundamental frequency, you will need to use a Fourier Transform. There are many implementations of a Fast Fourier Transform (FFT) available, which is the most common transform in use. Wikipedia has a good article on FFTs, at <a href=”http://en.wikipedia.org/wiki/Fast_Fourier_transform”>http://en.wikipedia.org/wiki/Fast_Fourier_transform</a>. This also has links at the bottom to various FFT code and examples.

A good tutorial, with some nice code samples, of how to capture and convert code is available at <a href=”http://www.relisoft.com/freeware/recorder.html”>http://www.relisoft.com/freeware/recorder.html</a>

In highly simplistic terms, an FFT can take a sound sample and return a list of frequencies with associated “counts” (or magnitudes). The frequency with the highest value is the fundamental frequency of the sample.

There are of course already many devices for tuning musical instruments that display the frequency. Professional guitarists I know use devices like the Intellitouch or Korg clamp-on units that display the fundamental frequency in a small lcd window as they pluck a string. There are also quite a few software applications that sound like they do what you are contemplating – search for “guitar tuner online” to see a bunch.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    I agree. That's a really complex requirement, or maybe we have misunderstood it due to the lack of details.
    65,110 pointsBadges:
    report
  • Armkreuz
    Alright, sorry for the lack of details, ill try to be clearer. I understand the mechanic of sound, and that its not really likely that i'll be able to sustain a 400hz sound by talking, etc... What i'm actually trying to make is a Tuner for musical instruments, but i need to be able to collect a sample of the frequency captured by the microphone every xxx'Milliseconds and display this frequency in a label1.text(just as an exemple) The microphone capture ambiant sound, exemple "a guitar string vibration". P.-S.: Sorry for my english writing, this is not my native language.
    15 pointsBadges:
    report
  • Endy
    Hello,Now I need do the same things(Hi,i am looking for a way(code example) to be able to get the microphone input frequency(hertz) almost in real time(timer maybe?) and show it in a label.text. Can be in VB.NET or C#.) with you.Could you solution it? If you do it ,could send me the project by email. My Email :gmajkun@163.com. Thx very much. ps.Sorry for my english writing, this is not my native language.
    20 pointsBadges:
    report
  • Armkreuz
    [...] http://itknowledgeexchange.techtarget.com/itanswers/vbnet-c-sharp-microphone-input-frequencydb-hz/ About Taylor MurrayMail | More Posts (7)Tagged with: audacity • murraytr • osmerslw • piotromj • source code  Share → (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); Meta [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following