First install dependencies and build the speech recognition toolkit Kaldi, which Vosk is based on.
Get the code, which contains instructions and some scripts:
git clone -b lookahead --single-branch https://github.com/alphacep/kaldi
Note: If you run the command at a different time point, the code could be
too old or too new to be compatible. You can checkout
the revision the
current Rust code is developed for:
d39d716e3429742e35dbb7bc02401f7c7b40b83e
.
Head over to the tools
directory: cd kaldi/tools
,
and prepare some dependencies.
Running make
may just work.
Read the text file INSTALL
for more info.
A library that provides BLAS and LAPACK is needed to perform matrix operations.
ATLAS (Automatically Tuned Linear Algebra Software) provides adequate support of BLAS and LAPACK for Kaldi. It may be available as precompiled packages. For example on Debian:
apt install libatlas-base-dev
Alternative implementation of BLAS and parts of LAPACK.
Run script extras/install_openblas.sh
to download and compile.
Yet another option.
Script: extras/install_mkl.sh
.
Go to kaldi/src
: cd ../src
Configure with mathlib
set to the linear algebra library used:
./configure --mathlib=ATLAS --shared --use-cuda=no
Compile. Various object archive files should be available afterwards (such as nnet3/kaldi-nnet3.a
):
make -j 4
cargo
needs to find Kaldi.
Set the environment variable KALDI_ROOT
to the path of the Kaldi repository.
C++ code of vosk is added as a submodule.
Run git submodule init
and git submodule update
to get the code.
Now cargo build
can be run.