To use the Piper plugin for Text-to-Speech, you must build WasmEdge from source with the DWASMEDGE_PLUGIN_WASI_NN_BACKEND=Piper flag. The plugin relies on the ONNX Runtime C++ API.
Before building WasmEdge, ensure you have installed the ONNX Runtime (e.g., version 1.14.1 on Ubuntu) by moving the include and lib directories to /usr/local/include and /usr/local/lib respectively and running ldconfig.
# Install ONNX Runtime 1.14.1 on Ubuntu
curl -LO https://github.com/microsoft/onnxruntime/releases/download/v1.14.1/onnxruntime-linux-x64-1.14.1.tgz
tar zxf onnxruntime-linux-x64-1.14.1.tgz
mv onnxruntime-linux-x64-1.14.1/include/* /usr/local/include/
mv onnxruntime-linux-x64-1.14.1/lib/* /usr/local/lib/
rm -rf onnxruntime-linux-x64-1.14.1.tgz onnxruntime-linux-x64-1.14.1
ldconfig
# Build WasmEdge with Piper backend
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_USE_LLVM=OFF -DWASMEDGE_PLUGIN_WASI_NN_BACKEND=Piper
cmake --build build