Standalone C++ implementation of Moonshine ASR with ONNXRuntime and no other dependencies.
Moonshine ASR is an Automatic Speech Recognition (ASR) system implemented in C++ using ONNX Runtime. This project provides a standalone implementation that can be built and run on various platforms.
- CMake 3.15 or higher
- A C++17 compatible compiler
- ONNX Runtime for the building OS will be fetched in build time.
-
Open a PowerShell terminal.
-
Navigate to the root directory of the project.
-
Run the build script:
.\scripts\build.ps1
-
Open a terminal.
-
Navigate to the root directory of the project.
-
Run the build script:
./scripts/build.sh
-
Create a build directory:
mkdir -p build cd build
-
Configure the project with CMake:
cmake -DCMAKE_BUILD_TYPE=Release ..
-
Build the project:
cmake --build .
-
Install the project:
cmake --install . --prefix ../dist
After building the project, you can run the example executable to test the ASR system.
./dist/bin/moonshine_example <models_dir> <wav_file>
Replace <models_dir>
with the directory containing your ONNX models and <wav_file>
with the path to a WAV file.
./dist/bin/moonshine_example models/ example.wav
To use Moonshine ASR as a library in your C++ project, follow these steps:
-
Build and install the Moonshine ASR library as described in the Build Instructions.
-
Link against the installed library in your CMake project:
cmake_minimum_required(VERSION 3.15) project(my_project) # Find the Moonshine package find_package(Moonshine REQUIRED) add_executable(my_project main.cpp) # Link against the Moonshine library target_link_libraries(my_project PRIVATE Moonshine::moonshine)
-
Include the Moonshine header in your source code:
#include <moonshine.hpp> int main() { MoonshineModel model("path/to/models"); // Use the model... return 0; }
This project is based on the Moonshine ASR system: https://github.com/usefulsensors/moonshine. Special thanks to the Moonshine team for their contributions.
This project is licensed under the MIT License. See the LICENSE file for details.