piper - fast and local neural text-to-speech engine
ncnn piper vits TTS 模型部署流水账 https://zhuanlan.zhihu.com/p/1941224089919426906
This is a sample ncnn android project, it depends on ncnn library
https://github.com/Tencent/ncnn
The app supports Android 5.0 (API 21) and later. Audio playback uses OpenSL ES. The bundled Turnip driver has separate device and Android version requirements and cannot load on Android 5.0; CPU inference does not depend on it.
https://github.com/nihui/ncnn-android-piper/releases/latest
https://github.com/Tencent/ncnn/releases
- Download ncnn-YYYYMMDD-android-vulkan.zip or build ncnn for android yourself
- Extract ncnn-YYYYMMDD-android-vulkan.zip into app/src/main/jni and change the ncnn_DIR path to yours in app/src/main/jni/CMakeLists.txt
- Open this project with Android Studio, build it and enjoy!
- This project uses a custom dictionary to implement phonemizer
- If you need an espeak-ng phonemizer implementation(GPL), refer to #2
- checkout https://github.com/OHF-Voice/piper1-gpl (113931937cf235fc881afd1ca4be209bc6919bc7)
- apply patch
piper1-gpl.patch - setup piper with
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e .[train]- download piper checkpoint file (*.ckpt) from https://huggingface.co/datasets/rhasspy/piper-checkpoints
- install pnnx via
pip install -U pnnx - obtain
export_ncnn.pyscript
python export_ncnn.py en.ckpt- prepare word list from https://github.com/Alexir/CMUdict
- for each word, get phonemes via command
./espeak-ng -q -v en-us --ipa word - obtain
config.jsonfile from https://huggingface.co/datasets/rhasspy/piper-checkpoints - replace phonemes with ids according to
phoneme_id_mapinconfig.json - write dict binary
word1 \0x00 ids1 \0xff word2 \0x00 ids2 \0xff .....
