Skip to main content


Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Using Opus 1.3.1 for VAD (Read 8971 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?