aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramanarora_09 <aman.arora9848@gmail.com>2022-07-22 15:58:23 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2022-07-28 13:58:18 +0000
commiteda84d25d819824d641cf89af1e4d61a5e946744 (patch)
tree38f4b7c34a5b91257518bcbcdc6b96d24f0641b2
parentf206eab5753bd9ee2d5b1126c6ec5a18e75cac89 (diff)
meta-offline-voice-agent: Enable layer for offline voice recognition
- This enables offline voice recognition in AGL - Can successfully run vosk API and vosk websocket server Changes: - Create a new layer: meta-offline-voice-recognition - Create recipes for the the Vosk library, API, websocket server and model - Create feature template for the layer (agl-offline-voice-agent) - Add all required packages to IMAGE_INSTALL - ptest enable recipe python3-vosk-api - Few fixes Bug-AGL: SPEC-4497 Change-Id: Icb290ceee22e2c3a51cbd67f7431701795f1201b Signed-off-by: amanarora_09 <aman.arora9848@gmail.com>
-rw-r--r--meta-offline-voice-agent/COPYING.MIT17
-rw-r--r--meta-offline-voice-agent/README46
-rw-r--r--meta-offline-voice-agent/conf/layer.conf18
-rw-r--r--meta-offline-voice-agent/dynamic-layers/meta-agl-demo/recipes-platform/images/agl-demo-platform-voice.bb3
-rw-r--r--meta-offline-voice-agent/recipes-blas/openblas/files/0001-Modify-makefile-for-yocto.patch44
-rw-r--r--meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb61
-rw-r--r--meta-offline-voice-agent/recipes-python/python3-sounddevice/python3-sounddevice_0.4.4.bb20
-rw-r--r--meta-offline-voice-agent/recipes-python/python3-srt/python3-srt_3.5.2.bb16
-rw-r--r--meta-offline-voice-agent/recipes-python/python3-vosk-websocket-server/python3-vosk-websocket-server_git.bb33
-rw-r--r--meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api/0001-Change-library-search-path-to-usr-lib.patch26
-rw-r--r--meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api/run-ptest3
-rw-r--r--meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api_0.3.42.bb48
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Build-fix-for-include-in-makefile.patch25
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Enforce-cross-compilation-under-bitbake.patch23
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Fixes-for-shared-library-compilation.patch95
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/OLD/0001-Build-fix-for-include-in-makefile.patch25
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/OLD/0001-Enforce-cross-compilation-under-bitbake.patch23
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi_git.bb63
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-model-small-en-us/vosk-model-small-en-us_0.15.bb23
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-openfst/files/0001-build-fixes-for-bitbake.patch64
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-openfst/vosk-openfst_1.8.0.bb23
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk-server/vosk-server_git.bb32
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk/vosk/0001-Build-fixes-for-shared-library-under-bitbake.patch74
-rw-r--r--meta-offline-voice-agent/recipes-vosk/vosk/vosk_0.3.42.bb49
-rw-r--r--templates/feature/agl-offline-voice-agent/50_bblayers.conf.inc7
-rw-r--r--templates/feature/agl-offline-voice-agent/50_local.conf.inc14
-rw-r--r--templates/feature/agl-offline-voice-agent/README_feature_agl-offline-voice-agent.md9
27 files changed, 884 insertions, 0 deletions
diff --git a/meta-offline-voice-agent/COPYING.MIT b/meta-offline-voice-agent/COPYING.MIT
new file mode 100644
index 00000000..fb950dc6
--- /dev/null
+++ b/meta-offline-voice-agent/COPYING.MIT
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/meta-offline-voice-agent/README b/meta-offline-voice-agent/README
new file mode 100644
index 00000000..233e0fc9
--- /dev/null
+++ b/meta-offline-voice-agent/README
@@ -0,0 +1,46 @@
+Offline Speech Recognition using Vosk (Kaldi-ASR) : meta-offline-voice-agent
+=========================================================================
+
+meta-offline-voice-agent is the AGL Layer using Vosk API based on Kaldi ASR Toolkit to enable Offline Speech Recognition capabilities for Automotive Grade Linux.
+
+
+WIP
+========
+The layer in its current state contains the Vosk library, and is capable of recognizing speech, as verified from the test scripts contained in https://github.com/alphacep/vosk-api/tree/master/python/example.
+
+### Working features:
+- [vosk-api (python)](https://github.com/alphacep/vosk-api/tree/master/python)
+- [vosk-websocket-server](https://github.com/alphacep/vosk-server/tree/master/websocket)
+
+
+Testing vosk-api on AGL
+======================
+
+### 1. Initializing the build environment:
+
+The `agl-offline-voice-agent` feature needs to be enabled when including aglsetup.sh:
+
+```shell
+$ source meta-agl/scripts/aglsetup.sh -m qemux86-64 -b build-voice-qemux86-64 agl-demo agl-offline-voice-agent ${AGL_META_PYTHON}
+
+$ bitbake agl-demo-platform
+```
+
+### 2. Running the image:
+
+```shell
+$ runqemu tmp/deploy/images/qemux86-64/agl-demo-platform-qemux86-64.qemuboot.conf kvm serialstdio slirp publicvnc audio
+```
+
+### 3. Run the test with ptest-runner:
+
+```shell
+$ ptest-runner python3-vosk-api
+```
+
+### Currently supported targets:
+- QEMU x86-64: Work in progress.
+
+Maintainers:
+- Aman Arora <aman.arora9848@gmail.com>
+
diff --git a/meta-offline-voice-agent/conf/layer.conf b/meta-offline-voice-agent/conf/layer.conf
new file mode 100644
index 00000000..e5dca632
--- /dev/null
+++ b/meta-offline-voice-agent/conf/layer.conf
@@ -0,0 +1,18 @@
+# We have a conf and classes directory, add to BBPATH
+BBPATH .= ":${LAYERDIR}"
+
+# We have recipes-* directories, add to BBFILES
+BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
+ ${LAYERDIR}/recipes-*/*/*.bbappend"
+
+BBFILE_COLLECTIONS += "meta-offline-voice-agent"
+BBFILE_PATTERN_meta-offline-voice-agent = "^${LAYERDIR}/"
+BBFILE_PRIORITY_meta-offline-voice-agent = "65"
+
+LAYERDEPENDS_meta-offline-voice-agent = "core"
+LAYERSERIES_COMPAT_meta-offline-voice-agent = "dunfell kirkstone"
+
+BBFILES_DYNAMIC += " \
+ agldemo:${LAYERDIR}/dynamic-layers/meta-agl-demo/*/*/*.bb \
+ agldemo:${LAYERDIR}/dynamic-layers/meta-agl-demo/*/*/*.bbappend \
+"
diff --git a/meta-offline-voice-agent/dynamic-layers/meta-agl-demo/recipes-platform/images/agl-demo-platform-voice.bb b/meta-offline-voice-agent/dynamic-layers/meta-agl-demo/recipes-platform/images/agl-demo-platform-voice.bb
new file mode 100644
index 00000000..6e39a7f0
--- /dev/null
+++ b/meta-offline-voice-agent/dynamic-layers/meta-agl-demo/recipes-platform/images/agl-demo-platform-voice.bb
@@ -0,0 +1,3 @@
+require recipes-platform/images/agl-ivi-demo-platform.bb
+
+IMAGE_INSTALL:append = "python3-vosk-api vosk vosk-server gcc make cmake autoconf automake gcc-c++ boost-dev" \ No newline at end of file
diff --git a/meta-offline-voice-agent/recipes-blas/openblas/files/0001-Modify-makefile-for-yocto.patch b/meta-offline-voice-agent/recipes-blas/openblas/files/0001-Modify-makefile-for-yocto.patch
new file mode 100644
index 00000000..4adb7939
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-blas/openblas/files/0001-Modify-makefile-for-yocto.patch
@@ -0,0 +1,44 @@
+From bc9476ad859b7e582b89f532f5e84771d6e026d2 Mon Sep 17 00:00:00 2001
+From: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
+Date: Fri, 16 Oct 2020 14:22:38 +0900
+Subject: [PATCH] Modify makefile for yocto
+
+- Modify makefile for yocto make build support
+
+Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
+---
+ Makefile.install | 4 ++--
+ Makefile.system | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.install b/Makefile.install
+index dad869f4..1bfdb94b 100644
+--- a/Makefile.install
++++ b/Makefile.install
+@@ -128,8 +128,8 @@ endif
+
+ #Generating openblas.pc
+ @echo Generating openblas.pc in "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)"
+- @echo 'libdir='$(OPENBLAS_LIBRARY_DIR) > "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc"
+- @echo 'includedir='$(OPENBLAS_INCLUDE_DIR) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc"
++ @echo 'libdir='$(libdir) > "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc"
++ @echo 'includedir='$(includedir) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc"
+ @echo 'openblas_config= USE_64BITINT='$(USE_64BITINT) 'DYNAMIC_ARCH='$(DYNAMIC_ARCH) 'DYNAMIC_OLDER='$(DYNAMIC_OLDER) 'NO_CBLAS='$(NO_CBLAS) 'NO_LAPACK='$(NO_LAPACK) 'NO_LAPACKE='$(NO_LAPACKE) 'NO_AFFINITY='$(NO_AFFINITY) 'USE_OPENMP='$(USE_OPENMP) $(CORE) 'MAX_THREADS='$(NUM_THREADS)>> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc"
+ @echo 'version='$(VERSION) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc"
+ @echo 'extralib='$(EXTRALIB) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc"
+diff --git a/Makefile.system b/Makefile.system
+index 8d78b420..4d1eab68 100644
+--- a/Makefile.system
++++ b/Makefile.system
+@@ -1184,7 +1184,7 @@ endif
+
+ KERNELDIR = $(TOPDIR)/kernel/$(ARCH)
+
+-include $(TOPDIR)/Makefile.$(ARCH)
++# include $(TOPDIR)/Makefile.$(ARCH)
+
+ CCOMMON_OPT += -UASMNAME -UASMFNAME -UNAME -UCNAME -UCHAR_NAME -UCHAR_CNAME
+ CCOMMON_OPT += -DASMNAME=$(FU)$(*F) -DASMFNAME=$(FU)$(*F)$(BU) -DNAME=$(*F)$(BU) -DCNAME=$(*F) -DCHAR_NAME=\"$(*F)$(BU)\" -DCHAR_CNAME=\"$(*F)\"
+--
+2.17.1
+
diff --git a/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb b/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb
new file mode 100644
index 00000000..84e76542
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb
@@ -0,0 +1,61 @@
+DESCRIPTION = "OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version."
+SUMMARY = "OpenBLAS : An optimized BLAS library"
+HOMEPAGE = "http://www.openblas.net/"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=5adf4792c949a00013ce25d476a2abc0"
+
+SRC_URI = "\
+ git://github.com/xianyi/OpenBLAS;protocol=https;branch=develop \
+"
+
+# tag 0.3.20
+SRCREV = "0b678b19dc03f2a999d6e038814c4c50b9640a4e"
+S = "${WORKDIR}/git"
+
+DEPENDS += "libgfortran"
+
+def map_arch(d):
+ import re
+ arch = d.getVar('TARGET_ARCH', True)
+ if re.match('i.86$', arch): return 'ATOM'
+ elif re.match('x86_64$', arch): return 'ATOM'
+ elif re.match('aarch32$', arch): return 'CORTEXA9'
+ elif re.match('aarch64$', arch): return 'ARMV8'
+ return 'CORTEXA15'
+
+def map_bits(d):
+ import re
+ arch = d.getVar('TARGET_ARCH', True)
+ if re.match('i.86$', arch): return 32
+ elif re.match('x86_64$', arch): return 64
+ elif re.match('aarch32$', arch): return 32
+ elif re.match('aarch64$', arch): return 64
+ return 32
+
+EXTRA_OEMAKE = "\
+ BUILD_WITHOUT_LAPACK=OFF \
+ HOSTCC=${BUILD_CC} \
+ CROSS=1 \
+ CROSS_SUFFIX=${TARGET_PREFIX} \
+ BINARY=${@map_bits(d)} \
+ TARGET=${@map_arch(d)} \
+ OPENBLAS_LIBRARY_DIR=${D}${libdir} \
+ DYNAMIC_ARCH=ON \
+ BUILD_STATIC_LIBS=ON \
+ USE_LOCKING=1 \
+ USE_THREAD=0 \
+"
+
+do_install() {
+ oe_runmake PREFIX=${D}${prefix} install
+ rm -rf ${D}${bindir} ${D}${libdir}/cmake
+ # fixup pkgconfig file
+ sed -i -e "s#libdir=/.*#libdir=${libdir}#" ${D}${libdir}/pkgconfig/openblas.pc
+ sed -i -e "s#includedir=/.*#includedir=${includedir}#" ${D}${libdir}/pkgconfig/openblas.pc
+
+ cat ${D}${libdir}/pkgconfig/openblas.pc
+
+}
+
+FILES:${PN}-dev = "${includedir} ${libdir}/lib${PN}.so"
+FILES:${PN} = "${libdir}/*"
diff --git a/meta-offline-voice-agent/recipes-python/python3-sounddevice/python3-sounddevice_0.4.4.bb b/meta-offline-voice-agent/recipes-python/python3-sounddevice/python3-sounddevice_0.4.4.bb
new file mode 100644
index 00000000..58d9056d
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-python/python3-sounddevice/python3-sounddevice_0.4.4.bb
@@ -0,0 +1,20 @@
+SUMMARY = "Play and Record Sound with Python"
+HOMEPAGE = "http://python-sounddevice.readthedocs.io/"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=bd8634ff9bb1159041c3d4328659d00f"
+
+SRC_URI = "gitsm://github.com/spatialaudio/python-sounddevice;protocol=https;branch=master"
+
+PV = "0.4.4+git${SRCPV}"
+SRCREV = "a56cdb96c9c8e3d23b877bbcc7d26bd0cda231e0"
+
+S = "${WORKDIR}/git"
+
+inherit setuptools3
+
+# PACKAGECONFIG ?= "numpy"
+PACKAGECONFIG[numpy] = "python3-numpy"
+
+DEPENDS += "python3-cffi-native"
+
+RDEPENDS:${PN} += "portaudio-v19 python3-cffi python3-core python3-ctypes python3-numpy"
diff --git a/meta-offline-voice-agent/recipes-python/python3-srt/python3-srt_3.5.2.bb b/meta-offline-voice-agent/recipes-python/python3-srt/python3-srt_3.5.2.bb
new file mode 100644
index 00000000..258fc521
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-python/python3-srt/python3-srt_3.5.2.bb
@@ -0,0 +1,16 @@
+SUMMARY = "A tiny library for parsing, modifying, and composing SRT files."
+HOMEPAGE = "https://github.com/cdown/srt"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=6658a1272b4469f7249985d28b8697bb"
+
+SRC_URI = "https://files.pythonhosted.org/packages/18/a3/e1466f7c86a9e5d3e462ed6eb3a548917e93cc1ee212cd927f8f4e887ae9/srt-${PV}.tar.gz"
+SRC_URI[md5sum] = "3b68be7c46ec6152123fd801f519a63d"
+SRC_URI[sha256sum] = "7aa4ad5ce4126d3f53b3e7bc4edaa86653d0378bf1c0b1ab8c59f5ab41384450"
+
+S = "${WORKDIR}/srt-${PV}"
+
+inherit setuptools3
+
+RDEPENDS_${PN} += "python3-core python3-datetime python3-logging"
+
+BBCLASSEXTEND = "native nativesdk" \ No newline at end of file
diff --git a/meta-offline-voice-agent/recipes-python/python3-vosk-websocket-server/python3-vosk-websocket-server_git.bb b/meta-offline-voice-agent/recipes-python/python3-vosk-websocket-server/python3-vosk-websocket-server_git.bb
new file mode 100644
index 00000000..1a77f7d2
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-python/python3-vosk-websocket-server/python3-vosk-websocket-server_git.bb
@@ -0,0 +1,33 @@
+DESCRIPTION = "WebSocket, gRPC and WebRTC speech recognition server based on Vosk and Kaldi libraries"
+SUMMARY = "This is a server for highly accurate offline speech recognition using Kaldi and Vosk-API."
+HOMEPAGE = "https://github.com/alphacep/vosk-server"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d09bbd7a3746b6052fbd78b26a87396b"
+
+SRC_URI = "git://github.com/alphacep/vosk-server;protocol=https;branch=master"
+
+PV = "1.0+git${SRCPV}"
+SRCREV = "70f3d5321a40f2f5dffe9c833bc1fac4b3b451e7"
+
+S = "${WORKDIR}/git"
+
+RDEPENDS:${PN} += " \
+ vosk \
+ python3-vosk-api \
+ python3-websockets \
+ virtual/vosk-model \
+"
+
+do_configure () {
+ :
+}
+
+do_compile () {
+ :
+}
+
+do_install () {
+ install -d ${D}${bindir}
+ cp ${S}/websocket/asr_server.py ${D}${bindir}/vosk-websocket-python.py
+ chmod a+x ${D}${bindir}/vosk-websocket-python.py
+}
diff --git a/meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api/0001-Change-library-search-path-to-usr-lib.patch b/meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api/0001-Change-library-search-path-to-usr-lib.patch
new file mode 100644
index 00000000..dd4103d9
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api/0001-Change-library-search-path-to-usr-lib.patch
@@ -0,0 +1,26 @@
+From 6bbf9272cb367a06a4e4f3303628075df0b51085 Mon Sep 17 00:00:00 2001
+From: amanarora_09 <aman.arora9848@gmail.com>
+Date: Fri, 22 Jul 2022 13:27:07 +0200
+Subject: [PATCH] Change library search path to /usr/lib/
+
+Make the standard location known to the python library.
+
+Signed-off-by: amanarora_09 <aman.arora9848@gmail.com>
+---
+ python/vosk/__init__.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/python/vosk/__init__.py b/python/vosk/__init__.py
+index 45e2706..d260c61 100644
+--- a/vosk/__init__.py
++++ b/vosk/__init__.py
+@@ -23,7 +23,8 @@ def open_dll():
+ os.add_dll_directory(dlldir)
+ return _ffi.dlopen(os.path.join(dlldir, "libvosk.dll"))
+ elif sys.platform == 'linux':
+- return _ffi.dlopen(os.path.join(dlldir, "libvosk.so"))
++ dlldir = os.path.abspath("/usr/lib/")
++ return _ffi.dlopen(os.path.join(dlldir, "libvosk.so.0"))
+ elif sys.platform == 'darwin':
+ return _ffi.dlopen(os.path.join(dlldir, "libvosk.dyld"))
+ else:
diff --git a/meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api/run-ptest b/meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api/run-ptest
new file mode 100644
index 00000000..567af9d7
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api/run-ptest
@@ -0,0 +1,3 @@
+#!/bin/sh
+cd tests/
+./test_simple.py test.wav
diff --git a/meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api_0.3.42.bb b/meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api_0.3.42.bb
new file mode 100644
index 00000000..ba15bd56
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-python/python3-vosk/python3-vosk-api_0.3.42.bb
@@ -0,0 +1,48 @@
+SUMMARY = "Offline open source speech recognition API based on Kaldi and Vosk"
+HOMEPAGE = "https://github.com/alphacep/vosk-api"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://../COPYING;md5=d09bbd7a3746b6052fbd78b26a87396b"
+
+SRC_URI = "git://github.com/alphacep/vosk-api;protocol=https;branch=master \
+ file://0001-Change-library-search-path-to-usr-lib.patch \
+ file://run-ptest \
+ "
+
+PV = "0.3.42+git${SRCPV}"
+SRCREV = "b1b216d4c87d708935f1601287fe502aa11ee4a9"
+
+S = "${WORKDIR}/git/python"
+
+inherit setuptools3 ptest
+
+DEPENDS += " \
+ python3-srt-native \
+ python3-tqdm-native \
+ python3-requests-native \
+ python3-pip-native \
+ python3-charset-normalizer-native \
+"
+
+RDEPENDS:${PN} += " \
+ python3-cffi \
+ python3-compression \
+ python3-core \
+ python3-datetime \
+ python3-json \
+ python3-logging \
+ python3-misc \
+ python3-multiprocessing \
+ python3-netclient \
+ python3-requests \
+ python3-tqdm \
+ python3-srt \
+ python3-charset-normalizer \
+ python3-sounddevice \
+ virtual/vosk-model \
+"
+
+do_install_ptest () {
+ install -d ${D}${PTEST_PATH}/tests/
+ cp ${S}/example/test_simple.py ${D}${PTEST_PATH}/tests/
+ cp ${S}/example/test.wav ${D}${PTEST_PATH}/tests/
+}
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Build-fix-for-include-in-makefile.patch b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Build-fix-for-include-in-makefile.patch
new file mode 100644
index 00000000..8c67aba7
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Build-fix-for-include-in-makefile.patch
@@ -0,0 +1,25 @@
+From 29caad5ea644875d7d896836d5c8c67a711b4352 Mon Sep 17 00:00:00 2001
+From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+Date: Wed, 13 Jul 2022 15:52:29 +0000
+Subject: [PATCH] Build fix for include in makefile
+
+There is a conflict when using -isystem and bitbake's own flags.
+
+Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+---
+ src/makefiles/linux_openblas.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/makefiles/linux_openblas.mk b/src/makefiles/linux_openblas.mk
+index 1ac67c355..bb15f84a5 100644
+--- a/src/makefiles/linux_openblas.mk
++++ b/src/makefiles/linux_openblas.mk
+@@ -19,7 +19,7 @@ ifndef OPENBLASLIBS
+ $(error OPENBLASLIBS not defined.)
+ endif
+
+-CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
++CXXFLAGS = -std=c++17 -I.. -I $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+ -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
+ -Wno-deprecated-declarations -Winit-self \
+ -DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Enforce-cross-compilation-under-bitbake.patch b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Enforce-cross-compilation-under-bitbake.patch
new file mode 100644
index 00000000..d1fb4836
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Enforce-cross-compilation-under-bitbake.patch
@@ -0,0 +1,23 @@
+From 47f7b9dec92f52e3bd7d497326a2e5d28e3cf10c Mon Sep 17 00:00:00 2001
+From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+Date: Mon, 11 Jul 2022 16:50:23 +0200
+Subject: [PATCH] Enforce cross-compilation under bitbake
+
+Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+---
+ src/configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/configure b/src/configure
+index c74d67af8..2aaf541c3 100755
+--- a/src/configure
++++ b/src/configure
+@@ -232,7 +232,7 @@ You need $supported_compiler."
+
+ function check_for_slow_expf {
+ # We cannot run this test if we are cross compiling.
+- if [[ "$TARGET_ARCH" == "`uname -m`" ]] ; then
++ if false ; then
+ ( cd probe
+ rm -f exp-test
+ make -f Makefile.slow_expf 1>/dev/null
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Fixes-for-shared-library-compilation.patch b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Fixes-for-shared-library-compilation.patch
new file mode 100644
index 00000000..fb93a356
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/0001-Fixes-for-shared-library-compilation.patch
@@ -0,0 +1,95 @@
+From 4fc5d1df4dca9b7faaf630d43b32a85d80d16eb3 Mon Sep 17 00:00:00 2001
+From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+Date: Thu, 14 Jul 2022 11:00:07 +0000
+Subject: [PATCH] Fixes for shared library compilation
+
+Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+---
+ src/configure | 2 +-
+ src/fstbin/Makefile | 3 ++-
+ src/latbin/Makefile | 3 ++-
+ src/makefiles/linux_openblas.mk | 2 +-
+ src/matrix/Makefile | 2 +-
+ src/rnnlmbin/Makefile | 2 +-
+ 6 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/src/configure b/configure
+index c74d67af8..2aaf541c3 100755
+--- a/configure
++++ b/configure
+@@ -232,7 +232,7 @@ You need $supported_compiler."
+
+ function check_for_slow_expf {
+ # We cannot run this test if we are cross compiling.
+- if [[ "$TARGET_ARCH" == "`uname -m`" ]] ; then
++ if false ; then
+ ( cd probe
+ rm -f exp-test
+ make -f Makefile.slow_expf 1>/dev/null
+diff --git a/fstbin/Makefile b/fstbin/Makefile
+index a22c014a7..5a29030c3 100644
+--- a/fstbin/Makefile
++++ b/fstbin/Makefile
+@@ -26,6 +26,7 @@ TESTFILES =
+ LIBFILE =
+
+ ADDLIBS = ../decoder/kaldi-decoder.a ../fstext/kaldi-fstext.a \
+- ../util/kaldi-util.a ../matrix/kaldi-matrix.a ../base/kaldi-base.a
++ ../util/kaldi-util.a ../matrix/kaldi-matrix.a ../base/kaldi-base.a \
++ ../hmm/kaldi-hmm.a ../lat/kaldi-lat.a ../tree/kaldi-tree.a
+
+ include ../makefiles/default_rules.mk
+diff --git a/latbin/Makefile b/latbin/Makefile
+index d5cc4d035..902bf1058 100644
+--- a/latbin/Makefile
++++ b/latbin/Makefile
+@@ -36,6 +36,7 @@ TESTFILES =
+ ADDLIBS = ../rnnlm/kaldi-rnnlm.a ../nnet3/kaldi-nnet3.a \
+ ../cudamatrix/kaldi-cudamatrix.a ../lat/kaldi-lat.a ../lm/kaldi-lm.a \
+ ../fstext/kaldi-fstext.a ../hmm/kaldi-hmm.a ../tree/kaldi-tree.a \
+- ../util/kaldi-util.a ../matrix/kaldi-matrix.a ../base/kaldi-base.a
++ ../util/kaldi-util.a ../matrix/kaldi-matrix.a ../base/kaldi-base.a \
++ ../chain/kaldi-chain.a ../decoder/kaldi-decoder.a
+
+ include ../makefiles/default_rules.mk
+diff --git a/makefiles/linux_openblas.mk b/makefiles/linux_openblas.mk
+index 1ac67c355..bb15f84a5 100644
+--- a/makefiles/linux_openblas.mk
++++ b/makefiles/linux_openblas.mk
+@@ -19,7 +19,7 @@ ifndef OPENBLASLIBS
+ $(error OPENBLASLIBS not defined.)
+ endif
+
+-CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
++CXXFLAGS = -std=c++17 -I.. -I $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+ -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
+ -Wno-deprecated-declarations -Winit-self \
+ -DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
+diff --git a/matrix/Makefile b/matrix/Makefile
+index 398179a35..bec14e089 100644
+--- a/matrix/Makefile
++++ b/matrix/Makefile
+@@ -10,7 +10,7 @@ include ../kaldi.mk
+
+ # you can uncomment matrix-lib-speed-test if you want to do the speed tests.
+
+-TESTFILES = matrix-lib-test sparse-matrix-test numpy-array-test #matrix-lib-speed-test
++#TESTFILES = matrix-lib-test sparse-matrix-test numpy-array-test #matrix-lib-speed-test
+
+ OBJFILES = kaldi-matrix.o kaldi-vector.o packed-matrix.o sp-matrix.o tp-matrix.o \
+ matrix-functions.o qr.o srfft.o compressed-matrix.o \
+diff --git a/rnnlmbin/Makefile b/rnnlmbin/Makefile
+index 23a8eba61..d801b90d8 100644
+--- a/rnnlmbin/Makefile
++++ b/rnnlmbin/Makefile
+@@ -21,6 +21,6 @@ ADDLIBS = ../rnnlm/kaldi-rnnlm.a ../nnet3/kaldi-nnet3.a \
+ ../lat/kaldi-lat.a ../lm/kaldi-lm.a ../fstext/kaldi-fstext.a \
+ ../hmm/kaldi-hmm.a ../transform/kaldi-transform.a ../gmm/kaldi-gmm.a \
+ ../tree/kaldi-tree.a ../util/kaldi-util.a ../matrix/kaldi-matrix.a \
+- ../base/kaldi-base.a
++ ../base/kaldi-base.a ../chain/kaldi-chain.a
+
+ include ../makefiles/default_rules.mk
+--
+2.33.0
+
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/OLD/0001-Build-fix-for-include-in-makefile.patch b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/OLD/0001-Build-fix-for-include-in-makefile.patch
new file mode 100644
index 00000000..8c67aba7
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/OLD/0001-Build-fix-for-include-in-makefile.patch
@@ -0,0 +1,25 @@
+From 29caad5ea644875d7d896836d5c8c67a711b4352 Mon Sep 17 00:00:00 2001
+From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+Date: Wed, 13 Jul 2022 15:52:29 +0000
+Subject: [PATCH] Build fix for include in makefile
+
+There is a conflict when using -isystem and bitbake's own flags.
+
+Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+---
+ src/makefiles/linux_openblas.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/makefiles/linux_openblas.mk b/src/makefiles/linux_openblas.mk
+index 1ac67c355..bb15f84a5 100644
+--- a/src/makefiles/linux_openblas.mk
++++ b/src/makefiles/linux_openblas.mk
+@@ -19,7 +19,7 @@ ifndef OPENBLASLIBS
+ $(error OPENBLASLIBS not defined.)
+ endif
+
+-CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
++CXXFLAGS = -std=c++17 -I.. -I $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+ -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
+ -Wno-deprecated-declarations -Winit-self \
+ -DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/OLD/0001-Enforce-cross-compilation-under-bitbake.patch b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/OLD/0001-Enforce-cross-compilation-under-bitbake.patch
new file mode 100644
index 00000000..d1fb4836
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi/OLD/0001-Enforce-cross-compilation-under-bitbake.patch
@@ -0,0 +1,23 @@
+From 47f7b9dec92f52e3bd7d497326a2e5d28e3cf10c Mon Sep 17 00:00:00 2001
+From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+Date: Mon, 11 Jul 2022 16:50:23 +0200
+Subject: [PATCH] Enforce cross-compilation under bitbake
+
+Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+---
+ src/configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/configure b/src/configure
+index c74d67af8..2aaf541c3 100755
+--- a/src/configure
++++ b/src/configure
+@@ -232,7 +232,7 @@ You need $supported_compiler."
+
+ function check_for_slow_expf {
+ # We cannot run this test if we are cross compiling.
+- if [[ "$TARGET_ARCH" == "`uname -m`" ]] ; then
++ if false ; then
+ ( cd probe
+ rm -f exp-test
+ make -f Makefile.slow_expf 1>/dev/null
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi_git.bb b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi_git.bb
new file mode 100644
index 00000000..b3e021f3
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi_git.bb
@@ -0,0 +1,63 @@
+SUMMARY = "Kaldi Speech Recognition Toolkit"
+HOMEPAGE = "http://kaldi-asr.org/"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://../COPYING;md5=a10e448a64dbd3723ff3fb2f397fba2e \
+ file://doc/legal.dox;md5=3cba845003f27e67da70faa5da924c1e"
+
+SRC_URI = "git://github.com/alphacep/kaldi.git;protocol=https;branch=vosk \
+ file://0001-Fixes-for-shared-library-compilation.patch \
+ "
+
+PV = "1.0+git${SRCPV}"
+SRCREV = "76cd51d44c0a61e3905c35cadb2ec5f54f3e42d1"
+
+S = "${WORKDIR}/git/src"
+
+DEPENDS += "openblas vosk-openfst"
+inherit python3native
+
+ALLOW_EMPTY_${PN} = "1"
+
+MYCONF = "--mathlib=OPENBLAS --static --shared --use-cuda=no --fst-root=${STAGING_INCDIR}/../ --fst-version=1.8.0 --openblas-root=${STAGING_INCDIR}/../ "
+
+do_configure() {
+
+ ./configure ${MYCONF}
+
+}
+
+do_compile() {
+
+ make ${PARALLEL_MAKE}
+
+}
+
+do_install() {
+
+ install -d ${D}${libdir}
+
+ for i in lib/*.so ; do
+ install -m 0644 ${i} ${D}${libdir}/
+ done
+
+ for i in */*.a ; do
+ install -m 0644 ${i} ${D}${libdir}/
+ done
+
+ for j in base chain decoder feat fstext gmm gst-plugin hmm itf ivector kws lat lm matrix nnet nnet2 nnet3 online online2 rnnlm sgmm2 tfrnnlm transform tree util cudadecoder cudadecoderbin cudafeat cudamatrix ; do
+ install -d ${D}${includedir}/kaldi/$j
+ for i in $j/*.h ; do
+ install -m 0644 $i ${D}${includedir}/kaldi/$j/
+ done
+ done
+
+ # make sure we have the package vosk-kaldi
+
+ install -d ${D}/usr/share/kaldi
+ echo "This is vosk-kaldi" > ${D}/usr/share/kaldi/README
+
+}
+
+FILES:${PN} += " /usr/share/kaldi /usr/share/kaldi/README"
+ERROR_QA:remove = "rpaths"
+ERROR_QA:remove = "dev-elf"
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-model-small-en-us/vosk-model-small-en-us_0.15.bb b/meta-offline-voice-agent/recipes-vosk/vosk-model-small-en-us/vosk-model-small-en-us_0.15.bb
new file mode 100644
index 00000000..3a408a65
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-model-small-en-us/vosk-model-small-en-us_0.15.bb
@@ -0,0 +1,23 @@
+SUMMARY = "Lightweight wideband model 'en-us'"
+HOMEPAGE = "https://alphacephei.com/vosk/"
+LICENSE = "Apache-2.0"
+# LIC_URL = "${COMMON_LICENSE_DIR}/Apache-2.0"
+LIC_FILES_CHKSUM = "file://${WORKDIR}/models.md;beginline=32;endline=32;md5=bb5cd71a409da2b13fa3bcb67a3573d1"
+
+SRC_URI = " \
+ https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip;name=model \
+ https://raw.githubusercontent.com/alphacep/vosk-space/master/models.md;name=license \
+ "
+# License listed on https://alphacephei.com/vosk/models
+
+SRC_URI[model.sha256sum] = "30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+SRC_URI[license.sha256sum] = "3fbe0ee1fa914cb4b1cea2f2d7201a155884727cd0afbb51a267b66a73cb3444"
+
+do_install() {
+ install -d ${D}/usr/share/vosk
+ cp -R ${WORKDIR}/vosk-model-small-en-us-0.15/ ${D}/usr/share/vosk/
+}
+
+FILES:${PN} += " /usr/share/vosk /usr/share/vosk/vosk-model-small-en-us-0.15 "
+
+RPROVIDES:${PN} += "virtual/vosk-model"
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-openfst/files/0001-build-fixes-for-bitbake.patch b/meta-offline-voice-agent/recipes-vosk/vosk-openfst/files/0001-build-fixes-for-bitbake.patch
new file mode 100644
index 00000000..fd3234c8
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-openfst/files/0001-build-fixes-for-bitbake.patch
@@ -0,0 +1,64 @@
+From 8f5bc403c58af348d9671ca390c34cabde89a529 Mon Sep 17 00:00:00 2001
+From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+Date: Sat, 9 Jul 2022 16:49:10 +0200
+Subject: [PATCH] build fixes for bitbake
+
+Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+---
+ configure.ac | 36 +-----------------------------------
+ 1 file changed, 1 insertion(+), 35 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 9ab8824..316f719 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -5,7 +5,7 @@ AM_PROG_AR
+ AC_PROG_CXX
+ # This library does not throw exceptions, so we do not generate exception
+ # handling code. However, users are free to re-enable exception handling.
+-CXX="$CXX -std=c++17 -fno-exceptions -Wno-deprecated-declarations"
++#CXX="$CXX -std=c++17 -fno-exceptions -Wno-deprecated-declarations"
+
+ AC_DISABLE_STATIC
+ AC_PROG_LIBTOOL
+@@ -149,40 +149,6 @@ AC_ARG_WITH([libfstdir],
+
+ AC_SUBST([libfstdir], $with_libfstdir)
+
+-# Flags may be changed after configuring, so this is checked again by
+-# weight_test.cc. The check here is to save time in the common case,
+-# or when someone does not run `make check`.
+-AC_RUN_IFELSE([AC_LANG_PROGRAM([
+- #include <cstdio>
+-
+- template <typename T>
+- bool FloatEqIsReflexive(T m) {
+- volatile T x = 1.111;
+- x *= m;
+-
+- T y = 1.111;
+- y *= m;
+-
+- return x == y;
+- }
+- ], [
+- volatile double test_value = 1.1;
+- if (!FloatEqIsReflexive(static_cast<float>(test_value))) {
+- printf("float FAIL\n");
+- return 1;
+- }
+- if (!FloatEqIsReflexive(test_value)) {
+- printf("double FAIL\n");
+- return 1;
+- }
+- ])],
+- [echo "Float equality is good"],
+- [AC_MSG_FAILURE(m4_normalize([
+- Test float equality failed!
+- Compile with -msse -mfpmath=sse if using g++.
+- ]))],
+- [echo "Ignoring test for cross-compilation"])
+-
+ AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
+ AC_SUBST([DL_LIBS])
+
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-openfst/vosk-openfst_1.8.0.bb b/meta-offline-voice-agent/recipes-vosk/vosk-openfst/vosk-openfst_1.8.0.bb
new file mode 100644
index 00000000..c7e07bfe
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-openfst/vosk-openfst_1.8.0.bb
@@ -0,0 +1,23 @@
+DESCRIPTION = "OpenFst is a library for constructing, combining, optimizing, and searching weighted finite-state transducers (FSTs)."
+SUMMARY = "Openfst mirror with some fixes"
+HOMEPAGE = "https://github.com/alphacep/openfst"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=973381090441f4eb420224655e05e064"
+
+SRC_URI = "git://github.com/alphacep/openfst.git;protocol=https;branch=master \
+ file://0001-build-fixes-for-bitbake.patch \
+ "
+
+SRCREV = "7dfd808194105162f20084bb4d8e4ee4b65266d5"
+S = "${WORKDIR}/git"
+
+inherit autotools python3native
+
+# Specify any options you want to pass to the configure script using EXTRA_OECONF:
+EXTRA_OECONF = "--enable-static --enable-shared --enable-far --enable-ngram-fsts --enable-lookahead-fsts --with-pic --disable-bin"
+
+FILES:${PN} += " /usr/lib/fst /usr/lib/fst/arc_lookahead-fst.so \
+ /usr/lib/fst/ilabel_lookahead-fst.so \
+ /usr/lib/fst/ngram-fst.so \
+ /usr/lib/fst/olabel_lookahead-fst.so \
+"
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk-server/vosk-server_git.bb b/meta-offline-voice-agent/recipes-vosk/vosk-server/vosk-server_git.bb
new file mode 100644
index 00000000..337cee46
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk-server/vosk-server_git.bb
@@ -0,0 +1,32 @@
+DESCRIPTION = "WebSocket, gRPC and WebRTC speech recognition server based on Vosk and Kaldi libraries"
+SUMMARY = "This is a server for highly accurate offline speech recognition using Kaldi and Vosk-API."
+HOMEPAGE = "https://github.com/alphacep/vosk-server"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d09bbd7a3746b6052fbd78b26a87396b"
+
+SRC_URI = "git://github.com/alphacep/vosk-server;protocol=https;branch=master"
+
+PV = "1.0+git${SRCPV}"
+SRCREV = "70f3d5321a40f2f5dffe9c833bc1fac4b3b451e7"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "python3-vosk-api openblas vosk boost"
+
+do_configure () {
+ :
+}
+
+do_compile () {
+ # websocket-cpp
+ cd websocket-cpp
+ ${CXX} -I${STAGING_INCDIR}/vosk -lvosk ${LDFLAGS} -o vosk-websocket-cpp asr_server.cpp
+}
+
+do_install () {
+ # websocket-cpp
+ install -d ${D}${bindir}
+ cp websocket-cpp/vosk-websocket-cpp ${D}${bindir}
+}
+
+RDEPENDS:${PN} += "virtual/vosk-model" \ No newline at end of file
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk/vosk/0001-Build-fixes-for-shared-library-under-bitbake.patch b/meta-offline-voice-agent/recipes-vosk/vosk/vosk/0001-Build-fixes-for-shared-library-under-bitbake.patch
new file mode 100644
index 00000000..65bb866b
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk/vosk/0001-Build-fixes-for-shared-library-under-bitbake.patch
@@ -0,0 +1,74 @@
+From be3688fc475ece12d0fb8b7bcb993b053e91d3ec Mon Sep 17 00:00:00 2001
+From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+Date: Thu, 14 Jul 2022 18:31:47 +0200
+Subject: [PATCH] Build fixes for shared library under bitbake
+
+Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+---
+ Makefile | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index cd697b1..7918a82 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,6 @@
+ # Locations of the dependencies
+ KALDI_ROOT?=$(HOME)/travis/kaldi
++KALDI_LIBS?=$(HOME)/travis/kaldi/libs
+ OPENFST_ROOT?=$(KALDI_ROOT)/tools/openfst
+ OPENBLAS_ROOT?=$(KALDI_ROOT)/tools/OpenBLAS/install
+ MKL_ROOT?=/opt/intel/mkl
+@@ -33,7 +34,7 @@ VOSK_HEADERS= \
+ vosk_api.h
+
+ CFLAGS=-g -O3 -std=c++17 -Wno-deprecated-declarations -fPIC -DFST_NO_DYNAMIC_LINKING \
+- -I. -I$(KALDI_ROOT)/src -I$(OPENFST_ROOT)/include $(EXTRA_CFLAGS)
++ -I. -I$(KALDI_ROOT) -I$(OPENFST_ROOT) $(EXTRA_CFLAGS)
+
+ LDFLAGS=
+
+@@ -60,11 +61,11 @@ ifeq ($(USE_SHARED), 0)
+ $(OPENFST_ROOT)/lib/libfstngram.a
+ else
+ LDFLAGS += \
+- -L$(KALDI_ROOT)/libs \
++ -L$(KALDI_LIBS) \
+ -lkaldi-online2 -lkaldi-decoder -lkaldi-ivector -lkaldi-gmm -lkaldi-tree \
+ -lkaldi-feat -lkaldi-lat -lkaldi-lm -lkaldi-rnnlm -lkaldi-hmm -lkaldi-nnet3 \
+ -lkaldi-transform -lkaldi-cudamatrix -lkaldi-matrix -lkaldi-fstext \
+- -lkaldi-util -lkaldi-base -lfst -lfstngram
++ -lkaldi-util -lkaldi-base -lfst -lfstngram -shared -Wl,-soname,libvosk.so.0.3.42
+ endif
+
+ ifeq ($(HAVE_OPENBLAS_CLAPACK), 1)
+@@ -76,7 +77,8 @@ ifeq ($(HAVE_OPENBLAS_CLAPACK), 1)
+ $(OPENBLAS_ROOT)/lib/libblas.a \
+ $(OPENBLAS_ROOT)/lib/libf2c.a
+ else
+- LDFLAGS += -lopenblas -llapack -lblas -lf2c
++ LDFLAGS += -lopenblas
++ # -llapack -lblas -lf2c
+ endif
+ endif
+
+@@ -103,10 +105,14 @@ ifeq ($(HAVE_CUDA), 1)
+ LDFLAGS += -L$(CUDA_ROOT)/lib64 -lcuda -lcublas -lcusparse -lcudart -lcurand -lcufft -lcusolver -lnvToolsExt
+ endif
+
+-all: $(OUTDIR)/libvosk.$(EXT)
++all: $(OUTDIR)/libvosk.$(EXT).0.3.42
++$(OUTDIR)/libvosk.$(EXT).0.3.42: $(OUTDIR)/libvosk.$(EXT)
++ mv libvosk.${EXT} libvosk.${EXT}.0.3.42
++ ln -sf libvosk.${EXT}.0.3.42 libvosk.so
++
+
+ $(OUTDIR)/libvosk.$(EXT): $(VOSK_SOURCES:%.cc=$(OUTDIR)/%.o) $(LIBS)
+- $(CXX) --shared -s -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
++ $(CXX) --shared -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
+
+ $(OUTDIR)/%.o: %.cc $(VOSK_HEADERS)
+ $(CXX) $(CFLAGS) -c -o $@ $<
+--
+2.33.0
+
diff --git a/meta-offline-voice-agent/recipes-vosk/vosk/vosk_0.3.42.bb b/meta-offline-voice-agent/recipes-vosk/vosk/vosk_0.3.42.bb
new file mode 100644
index 00000000..bf4ffe31
--- /dev/null
+++ b/meta-offline-voice-agent/recipes-vosk/vosk/vosk_0.3.42.bb
@@ -0,0 +1,49 @@
+SUMMARY = "Offline open source speech recognition API based on Kaldi and Vosk"
+HOMEPAGE = "https://github.com/alphacep/vosk-api"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://../COPYING;md5=d09bbd7a3746b6052fbd78b26a87396b"
+
+SRC_URI = "git://github.com/alphacep/vosk-api;protocol=https;branch=master \
+ file://0001-Build-fixes-for-shared-library-under-bitbake.patch \
+ "
+
+PV = "0.3.42+git${SRCPV}"
+SRCREV = "b1b216d4c87d708935f1601287fe502aa11ee4a9"
+
+S = "${WORKDIR}/git/src"
+
+DEPENDS += " vosk-kaldi vosk-openfst openblas"
+
+RDEPENDS:${PN} += " \
+"
+
+CFLAGS:append = " -I${STAGING_INCDIR}/kaldi -g "
+LDFLAGS:remove = "-Wl,--as-needed"
+
+do_configure(){
+ :
+}
+
+do_compile(){
+
+ make KALDI_ROOT=${STAGING_INCDIR}/kaldi/ OPENFST_ROOT=${STAGING_INCDIR} OPENBLAS_ROOT=${STAGING_INCDIR} USE_SHARED=1 EXTRA_CFLAGS="${CFLAGS}" EXTRA_LDFLAGS="${LDFLAGS}" ${PARALLEL_MAKE}
+
+}
+
+do_install(){
+
+ install -d ${D}${libdir}
+ install -m 0644 libvosk.so.0.3.42 ${D}${libdir}
+ cd ${D}${libdir}
+ ln -sf libvosk.so.0.3.42 libvosk.so
+ ln -sf libvosk.so.0.3.42 libvosk.so.0
+ cd ${S}
+
+ install -d ${D}${includedir}/vosk
+ for i in *.h ; do
+ install -m 0644 $i ${D}${includedir}/vosk/
+ done
+
+}
+
+ERROR_QA:remove = "dev-deps"
diff --git a/templates/feature/agl-offline-voice-agent/50_bblayers.conf.inc b/templates/feature/agl-offline-voice-agent/50_bblayers.conf.inc
new file mode 100644
index 00000000..f46f44ff
--- /dev/null
+++ b/templates/feature/agl-offline-voice-agent/50_bblayers.conf.inc
@@ -0,0 +1,7 @@
+# agl-offline-voice-agent
+
+AGL_META_PYTHON = "${METADIR}/external/meta-openembedded/meta-python"
+
+BBLAYERS =+ " \
+ ${METADIR}/meta-agl-devel/meta-offline-voice-agent \
+"
diff --git a/templates/feature/agl-offline-voice-agent/50_local.conf.inc b/templates/feature/agl-offline-voice-agent/50_local.conf.inc
new file mode 100644
index 00000000..581ad978
--- /dev/null
+++ b/templates/feature/agl-offline-voice-agent/50_local.conf.inc
@@ -0,0 +1,14 @@
+# agl-offline-voice-agent
+
+FORTRAN:forcevariable = ",fortran"
+RUNTIMETARGET:append:pn-gcc-runtime = " libquadmath"
+
+# FIXME check if needed and/or submit upstream
+BBCLASSEXTEND:pn-python3-charset-normalizer = "native nativesdk"
+
+IMAGE_INSTALL:append = " python3-vosk-api vosk-kaldi vosk vosk-server python3-vosk-websocket-server python3-sounddevice ptest-runner"
+
+PREFERRED_PROVIDER_virtual/vosk-model ?= "vosk-model-small-en-us"
+
+DISTRO_FEATURES:append = " ptest"
+EXTRA_IMAGE_FEATURES += "ptest-pkgs"
diff --git a/templates/feature/agl-offline-voice-agent/README_feature_agl-offline-voice-agent.md b/templates/feature/agl-offline-voice-agent/README_feature_agl-offline-voice-agent.md
new file mode 100644
index 00000000..fe44a6af
--- /dev/null
+++ b/templates/feature/agl-offline-voice-agent/README_feature_agl-offline-voice-agent.md
@@ -0,0 +1,9 @@
+---
+description: Feature agl-offline-voice-agent
+authors: Aman Arora <aman.arora9848@gmail.com>
+---
+
+### Feature agl-offline-voice-agent
+
+- Feature template for meta-offline-voice-agent layer.
+- Vosk Voice Model included: vosk-model-small-en-us