Z
Z
Zupand2022-02-06 21:37:41
visual studio
Zupand, 2022-02-06 21:37:41

How to connect the Vosk-api library?

I can't connect Vosk-api libraries. There are no examples with the c++ language on the Internet. There is no .Lib file. For layout. Therefore, the link2019 error link to an external symbol is not allowed in the main function. Help skin in the installation guide or tell me where to find the lib file.

Link to the repository on github - https://github.com/alphacep/vosk-api

Also my code

#include <vosk_api.h>
#include <stdio.h>

int main() {
    FILE *wavin;
    char buf[3200];
    int nread, final;

    VoskModel *model = vosk_model_new("model");
    VoskRecognizer *recognizer = vosk_recognizer_new(model, 16000.0);

    wavin = fopen("test.wav", "rb");
    fseek(wavin, 44, SEEK_SET);
    while (!feof(wavin)) {
         nread = fread(buf, 1, sizeof(buf), wavin);
         final = vosk_recognizer_accept_waveform(recognizer, buf, nread);
         if (final) {
             printf("%s\n", vosk_recognizer_result(recognizer));
         } else {
             printf("%s\n", vosk_recognizer_partial_result(recognizer));
         }
    }
    printf("%s\n", vosk_recognizer_final_result(recognizer));

    vosk_recognizer_free(recognizer);
    vosk_model_free(model);
    fclose(wavin);
    return 0;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nshmyrev, 2022-03-04
@nshmyrev

Lib file can be made from header and dll:
https://stackoverflow.com/questions/9360280/how-to...
Also discussed here:
https://github.com/alphacep/vosk-api/issues/821

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question