Skip to main content


If you are using a Hotmail or Outlook email address, please change it now, as Microsoft is rejecting all email from our service outright.
Topic: Using Opus 1.3.1 for VAD (Read 7897 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Using Opus 1.3.1 for VAD


I need to perform VAD for this service I am working on and my plan is to use Opus 1.3.1 to provide it. As far as a I can tell, the only way to do that is to opus_encode the audio and then check if the number of output bytes is less than 2.

Code: [Select]
unsigned char output_frame[4000];
int bytes;
if ((bytes = opus_encode(encoder_.get(), frame, 80, output_frame, 4000)) < 2) {
    return false;
return true;

The audio here is 8khz mono channel audio with 16 bit depth.

My trouble is when I run this function on all 0s, it still encodes to 5 bytes. If I run

Code: [Select]
opus_encoder_ctl(encoder_.get(), OPUS_GET_IN_DTX(&result));

The result is false even though the input is all 0s.

1). What am I doing wrong here? Shouldn't all 0s trigger DTX?
2). Is there a simpler way I can just invoke the VAD without also having to encode the audio and then throw the result away?



Re: Using Opus 1.3.1 for VAD

Reply #1
Have you set DTX on?

SimplePortal 1.0.0 RC1 © 2008-2020