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
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.py
script
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.json
file from https://huggingface.co/datasets/rhasspy/piper-checkpoints - replace phonemes with ids according to
phoneme_id_map
inconfig.json
- write dict binary
word1 \0x00 ids1 \0xff word2 \0x00 ids2 \0xff .....