vosk-api Documentation

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node

14,680 stars Jupyter Notebook 1 file ยท ~1,874 tokens #android#asr#deep-learning#deep-neural-networks#deepspeech#google-speech-to-text#ios#kaldi
RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy vosk-api on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name vosk-api --restart always alphacep/vosk-api:latest

File: README.md

Vosk Speech Recognition Toolkit

Vosk is an offline open source speech recognition toolkit. It enables
speech recognition for 20+ languages and dialects - English, Indian
English, German, French, Spanish, Portuguese, Chinese, Russian, Turkish,
Vietnamese, Italian, Dutch, Catalan, Arabic, Greek, Farsi, Filipino,
Ukrainian, Kazakh, Swedish, Japanese, Esperanto, Hindi, Czech, Polish.
More to come.

Vosk models are small (50 Mb) but provide continuous large vocabulary
transcription, zero-latency response with streaming API, reconfigurable
vocabulary and speaker identification.

Speech recognition bindings implemented for various programming languages
like Python, Java, Node.JS, C#, C++, Rust, Go and others.

Vosk supplies speech recognition for chatbots, smart home appliances,
virtual assistants. It can also create subtitles for movies,
transcription for lectures and interviews.

Vosk scales from small devices like Raspberry Pi or Android smartphone to
big clusters.

Documentation

For installation instructions, examples and documentation visit Vosk
Website
.


File: csharp/README.md

This is a nuget-based wrapper for libvosk library

See demo folder for example how to use the library. You can simply run
"dotnet run" to run the demo. Make sure you unpacked the model and the
test file.

See the nuget folder for the sources of the wrapper. Run build.sh to
build nuget package.

Note we only support win64 and linux64 for now. No support for win32
since it is a little bit painful to load the libraries depending on
architecture. In theory we can add OSX some time or even Android.


File: go/example/README.md

To try this package do the following steps:

On Linux (we download library and set LD_LIBRARY_PATH)

text
git clone https://github.com/alphacep/vosk-api
cd vosk-api/go/example
wget https://github.com/alphacep/vosk-api/releases/download/v0.3.45/vosk-linux-x86_64-0.3.45.zip
unzip vosk-linux-x86_64-0.3.45.zip
wget https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip
unzip vosk-model-small-en-us-0.15.zip
mv vosk-model-small-en-us-0.15 model
cp ../../python/example/test.wav .
VOSK_PATH=`pwd`/vosk-linux-x86_64-0.3.45 LD_LIBRARY_PATH=$VOSK_PATH CGO_CPPFLAGS="-I $VOSK_PATH" CGO_LDFLAGS="-L $VOSK_PATH" go run . -f test.wav

for Windows (we place DLLs in current folder where linker finds them):

text
git clone https://github.com/alphacep/vosk-api
cd vosk-api/go/example
wget https://github.com/alphacep/vosk-api/releases/download/v0.3.45/vosk-linux-x86_64-0.3.45.zip
unzip vosk-linux-x86_64-0.3.45.zip
cp vosk-linux-x86_64-0.3.45/*.dll .
cp vosk-linux-x86_64-0.3.45/*.h .
wget https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip
unzip vosk-model-small-en-us-0.15.zip
mv vosk-model-small-en-us-0.15 model
cp ../../python/example/test.wav .
VOSK_PATH=`pwd` LD_LIBRARY_PATH=$VOSK_PATH CGO_CPPFLAGS="-I $VOSK_PATH" CGO_LDFLAGS="-L $VOSK_PATH -lvosk -lpthread -dl" go run . -f test.wav

File: kotlin/README.md

vosk-api-kotlin

The vosk-api wrapped using Kotlin Multiplatform.

Usage

The following are ways to use this wrapper.

JVM

For Java & Android targets.

kotlin
dependencoes {
    val voskVersion = "0.4.0-alpha0"

    // Generic
    implementation("com.alphacephei:vosk-api-kotlin:$voskVersion")

    // Android
    implementation("com.alphacephei:vosk-api-kotlin-android:$voskVersion")
}

Building

To build this project, follow the following steps.

  1. Install libvosk.
    This can be done from source (parent monorepo)
    or downloaded.
  2. Download a Vosk model to use.
  • It is suggested to use a small model to speed up tests.
  1. Once both are downloaded and placed into a proper location (hopefully following UNIX specification).
    Set the following environment variables:
  • VOSK_MODEL to the path of the model.
  • VOSK_PATH to the path of libvosk.
    These are used by the various tests to operate.
  1. Now that the required steps are complete, one can run ./gradlew build.

Kotlin/Native

Currently, the native target is disabled due to a lack of vosk-api packaging on platforms.
Further worsened by the fact that installing the vosk-api on Linux systems is a chore.

First, either install from source
or download and install into the proper unix directories as expected in
libvosk.def.

To enable development for Kotlin/Native, do either for the following.

  • Add NATIVE_EXPERIMENT=true to your environment.
  • Go into build.gradle.kts & find enableNative & set the right side to true.

Afterwards, when syncing the project, the native source sets will become available to work on.
It is suggested to run cinteropLibvoskNative to generate the Kotlin C bindings to work with.

Future

  • Possibly target Kotlin/JS
  • Possibly target Kotlin/Objective-C (?)

File: nodejs/README.md

This is an FFI-NAPI wrapper for the Vosk library.

Usage

Bindings mostly follow Vosk interface, some methods are not yet fully implemented.

See demo folder for
details.

About

Vosk is an offline open source speech recognition toolkit. It enables
speech recognition for 20+ languages and dialects - English, Indian
English, German, French, Spanish, Portuguese, Chinese, Russian, Turkish,
Vietnamese, Italian, Dutch, Catalan, Arabic, Greek, Farsi, Filipino,
Ukrainian, Kazakh, Swedish, Japanese, Esperanto, Hindi, Czech, Polish.
More to come.

Vosk models are small (50 Mb) but provide continuous large vocabulary
transcription, zero-latency response with streaming API, reconfigurable
vocabulary and speaker identification.

Vosk supplies speech recognition for chatbots, smart home appliances,
virtual assistants. It can also create subtitles for movies,
transcription for lectures and interviews.

Vosk scales from small devices like Raspberry Pi or Android smartphone to
big clusters.

Documentation

For installation instructions, examples and documentation visit Vosk
Website
. See also our project on
Github.


File: python/README.md

This is a Python module for Vosk.

Vosk is an offline open source speech recognition toolkit. It enables
speech recognition for 20+ languages and dialects - English, Indian
English, German, French, Spanish, Portuguese, Chinese, Russian, Turkish,
Vietnamese, Italian, Dutch, Catalan, Arabic, Greek, Farsi, Filipino,
Ukrainian, Kazakh, Swedish, Japanese, Esperanto, Hindi, Czech, Polish.
More to come.

Vosk models are small (50 Mb) but provide continuous large vocabulary
transcription, zero-latency response with streaming API, reconfigurable
vocabulary and speaker identification.

Vosk supplies speech recognition for chatbots, smart home appliances,
virtual assistants. It can also create subtitles for movies,
transcription for lectures and interviews.

Vosk scales from small devices like Raspberry Pi or Android smartphone to
big clusters.

Documentation

For installation instructions, examples and documentation visit Vosk
Website
. See also our project on
Github.