[Speex-dev] Voice activity detection

Evgueni Tsygankov eugenet at rusmex.com
Sun Feb 17 15:05:19 PST 2008

Thanks for your reply. I changed my code to:

if (speex_preprocess_run(preprocess_state, shortPointer) == 1)
	speex_encode_int(enc_state, shortPointer, &enc_bits);

In the mobile version of the software, compiled against the mobile build of Speech, I get 1 and 0 based on whether the speech is detected. In the version of the software compiled against the Win32 version of Speex, speex_preprocess_run always returns 0. If I remove the IF statement, then I get voice transmission, so the mic is working. Is it something to do with VAD sensitivity?


Evgueni Tsygankov

-----Original Message-----
From: Jean-Marc Valin [mailto:jean-marc.valin at usherbrooke.ca] 
Sent: Friday, February 15, 2008 6:16 AM
To: Evgueni Tsygankov
Cc: speex-dev at xiph.org
Subject: Re: [Speex-dev] Voice activity detection

Just use the return value of speex_preprocess_run()



Evgueni Tsygankov a écrit :
> This must be a simple issue, but I cannot figure it out.
> I want to use VAD, but I don't know how to check if the actual frame has
> voice in it or not.
> So, in my code, I do:
> int tmp = 1;
> speex_preprocess_ctl(preprocess_state, SPEEX_PREPROCESS_SET_VAD, &tmp);
> speex_preprocess_ctl(preprocess_state, SPEEX_PREPROCESS_SET_DENOISE,
> &tmp);
> then later, for each frame
> speex_preprocess_run(preprocess_state, shortPointer);
> but how do I know if the frame contained voice? I tried 
> if (preprocess_state->was_voice == 1)
> {
> 	...Do voice present code...
> }
> But the compiler complains that was_voice is not defined, which, I
> assume, comes from the fact that preprocess_state is declared in
> speech_preprocess.h as struct SpeexPreprocessState_;
> How do I check the preprocessor for the presence of voice in a frame? 
> Thanks,
> Evgueni
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev

More information about the Speex-dev mailing list