alphacep / alphacep/vosk-api

Incorrect recognition with wrong data format

Aperta
#1,075 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Jupyter Notebook
Stelle
15.1k
Fork
1.8k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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)

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.