alphacep / alphacep/vosk-api

mp4 empty result with c# library

Open
#656 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
15.1k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Hi, trying to run the example code for C# with mp4 and wav files. Just running the example code, for mp4 it's showing empty results and for wav it's not empty but transcript quite far from the actual speech. Wondering what am I missing?

I'm using this model: http://alphacephei.com/vosk/models/vosk-model-en-us-0.20.zip

Please find uploaded mp4, wav files and the resulting transcripts here: https://www.dropbox.com/sh/2ng1nweuqim0e8x/AADtgqmWUGFfktODSzz_Jje8a?dl=0

This is the code I am running:
```
static void Main(string[] args)
{
var model = new Model("model");
const float SAMPLE_RATE = 44100.0f;

DemoBytes(model, "howtospeak_short.mp4", SAMPLE_RATE);

}

public static void DemoBytes(Model model, string speechFilePath, float sampleRate)
{
// Demo byte buffer
VoskRecognizer rec = new VoskRecognizer(model, sampleRate);
rec.SetMaxAlternatives(0);
rec.SetWords(true);
using (Stream source = File.OpenRead(speechFilePath))
{
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0)
{
if (rec.AcceptWaveform(buffer, bytesRead))
{
OutputResults(rec.Result());
}
else
{
OutputResults(rec.PartialResult());
}
}
}
OutputResults(rec.FinalResult());
}

private static void OutputResults(string result)
{
File.AppendAllText("C:\\temp\\transscript.txt", result);
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.