-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HasSpeech is always true #6
Comments
WebRTC doesn't work with WAV files directly -- it only works with raw audio. So while your codec looks good, the WAV file is going to include some metadata about that audio that WebRTC doesn't understand. You'll need to send it the audio within the WAV container by either:
Here's some untested sample code that should get you started with the latter approach: using var vad = new WebRtcVad();
using var audio = new WaveFileReader(wavAudio);
var fmt = audio.WaveFormat;
var frameBytes = FrameLength.Is20ms * fmt.SampleRate / 1000 * fmt.Channels * fmt.BitsPerSample / 8;
var audioData = new byte[frameBytes];
while (true)
{
if (await audio.ReadAsync(audioData.AsMemory()) != audioData.Length)
break;
var hasSpeech = vad.HasSpeech(audioData);
} Good luck! |
I'll try out the raw file today. Sounds like this will definitely solve it. Thank you! |
how to pass an array of float32 format to it? |
You'll need to convert your 32-bit IEEE floats to Linear 16-bit PCM. NAudio can do this if you use .NET, otherwise it looks like you might be able to adapt someone's manual conversion code. |
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
The text was updated successfully, but these errors were encountered: