Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect human voice from audio file input

I am trying to implement automatic voice recording functionality, similar to the Talking Tom app. I use the following code to read input from the audio recorder and analyse the buffer :

 float totalAbsValue = 0.0f;
 short sample = 0;

 numberOfReadBytes = audioRecorder.read( audioBuffer, 0, bufferSizeInBytes);

 // Analyze Sound.
 for( int i=0; i<bufferSizeInBytes; i+=2 )
 {
     sample = (short)( (audioBuffer[i]) | audioBuffer[i + 1] << 8 );
     totalAbsValue += Math.abs( sample ) / (numberOfReadBytes/2);
 }

 // Analyze temp buffer.
 tempFloatBuffer[tempIndex%3] = totalAbsValue;
 float temp = 0.0f; 

 for( int i=0; i<3; ++i )
 temp += tempFloatBuffer[i];

Now I am able to detect voice input coming from the audio recorder and I can analyse the audio buffer.

The buffer is converted to an float value and if it increases by a certain amount, it is assumed that there is some sound in the background and recording is started. But the problem is that the app starts recording all background noise, including fan/AC duct sounds.

Can anyone help me with analysing the buffer to detect human voice only? Or are there any other alternative ways to detect human voice from the audio recorder input?

Thanks in advance,

like image 632
Timson Avatar asked Aug 21 '13 10:08

Timson


People also ask

How can we detect human voice in audio?

For voice detect, try ftt algorithm. For noise, try speex library. Show activity on this post. The more Filtering the better less noise More recognition, but be wary in filtering because it can also remove the Voice together with the noise.

Is there an app that can identify voices?

Braina is a personal A.I. that you can use to communicate with your computer through your Android or IOS device. The program can convert your voice into text for any website or software program, including word processing ones.


3 Answers

Voice detection is not that simple. There are several algorithms, some of them are published, for example GSM VAD. Several open source VAD libraries are available, some of them are discussed here

like image 52
msh Avatar answered Oct 02 '22 20:10

msh


For voice detect, try ftt algorithm.

For noise, try speex library.

like image 23
afpro Avatar answered Oct 02 '22 21:10

afpro


If you want to have a clean recording you can

  1. Filter noise from the voice, you can use FFT for that and apply filters such as lowpass, highpass and bandpass filters Filtering using FFT and Filters

2.After Filtration the noise would be decreased and you can use Voice recognition API's

API's

The more Filtering the better less noise More recognition, but be wary in filtering because it can also remove the Voice together with the noise.

Also read more about FFt

Fast Fourier Transform of Human Voice

Hope This Helps :)

like image 25
Albert Laure Avatar answered Oct 02 '22 20:10

Albert Laure