Skip to content

HasSpeech is always true #6

@hunterwebapps

Description

@hunterwebapps

Hello,

I've tried everything that I can think of. I have a very simple implementation here. Really hoping to get some advice. This is going to be a life saver library for my project.

I'm passing in a 16khz, mono channel wav file, codec used was pcm_s16le.

I'm on version 1.3.1, testing on Windows 10 Build 19042

using var vad = new WebRtcVad()
{
    OperatingMode = OperatingMode.Aggressive,
    FrameLength = FrameLength.Is20ms,
    SampleRate = SampleRate.Is16kHz,
};

// I tried with * 1 instead of * 2 here as well, since the wav I'm using is mono channel
var frameSize = (int)vad.SampleRate / 1000 * 2 * (int)vad.FrameLength;

var audioBytes = await File.ReadAllBytesAsync("birds.wav");

for (var i = 0; i < audioBytes.Length - frameSize; i += frameSize)
{
    var hasSpeech = vad.HasSpeech(audioBytes.Skip(i).Take(frameSize).ToArray());

    if (hasSpeech)
    {
        // inspecting with breakpoint here, always hits on first pass, when there is no speech.
        break;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions