alphacep / alphacep/vosk-api

Incorrect recognition with wrong data format

Offen
#1,075 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Jupyter Notebook
Sterne
15.1k
Forks
1.8k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

This is my first time using Vosk, so please bear with me. I'm using .NET Core 6 with C# 10, Vosk 0.3.38 and the "vosk-model-en-us-0.22-lgraph" model (renamed the folder to "model"). The model appears to be loading fine, with no errors or warnings showing up.

The attached audio file says: *static* flexible rubber soles *static*

However, Vosk always outputs:
```
{
"partial" : ""
}
{
"partial" : ""
}
. . .
{
"partial" : "the"
}
{
"partial" : "the"
}
. . .
{
"result" : [{
"conf" : 1.000000,
"end" : 4.859122,
"start" : 0.140574,
"word" : "the"
}],
"text" : "the"
}
{
"partial" : ""
}
{
"partial" : ""
}
. . .
{
"result" : [{
"conf" : 1.000000,
"end" : 11.854490,
"start" : 7.685259,
"word" : "the"
}],
"text" : "the"
}
```

The output is the same even when using different audio files. I have also tried using the "vosk-model-small-en-us-0.15" model, but the output was mostly the same.

Here is the code for speech recognition:
```
void SpeechRec(string modelPath, string audioPath)
{
//Convert mp3 to wav
using (Mp3FileReader mp3 = new Mp3FileReader(audioPath))
{
using (WaveStream pcm = WaveFormatConversionStream.CreatePcmStream(mp3))
{
WaveFileWriter.CreateWaveFile(audioPath, pcm);
}
}

//Create Vosk STT
Model model = new Model(modelPath);
VoskRecognizer rec = new VoskRecognizer(model, 16000);
rec.SetMaxAlternatives(0);
rec.SetWords(true);

using (Stream source = File.OpenRead(audioPath))
{
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0)
{
if (rec.AcceptWaveform(buffer, bytesRead))
{
Console.WriteLine(rec.Result());
}
else
{
Console.WriteLine(rec.PartialResult());
}
}
}
Console.WriteLine(rec.FinalResult());
}
```

To use the audio file, change the file extension from .mp4 to .mp3.

https://user-images.githubusercontent.com/49353890/179464547-3ee3a00e-2941-4443-b2a2-14165b21354f.mp4

Vosk console/debug messages.

[output.txt](https://github.com/alphacep/vosk-api/files/9130229/output.txt)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.