finding Audio Level
-
Hi All, Can anyone know how to find the audio level from the microphone? Basically I want to splitup the audio level from no audio(if the person is silent) to very high level... How can i get the frequency?? Thanks, Poornima
-
Hi All, Can anyone know how to find the audio level from the microphone? Basically I want to splitup the audio level from no audio(if the person is silent) to very high level... How can i get the frequency?? Thanks, Poornima
Hello Poornima, You could also try the FFTW subroutine library. The functions are easy to use and competitive with vendor tuned code. :) http://www.fftw.org/
-
Hello Poornima, You could also try the FFTW subroutine library. The functions are easy to use and competitive with vendor tuned code. :) http://www.fftw.org/
-
Hi All, Can anyone know how to find the audio level from the microphone? Basically I want to splitup the audio level from no audio(if the person is silent) to very high level... How can i get the frequency?? Thanks, Poornima
What do you want - audio level (volume) or audio tone (frequency) or both? FFT will give you frequency and a volume-related value at each frequency. If you want only volume, you could calculate an average peak-to-peak value for some period as an estimate.
-
What do you want - audio level (volume) or audio tone (frequency) or both? FFT will give you frequency and a volume-related value at each frequency. If you want only volume, you could calculate an average peak-to-peak value for some period as an estimate.
-
Hey, I dont understand your question...:( Frequncy and volume are interelated rite... I mean frequency directly proportional to audio ??? do clear me If i am wrong.
Volume is how loud the sound is (a soft sound, like someone wispering, has low volume, a loud sound, like a fighter aircraft engine, has high volume.) Frequency is the pitch or tone of a sound - a double bass plays notes which have a low frequency (a low cycle per second or Herz value) while a penny whistle plays notes which have a high frequency. The frequency and the volume of a sound are not really related, although human perception does come into it. The normal PC software volume control only controls volume, it does not affect frequency. From your original question, I think you were trying to decide whether a sound was soft or loud, i.e. volume. My point was that you should be able to determine this in a simpler way than doing an FFT.
-
Hey, I dont understand your question...:( Frequncy and volume are interelated rite... I mean frequency directly proportional to audio ??? do clear me If i am wrong.
Let's say you have a block of audio data from the microphone (you could use the WaveIn functions - see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_waveform_functions.asp[^] .) The data block has a number of characteristics which you specify, such as block length (50 or 100 milliseconds is reasonable), sampling rate (22 kHz should be OK), sample size (8 or 16 bit per sample), stereo or mono (microphone is probably mono.) The general procedure I would follow would be:
Long SumOfSamples = 0
Long SumOfSquaredDifferences = 0// First determine the average sound level
// I don't know whether audio data is represented as unsigned or signed values -
// you may have to look at the values in a data block to decide what to use!
For count = 1 to numberSamplesInBlock
SumOfSamples += soundSample[count]AverageSoundLevel = SumOfSamples / numberSamplesInBlock
// Now work out the average of how far every sample is from the average level
For count = 1 to numberSamplesInBlock
ThisSampleDifference = sample[count] - AverageSoundLevel
SumOfSquaredDifferences += ThisSampleDifference * ThisSampleDifferenceAverageDifference = SquareRoot(SumOfSquaredDifferences) / numberSamplesInBlock
// Now decide whether the data block is loud or soft or in-between
If AverageDifference < softSoundThreshold
Display "The Sound Is Soft"
Else if AverageDifference > loudSoundThreshold
Display "The Sound Is Loud"
Else
Display "The Sound Is Between Soft And Loud Limits"// Determine the softSoundThreshold and loudSoundThreshold by recording
// sounds using the microphone and looking at their AverageDifference values