Spaces:
Running
VOICEVOX NEMO ENGINE
VOICEVOX Nemo ã®ãšã³ãžã³ã§ãã
å®æ
㯠HTTP ãµãŒããŒãªã®ã§ããªã¯ãšã¹ããéä¿¡ããã°ããã¹ãé³å£°åæã§ããŸãã
ïŒãšãã£ã¿ãŒã¯ VOICEVOX ã®ãã«ããšã³ãžã³æ©èœãå©çšã ã³ã¢ã¯ VOICEVOX NEMO CORE ã«è©³çŽ°ããããŸããïŒ
ããŠã³ããŒã
ãã¡ããã察å¿ãããšã³ãžã³ãããŠã³ããŒãããŠãã ããã
API ããã¥ã¡ã³ãã»ãµã³ãã«
ãµãŒããŒã®ããã©ã«ãã®ããŒãçªå·ã¯ 50121
ã§ãããã以å€ã¯ VOICEVOX ENGINE ãšåãã§ãã
Docker ã€ã¡ãŒãž
CPU
docker pull voicevox/voicevox_nemo_engine:cpu-ubuntu20.04-latest
docker run --rm -it -p '127.0.0.1:50021:50021' voicevox/voicevox_nemo_engine:cpu-ubuntu20.04-latest
GPU
docker pull voicevox/voicevox_nemo_engine:nvidia-ubuntu20.04-latest
docker run --rm --gpus all -p '127.0.0.1:50021:50021' voicevox/voicevox_nemo_engine:nvidia-ubuntu20.04-latest
Forkå ã®VOICEVOX ENGINEã®README
VOICEVOX ENGINE
VOICEVOX ã®ãšã³ãžã³ã§ãã
å®æ
㯠HTTP ãµãŒããŒãªã®ã§ããªã¯ãšã¹ããéä¿¡ããã°ããã¹ãé³å£°åæã§ããŸãã
ïŒãšãã£ã¿ãŒã¯ VOICEVOX ã ã³ã¢ã¯ VOICEVOX CORE ã å šäœæ§æ㯠ãã¡ã ã«è©³çŽ°ããããŸããïŒ
ããŠã³ããŒã
ãã¡ããã察å¿ãããšã³ãžã³ãããŠã³ããŒãããŠãã ããã
API ããã¥ã¡ã³ã
API ããã¥ã¡ã³ãããåç §ãã ããã
VOICEVOX ãšã³ãžã³ãããã¯ãšãã£ã¿ãèµ·åããç¶æ
㧠http://127.0.0.1:50021/docs ã«ã¢ã¯ã»ã¹ãããšãèµ·åäžã®ãšã³ãžã³ã®ããã¥ã¡ã³ãã確èªã§ããŸãã
ä»åŸã®æ¹éãªã©ã«ã€ããŠã¯ VOICEVOX é³å£°åæãšã³ãžã³ãšã®é£æº ãåèã«ãªããããããŸããã
ãªã¯ãšã¹ãã»ã¬ã¹ãã³ã¹ã®æåã³ãŒãã¯ãã¹ãŠ UTF-8 ã§ãã
HTTP ãªã¯ãšã¹ãã§é³å£°åæãããµã³ãã«ã³ãŒã
echo -n "ããã«ã¡ã¯ãé³å£°åæã®äžçãžãããã" >text.txt
curl -s \
-X POST \
"127.0.0.1:50021/audio_query?style_id=1"\
--get --data-urlencode text@text.txt \
> query.json
curl -s \
-H "Content-Type: application/json" \
-X POST \
-d @query.json \
"127.0.0.1:50021/synthesis?style_id=1" \
> audio.wav
çæãããé³å£°ã¯ãµã³ããªã³ã°ã¬ãŒãã 24000Hz ãšå°ãç¹æ®ãªãããé³å£°ãã¬ãŒã€ãŒã«ãã£ãŠã¯åçã§ããªãå ŽåããããŸãã
speaker
ã«æå®ããå€ã¯ /speakers
ãšã³ããã€ã³ãã§åŸããã style_id
ã§ããäºææ§ã®ããã« speaker
ãšããååã«ãªã£ãŠããŸãã
èªã¿æ¹ã AquesTalk èšæ³ã§ååŸã»ä¿®æ£ãããµã³ãã«ã³ãŒã
/audio_query
ã®ã¬ã¹ãã³ã¹ã«ã¯ãšã³ãžã³ãå€æããèªã¿æ¹ã AquesTalk ã©ã€ã¯ãªèšæ³(æ¬å®¶ã®èšæ³ãšã¯äžéšç°ãªããŸã)ã§èšé²ãããŠããŸãã
èšæ³ã¯æ¬¡ã®ã«ãŒã«ã«åŸããŸãã
- å šãŠã®ã«ãã¯ã«ã¿ã«ãã§èšè¿°ããã
- ã¢ã¯ã»ã³ãå¥ã¯
/
ãŸãã¯ã
ã§åºåããã
ã§åºåã£ãå Žåã«éãç¡é³åºéãæ¿å ¥ãããã - ã«ãã®æåã«
_
ãå ¥ãããšãã®ã«ãã¯ç¡å£°åããã - ã¢ã¯ã»ã³ãäœçœ®ã
'
ã§æå®ãããå šãŠã®ã¢ã¯ã»ã³ãå¥ã«ã¯ã¢ã¯ã»ã³ãäœçœ®ã 1 ã€æå®ããå¿ èŠãããã - ã¢ã¯ã»ã³ãå¥æ«ã«
ïŒ
(å šè§)ãå ¥ããããšã«ããçåæã®çºé³ãã§ãã
# èªãŸãããæç« ãutf-8ã§text.txtã«æžãåºã
echo -n "ãã£ãŒãã©ãŒãã³ã°ã¯äžèœè¬ã§ã¯ãããŸãã" >text.txt
curl -s \
-X POST \
"127.0.0.1:50021/audio_query?style_id=1" \
--get --data-urlencode text@text.txt \
> query.json
cat query.json | grep -o -E "\"kana\":\".*\""
# çµæ... "kana":"ãã£'ã€ã/ã©'ã¢ãã³ã°ã¯/ãã³ããªã€ã¯ãã¯ã¢ãªãã»'ã³"
# "ãã£ã€ãã©'ã¢ãã³ã°ã¯/ãã³ã'ãªã€ã¯ãã¯/ã¢ãªãã»'ã³"ãšèªãŸãããã®ã§ã
# is_kana=trueãã€ããŠã€ã³ãããŒã·ã§ã³ãååŸãnewphrases.jsonã«ä¿å
echo -n "ãã£ã€ãã©'ã¢ãã³ã°ã¯/ãã³ã'ãªã€ã¯ãã¯/ã¢ãªãã»'ã³" > kana.txt
curl -s \
-X POST \
"127.0.0.1:50021/accent_phrases?style_id=1&is_kana=true" \
--get --data-urlencode text@kana.txt \
> newphrases.json
# query.jsonã®"accent_phrases"ã®å
容ãnewphrases.jsonã®å
容ã«çœ®ãæãã
cat query.json | sed -e "s/\[{.*}\]/$(cat newphrases.json)/g" > newquery.json
curl -s \
-H "Content-Type: application/json" \
-X POST \
-d @newquery.json \
"127.0.0.1:50021/synthesis?style_id=1" \
> audio.wav
ãŠãŒã¶ãŒèŸæžæ©èœã«ã€ããŠ
API ãããŠãŒã¶ãŒèŸæžã®åç §ãåèªã®è¿œå ãç·šéãåé€ãè¡ãããšãã§ããŸãã
åç §
/user_dict
ã« GET ãªã¯ãšã¹ããæããããšã§ãŠãŒã¶ãŒèŸæžã®äžèŠ§ãååŸããããšãã§ããŸãã
curl -s -X GET "127.0.0.1:50021/user_dict"
åèªè¿œå
/user_dict_word
ã« POST ãªã¯ãšã¹ããæããäºã§ãŠãŒã¶ãŒèŸæžã«åèªãè¿œå ããããšãã§ããŸãã
URL ãã©ã¡ãŒã¿ãšããŠã以äžãå¿
èŠã§ãã
- surface ïŒèŸæžã«ç»é²ããåèªïŒ
- pronunciation ïŒã«ã¿ã«ãã§ã®èªã¿æ¹ïŒ
- accent_type ïŒã¢ã¯ã»ã³ãæ žäœçœ®ãæŽæ°ïŒ
ã¢ã¯ã»ã³ãæ žäœçœ®ã«ã€ããŠã¯ããã¡ãã®æç« ãåèã«ãªãããšæããŸãã
ãåãšãªã£ãŠããæ°åã®éšåãã¢ã¯ã»ã³ãæ žäœçœ®ã«ãªããŸãã
https://tdmelodic.readthedocs.io/ja/latest/pages/introduction.html
æåããå Žåã®è¿ãå€ã¯åèªã«å²ãåœãŠããã UUID ã®æååã«ãªããŸãã
surface="test"
pronunciation="ãã¹ã"
accent_type="1"
curl -s -X POST "127.0.0.1:50021/user_dict_word" \
--get \
--data-urlencode "surface=$surface" \
--data-urlencode "pronunciation=$pronunciation" \
--data-urlencode "accent_type=$accent_type"
åèªä¿®æ£
/user_dict_word/{word_uuid}
ã« PUT ãªã¯ãšã¹ããæããäºã§ãŠãŒã¶ãŒèŸæžã®åèªãä¿®æ£ããããšãã§ããŸãã
URL ãã©ã¡ãŒã¿ãšããŠã以äžãå¿
èŠã§ãã
- surface ïŒèŸæžã«ç»é²ããã¯ãŒãïŒ
- pronunciation ïŒã«ã¿ã«ãã§ã®èªã¿æ¹ïŒ
- accent_type ïŒã¢ã¯ã»ã³ãæ žäœçœ®ãæŽæ°ïŒ
word_uuid ã¯åèªè¿œå æã«ç¢ºèªã§ããã»ãããŠãŒã¶ãŒèŸæžãåç
§ããããšã§ã確èªã§ããŸãã
æåããå Žåã®è¿ãå€ã¯204 No Content
ã«ãªããŸãã
surface="test2"
pronunciation="ãã¹ãããŒ"
accent_type="2"
# ç°å¢ã«ãã£ãŠword_uuidã¯é©å®æžãæããŠãã ãã
word_uuid="cce59b5f-86ab-42b9-bb75-9fd3407f1e2d"
curl -s -X PUT "127.0.0.1:50021/user_dict_word/$word_uuid" \
--get \
--data-urlencode "surface=$surface" \
--data-urlencode "pronunciation=$pronunciation" \
--data-urlencode "accent_type=$accent_type"
åèªåé€
/user_dict_word/{word_uuid}
ã« DELETE ãªã¯ãšã¹ããæããäºã§ãŠãŒã¶ãŒèŸæžã®åèªãåé€ããããšãã§ããŸãã
word_uuid ã¯åèªè¿œå æã«ç¢ºèªã§ããã»ãããŠãŒã¶ãŒèŸæžãåç
§ããããšã§ã確èªã§ããŸãã
æåããå Žåã®è¿ãå€ã¯204 No Content
ã«ãªããŸãã
# ç°å¢ã«ãã£ãŠword_uuidã¯é©å®æžãæããŠãã ãã
word_uuid="cce59b5f-86ab-42b9-bb75-9fd3407f1e2d"
curl -s -X DELETE "127.0.0.1:50021/user_dict_word/$word_uuid"
ããªã»ããæ©èœã«ã€ããŠ
presets.yaml
ãç·šéããããšã§è©±è
ã話éãªã©ã®ããªã»ããã䜿ãããšãã§ããŸãã
echo -n "ããªã»ãããããŸã掻çšããã°ããµãŒãããŒãã£éã§åãèšå®ã䜿ãããšãã§ããŸã" >text.txt
# ããªã»ããæ
å ±ãååŸ
curl -s -X GET "127.0.0.1:50021/presets" > presets.json
preset_id=$(cat presets.json | sed -r 's/^.+"id"\:\s?([0-9]+?).+$/\1/g')
style_id=$(cat presets.json | sed -r 's/^.+"style_id"\:\s?([0-9]+?).+$/\1/g')
# AudioQueryã®ååŸ
curl -s \
-X POST \
"127.0.0.1:50021/audio_query_from_preset?preset_id=$preset_id"\
--get --data-urlencode text@text.txt \
> query.json
# é³å£°åæ
curl -s \
-H "Content-Type: application/json" \
-X POST \
-d @query.json \
"127.0.0.1:50021/synthesis?style_id=$style_id" \
> audio.wav
speaker_uuid
ã¯ã/speakers
ã§ç¢ºèªã§ããŸãid
ã¯éè€ããŠã¯ãããŸãã- ãšã³ãžã³èµ·ååŸã«ãã¡ã€ã«ãæžãæãããšãšã³ãžã³ã«åæ ãããŸã
2 人ã®è©±è ã§ã¢ãŒãã£ã³ã°ãããµã³ãã«ã³ãŒã
/synthesis_morphing
ã§ã¯ã2 人ã®è©±è
ã§ããããåæãããé³å£°ãå
ã«ãã¢ãŒãã£ã³ã°ããé³å£°ãçæããŸãã
echo -n "ã¢ãŒãã£ã³ã°ãå©çšããããšã§ãïŒã€ã®å£°ãæ··ããããšãã§ããŸãã" > text.txt
curl -s \
-X POST \
"127.0.0.1:50021/audio_query?style_id=0"\
--get --data-urlencode text@text.txt \
> query.json
# å
ã®è©±è
ã§ã®åæçµæ
curl -s \
-H "Content-Type: application/json" \
-X POST \
-d @query.json \
"127.0.0.1:50021/synthesis?style_id=0" \
> audio.wav
export MORPH_RATE=0.5
# 話è
2人åã®é³å£°åæ+WORLDã«ããé³å£°åæãå
¥ãããæéãæããã®ã§æ³šæ
curl -s \
-H "Content-Type: application/json" \
-X POST \
-d @query.json \
"127.0.0.1:50021/synthesis_morphing?base_speaker=0&target_speaker=1&morph_rate=$MORPH_RATE" \
> audio.wav
export MORPH_RATE=0.9
# queryãbase_speakerãtarget_speakerãåãå Žåã¯ãã£ãã·ã¥ã䜿çšãããããæ¯èŒçé«éã«çæããã
curl -s \
-H "Content-Type: application/json" \
-X POST \
-d @query.json \
"127.0.0.1:50021/synthesis_morphing?base_speaker=0&target_speaker=1&morph_rate=$MORPH_RATE" \
> audio.wav
話è ã®è¿œå æ å ±ãååŸãããµã³ãã«ã³ãŒã
è¿œå æ
å ±ã®äžã® portrait.png ãååŸããã³ãŒãã§ãã
ïŒjqã䜿çšã㊠json ãããŒã¹ããŠããŸããïŒ
curl -s -X GET "127.0.0.1:50021/speaker_info?speaker_uuid=7ffcb7ce-00ec-4bdc-82cd-45a8889e43ff" \
| jq -r ".portrait" \
| base64 -d \
> portrait.png
ãã£ã³ã»ã«å¯èœãªé³å£°åæ
/cancellable_synthesis
ã§ã¯éä¿¡ãåæããå Žåã«å³åº§ã«èšç®ãªãœãŒã¹ãéæŸãããŸãã
(/synthesis
ã§ã¯éä¿¡ãåæããŠãæåŸãŸã§é³å£°åæã®èšç®ãè¡ãããŸã)
ãã® API ã¯å®éšçæ©èœã§ããããšã³ãžã³èµ·åæã«åŒæ°ã§--enable_cancellable_synthesis
ãæå®ããªããšæå¹åãããŸããã
é³å£°åæã«å¿
èŠãªãã©ã¡ãŒã¿ã¯/synthesis
ãšåæ§ã§ãã
CORS èšå®
VOICEVOX ã§ã¯ã»ãã¥ãªãã£ä¿è·ã®ããlocalhost
ã»127.0.0.1
ã»app://
ã»Origin ãªã以å€ã® Origin ãããªã¯ãšã¹ããåãå
¥ããªãããã«ãªã£ãŠããŸãã
ãã®ãããäžéšã®ãµãŒãããŒãã£ã¢ããªããã®ã¬ã¹ãã³ã¹ãåãåããªãå¯èœæ§ããããŸãã
ãããåé¿ããæ¹æ³ãšããŠããšã³ãžã³ããèšå®ã§ãã UI ãçšæããŠããŸãã
èšå®æ¹æ³
- http://127.0.0.1:50021/setting ã«ã¢ã¯ã»ã¹ããŸãã
- å©çšããã¢ããªã«åãããŠèšå®ãå€æŽãè¿œå ããŠãã ããã
- ä¿åãã¿ã³ãæŒããŠãå€æŽã確å®ããŠãã ããã
- èšå®ã®é©çšã«ã¯ãšã³ãžã³ã®åèµ·åãå¿ èŠã§ããå¿ èŠã«å¿ããŠåèµ·åãããŠãã ããã
ãã®ä»ã®åŒæ°
ãšã³ãžã³èµ·åæã«åŒæ°ãæå®ã§ããŸãã詳ããããšã¯-h
åŒæ°ã§ãã«ãã確èªããŠãã ããã
$ python run.py -h
usage: run.py [-h] [--host HOST] [--port PORT] [--use_gpu] [--voicevox_dir VOICEVOX_DIR] [--voicelib_dir VOICELIB_DIR] [--runtime_dir RUNTIME_DIR] [--enable_mock] [--enable_cancellable_synthesis]
[--init_processes INIT_PROCESSES] [--load_all_models] [--cpu_num_threads CPU_NUM_THREADS] [--output_log_utf8] [--cors_policy_mode {CorsPolicyMode.all,CorsPolicyMode.localapps}]
[--allow_origin [ALLOW_ORIGIN ...]] [--setting_file SETTING_FILE] [--preset_file PRESET_FILE]
VOICEVOX ã®ãšã³ãžã³ã§ãã
options:
-h, --help show this help message and exit
--host HOST æ¥ç¶ãåãä»ãããã¹ãã¢ãã¬ã¹ã§ãã
--port PORT æ¥ç¶ãåãä»ããããŒãçªå·ã§ãã
--use_gpu æå®ãããšGPUã䜿ã£ãŠé³å£°åæããããã«ãªããŸãã
--voicevox_dir VOICEVOX_DIR
VOICEVOXã®ãã£ã¬ã¯ããªãã¹ã§ãã
--voicelib_dir VOICELIB_DIR
VOICEVOX COREã®ãã£ã¬ã¯ããªãã¹ã§ãã
--runtime_dir RUNTIME_DIR
VOICEVOX COREã§äœ¿çšããã©ã€ãã©ãªã®ãã£ã¬ã¯ããªãã¹ã§ãã
--enable_mock æå®ãããšVOICEVOX COREã䜿ããã¢ãã¯ã§é³å£°åæãè¡ããŸãã
--enable_cancellable_synthesis
æå®ãããšé³å£°åæãéäžã§ãã£ã³ã»ã«ã§ããããã«ãªããŸãã
--init_processes INIT_PROCESSES
cancellable_synthesisæ©èœã®åæåæã«çæããããã»ã¹æ°ã§ãã
--load_all_models æå®ãããšèµ·åæã«å
šãŠã®é³å£°åæã¢ãã«ãèªã¿èŸŒã¿ãŸãã
--cpu_num_threads CPU_NUM_THREADS
é³å£°åæãè¡ãã¹ã¬ããæ°ã§ããæå®ããªããšã代ããã«ç°å¢å€æ°VV_CPU_NUM_THREADSã®å€ã䜿ãããŸããVV_CPU_NUM_THREADSã空æååã§ãªãæ°å€ã§ããªãå Žåã¯ãšã©ãŒçµäºããŸãã
--output_log_utf8 æå®ãããšãã°åºåãUTF-8ã§ãããªããŸããæå®ããªããšã代ããã«ç°å¢å€æ° VV_OUTPUT_LOG_UTF8 ã®å€ã䜿ãããŸããVV_OUTPUT_LOG_UTF8 ã®å€ã1ã®å Žåã¯UTF-8ã§ã0ãŸãã¯ç©ºæåãå€ããªãå Žåã¯ç°å¢ã«ãã£ãŠèªåçã«æ±ºå®ãããŸãã
--cors_policy_mode {CorsPolicyMode.all,CorsPolicyMode.localapps}
CORSã®èš±å¯ã¢ãŒããallãŸãã¯localappsãæå®ã§ããŸããallã¯ãã¹ãŠãèš±å¯ããŸããlocalappsã¯ãªãªãžã³éãªãœãŒã¹å
±æããªã·ãŒããapp://.ãšlocalhosté¢é£ã«éå®ããŸãããã®ä»ã®ãªãªãžã³ã¯allow_originãªãã·ã§ã³ã§è¿œå ã§ããŸããããã©ã«ãã¯localappsã
--allow_origin [ALLOW_ORIGIN ...]
èš±å¯ãããªãªãžã³ãæå®ããŸããã¹ããŒã¹ã§åºåãããšã§è€æ°æå®ã§ããŸãã
--setting_file SETTING_FILE
èšå®ãã¡ã€ã«ãæå®ã§ããŸãã
--preset_file PRESET_FILE
ããªã»ãããã¡ã€ã«ãæå®ã§ããŸããæå®ããªãå Žåãç°å¢å€æ° VV_PRESET_FILEã--voicevox_dirã®presets.yamlãå®è¡ãã¡ã€ã«ã®ãã£ã¬ã¯ããªã®presets.yamlãé ã«æ¢ããŸãã
ã¢ããããŒã
ãšã³ãžã³ãã£ã¬ã¯ããªå ã«ãããã¡ã€ã«ãå šãŠæ¶å»ããæ°ãããã®ã«çœ®ãæããŠãã ããã
Docker ã€ã¡ãŒãž
CPU
docker pull voicevox/voicevox_engine:cpu-ubuntu20.04-latest
docker run --rm -p '127.0.0.1:50021:50021' voicevox/voicevox_engine:cpu-ubuntu20.04-latest
GPU
docker pull voicevox/voicevox_engine:nvidia-ubuntu20.04-latest
docker run --rm --gpus all -p '127.0.0.1:50021:50021' voicevox/voicevox_engine:nvidia-ubuntu20.04-latest
ãã©ãã«ã·ã¥ãŒãã£ã³ã°
GPU çãå©çšããå Žåãç°å¢ã«ãã£ãŠãšã©ãŒãçºçããããšããããŸãããã®å Žåã--runtime=nvidia
ãdocker run
ã«ã€ããŠå®è¡ãããšè§£æ±ºã§ããããšããããŸãã
è²¢ç®è ã®æ¹ãž
Issue ã解決ãããã«ãªã¯ãšã¹ããäœæãããéã¯ãå¥ã®æ¹ãšåã Issue ã«åãçµãããšãé¿ããããã Issue åŽã§åãçµã¿å§ããããšãäŒããããæåã« Draft ãã«ãªã¯ãšã¹ããäœæããŠãã ããã
VOICEVOX éå ¬åŒ Discord ãµãŒããŒã«ãŠãéçºã®è°è«ãéè«ãè¡ã£ãŠããŸããæ°è»œã«ãåå ãã ããã
ç°å¢æ§ç¯
Python 3.11.3
ãçšããŠéçºãããŠããŸãã
ã€ã³ã¹ããŒã«ããã«ã¯ãå OS ããšã® C/C++ ã³ã³ãã€ã©ãCMake ãå¿
èŠã«ãªããŸãã
# éçºã«å¿
èŠãªã©ã€ãã©ãªã®ã€ã³ã¹ããŒã«
python -m pip install -r requirements-dev.txt -r requirements-test.txt
# ãšããããå®è¡ãããã ããªã代ããã«ãã¡ã
python -m pip install -r requirements.txt
å®è¡
ã³ãã³ãã©ã€ã³åŒæ°ã®è©³çŽ°ã¯ä»¥äžã®ã³ãã³ãã§ç¢ºèªããŠãã ããã
python run.py --help
# 補åç VOICEVOX ã§ãµãŒããŒãèµ·å
VOICEVOX_DIR="C:/path/to/voicevox" # 補åç VOICEVOX ãã£ã¬ã¯ããªã®ãã¹
python run.py --voicevox_dir=$VOICEVOX_DIR
# ã¢ãã¯ã§ãµãŒããŒèµ·å
python run.py --enable_mock
# ãã°ãUTF8ã«å€æŽ
python run.py --output_log_utf8
# ããã㯠VV_OUTPUT_LOG_UTF8=1 python run.py
CPU ã¹ã¬ããæ°ãæå®ãã
CPU ã¹ã¬ããæ°ãæªæå®ã®å Žåã¯ãè«çã³ã¢æ°ã®ååãç©çã³ã¢æ°ã䜿ãããŸããïŒæ®ã©ã® CPU ã§ãããã¯å
šäœã®åŠçèœåã®ååã§ãïŒ
ãã IaaS äžã§å®è¡ããŠããããå°çšãµãŒããŒã§å®è¡ããŠããå Žåãªã©ã
ãšã³ãžã³ã䜿ãåŠçèœåã調ç¯ãããå Žåã¯ãCPU ã¹ã¬ããæ°ãæå®ããããšã§å®çŸã§ããŸãã
å®è¡æåŒæ°ã§æå®ãã
python run.py --voicevox_dir=$VOICEVOX_DIR --cpu_num_threads=4
ç°å¢å€æ°ã§æå®ãã
export VV_CPU_NUM_THREADS=4 python run.py --voicevox_dir=$VOICEVOX_DIR
éå»ã®ããŒãžã§ã³ã®ã³ã¢ã䜿ã
VOICEVOX Core 0.5.4 以éã®ã³ã¢ã䜿çšããäºãå¯èœã§ãã
Mac ã§ã® libtorch çã³ã¢ã®ãµããŒãã¯ããŠããŸããã
éå»ã®ãã€ããªãæå®ãã
補åç VOICEVOX ãããã¯ã³ã³ãã€ã«æžã¿ãšã³ãžã³ã®ãã£ã¬ã¯ããªã--voicevox_dir
åŒæ°ã§æå®ãããšããã®ããŒãžã§ã³ã®ã³ã¢ã䜿çšãããŸãã
python run.py --voicevox_dir="/path/to/voicevox"
Mac ã§ã¯ãDYLD_LIBRARY_PATH
ã®æå®ãå¿
èŠã§ãã
DYLD_LIBRARY_PATH="/path/to/voicevox" python run.py --voicevox_dir="/path/to/voicevox"
é³å£°ã©ã€ãã©ãªãçŽæ¥æå®ãã
VOICEVOX Core ã® zip ãã¡ã€ã«ã解åãããã£ã¬ã¯ããªã--voicelib_dir
åŒæ°ã§æå®ããŸãã
ãŸããã³ã¢ã®ããŒãžã§ã³ã«åãããŠãlibtorchãonnxruntimeã®ãã£ã¬ã¯ããªã--runtime_dir
åŒæ°ã§æå®ããŸãã
ãã ããã·ã¹ãã ã®æ¢çŽ¢ãã¹äžã« libtorchãonnxruntime ãããå Žåã--runtime_dir
åŒæ°ã®æå®ã¯äžèŠã§ãã--voicelib_dir
åŒæ°ã--runtime_dir
åŒæ°ã¯è€æ°å䜿çšå¯èœã§ãã
API ãšã³ããã€ã³ãã§ã³ã¢ã®ããŒãžã§ã³ãæå®ããå Žåã¯core_version
åŒæ°ãæå®ããŠãã ãããïŒæªæå®ã®å Žåã¯ææ°ã®ã³ã¢ã䜿çšãããŸãïŒ
python run.py --voicelib_dir="/path/to/voicevox_core" --runtime_dir="/path/to/libtorch_or_onnx"
Mac ã§ã¯ã--runtime_dir
åŒæ°ã®ä»£ããã«DYLD_LIBRARY_PATH
ã®æå®ãå¿
èŠã§ãã
DYLD_LIBRARY_PATH="/path/to/onnx" python run.py --voicelib_dir="/path/to/voicevox_core"
ã³ãŒããã©ãŒããã
ãã®ãœãããŠã§ã¢ã§ã¯ããªã¢ãŒãã«ããã·ã¥ããåã«ã³ãŒããã©ãŒãããã確èªããä»çµã¿(éç解æããŒã«)ãå©çšã§ããŸãã å©çšããã«ã¯ãéçºã«å¿ èŠãªã©ã€ãã©ãªã®ã€ã³ã¹ããŒã«ã«å ããŠã以äžã®ã³ãã³ããå®è¡ããŠãã ããã ãã«ãªã¯ãšã¹ããäœæããéã¯ãå©çšããããšãæšå¥šããŸãã
pre-commit install -t pre-push
ãšã©ãŒãåºãéã¯ã以äžã®ã³ãã³ãã§ä¿®æ£ããããšãå¯èœã§ãããªããå®å šã«ä¿®æ£ã§ããããã§ã¯ãªãã®ã§æ³šæããŠãã ããã
pysen run format lint
ãã¹ã
python -m pytest
ã¿ã€ããã§ãã¯
typos ã䜿ã£ãŠã¿ã€ãã®ãã§ãã¯ãè¡ã£ãŠããŸãã typos ãã€ã³ã¹ããŒã« ããåŸ
typos
ã§ã¿ã€ããã§ãã¯ãè¡ããŸãã
ãã誀å€å®ããã§ãã¯ããé€å€ãã¹ããã¡ã€ã«ãããã°
èšå®ãã¡ã€ã«ã®èª¬æ ã«åŸã£ãŠ_typos.toml
ãç·šéããŠãã ããã
API ããã¥ã¡ã³ãã®ç¢ºèª
API ããã¥ã¡ã³ãïŒå®äœã¯docs/api/index.html
ïŒã¯èªåã§æŽæ°ãããŸãã
次ã®ã³ãã³ã㧠API ããã¥ã¡ã³ããæåã§äœæããããšãã§ããŸãã
python make_docs.py
ãã«ã
ãã®æ¹æ³ã§ãã«ããããã®ã¯ããªãªãŒã¹ã§å ¬éãããŠãããã®ãšã¯ç°ãªããŸãã ãŸããGPU ã§å©çšããã«ã¯ cuDNN ã CUDAãDirectML ãªã©ã®ã©ã€ãã©ãªãè¿œå ã§å¿ èŠãšãªããŸãã
python -m pip install -r requirements-dev.txt
OUTPUT_LICENSE_JSON_PATH=licenses.json \
bash build_util/create_venv_and_generate_licenses.bash
# ã¢ãã¯ã§ãã«ãããå Žå
pyinstaller --noconfirm run.spec
# 補åçã§ãã«ãããå Žå
CORE_MODEL_DIR_PATH="/path/to/core_model" \
LIBCORE_PATH="/path/to/libcore" \
LIBONNXRUNTIME_PATH="/path/to/libonnxruntime" \
pyinstaller --noconfirm run.spec
äŸåé¢ä¿
æŽæ°
Poetry ãçšããŠäŸåã©ã€ãã©ãªã®ããŒãžã§ã³ãåºå®ããŠããŸãã 以äžã®ã³ãã³ãã§æäœã§ããŸã:
# ããã±ãŒãžãè¿œå ããå Žå
poetry add `ããã±ãŒãžå`
poetry add --group dev `ããã±ãŒãžå` # éçºäŸåã®è¿œå
poetry add --group test `ããã±ãŒãžå` # ãã¹ãäŸåã®è¿œå
# ããã±ãŒãžãã¢ããããŒãããå Žå
poetry update `ããã±ãŒãžå`
poetry update # å
šéšæŽæ°
# requirements.txtã®æŽæ°
poetry export --without-hashes -o requirements.txt # ãã¡ããæŽæ°ããå Žåã¯äžïŒã€ãæŽæ°ããå¿
èŠããããŸãã
poetry export --without-hashes --with dev -o requirements-dev.txt
poetry export --without-hashes --with test -o requirements-test.txt
poetry export --without-hashes --with license -o requirements-license.txt
ã©ã€ã»ã³ã¹
äŸåã©ã€ãã©ãªã¯ãã³ã¢ãã«ãæã«ãªã³ã¯ããŠäžäœåããŠããã³ã¢éšã®ã³ãŒãéå
¬é OKããªã©ã€ã»ã³ã¹ãæã€å¿
èŠããããŸãã
äž»èŠã©ã€ã»ã³ã¹ã®å¯åŠã¯ä»¥äžã®éãã§ãã
- MIT/Apache/BSD-3: OK
- LGPL: OK ïŒã³ã¢ãšåçåé¢ãããŠããããïŒ
- GPL: NG ïŒå šé¢é£ã³ãŒãã®å ¬éãå¿ èŠãªããïŒ
ãŠãŒã¶ãŒèŸæžã®æŽæ°ã«ã€ããŠ
以äžã®ã³ãã³ã㧠openjtalk ã®ãŠãŒã¶ãŒèŸæžãã³ã³ãã€ã«ã§ããŸãã
python -c "import pyopenjtalk; pyopenjtalk.create_user_dict('default.csv','user.dic')"
ãã«ããšã³ãžã³æ©èœã«é¢ããŠ
VOICEVOX ãšãã£ã¿ãŒã§ã¯ãè€æ°ã®ãšã³ãžã³ãåæã«èµ·åããããšãã§ããŸãã ãã®æ©èœãå©çšããããšã§ãèªäœã®é³å£°åæãšã³ãžã³ãæ¢åã®é³å£°åæãšã³ãžã³ã VOICEVOX ãšãã£ã¿ãŒäžã§åããããšãå¯èœã§ãã
ãã«ããšã³ãžã³æ©èœã®ä»çµã¿
VOICEVOX API ã«æºæ ããè€æ°ã®ãšã³ãžã³ã® Web API ãããŒããåããŠèµ·åããçµ±äžçã«æ±ãããšã§ãã«ããšã³ãžã³æ©èœãå®çŸããŠããŸãã ãšãã£ã¿ãŒãããããã®ãšã³ãžã³ãå®è¡ãã€ããªçµç±ã§èµ·åããEngineID ãšçµã³ã€ããŠèšå®ãç¶æ ãåå¥ç®¡çããŸãã
ãã«ããšã³ãžã³æ©èœãžã®å¯Ÿå¿æ¹æ³
VOICEVOX API æºæ ãšã³ãžã³ãèµ·åããå®è¡ãã€ããªãäœãããšã§å¯Ÿå¿ãå¯èœã§ãã VOICEVOX ENGINE ãªããžããªã fork ããäžéšã®æ©èœãæ¹é ããã®ãç°¡åã§ãã
æ¹é ãã¹ãç¹ã¯ãšã³ãžã³æ å ±ã»ãã£ã©ã¯ã¿ãŒæ å ±ã»é³å£°åæã®ïŒç¹ã§ãã
ãšã³ãžã³ã®æ
å ±ã¯ãšã³ãžã³ãããã§ã¹ãïŒengine_manifest.json
ïŒã§ç®¡çãããŠããŸãã
ãããã§ã¹ããã¡ã€ã«å
ã®æ
å ±ãèŠãŠé©å®å€æŽããŠãã ããã
é³å£°åæææ³ã«ãã£ãŠã¯ãäŸãã°ã¢ãŒãã£ã³ã°æ©èœãªã©ãVOICEVOX ãšåãæ©èœãæã€ããšãã§ããªãå ŽåããããŸãã
ãã®å Žåã¯ãããã§ã¹ããã¡ã€ã«å
ã®supported_features
å
ã®æ
å ±ãé©å®å€æŽããŠãã ããã
ãã£ã©ã¯ã¿ãŒæ
å ±ã¯speaker_info
ãã£ã¬ã¯ããªå
ã®ãã¡ã€ã«ã§ç®¡çãããŠããŸãã
ãããŒã®ã¢ã€ã³ã³ãªã©ãçšæãããŠããã®ã§é©å®å€æŽããŠãã ããã
é³å£°åæã¯voicevox_engine/synthesis_engine/synthesis_engine.py
ã§è¡ãããŠããŸãã
VOICEVOX API ã§ã®é³å£°åæã¯ããšã³ãžã³åŽã§é³å£°åæã¯ãšãªAudioQuery
ã®åæå€ãäœæããŠãŠãŒã¶ãŒã«è¿ãããŠãŒã¶ãŒãå¿
èŠã«å¿ããŠã¯ãšãªãç·šéããããšããšã³ãžã³ãã¯ãšãªã«åŸã£ãŠé³å£°åæããããšã§å®çŸããŠããŸãã
ã¯ãšãªäœæã¯/audio_query
ãšã³ããã€ã³ãã§ãé³å£°åæã¯/synthesis
ãšã³ããã€ã³ãã§è¡ã£ãŠãããæäœãã®ïŒã€ã«å¯Ÿå¿ããã° VOICEVOX API ã«æºæ ããããšã«ãªããŸãã
ãã«ããšã³ãžã³æ©èœå¯Ÿå¿ãšã³ãžã³ã®é åžæ¹æ³
VVPP ãã¡ã€ã«ãšããŠé
åžããã®ãããããã§ãã
VVPP ã¯ãVOICEVOX ãã©ã°ã€ã³ããã±ãŒãžãã®ç¥ã§ãäžèº«ã¯ãã«ããããšã³ãžã³ãªã©ãå«ãã ãã£ã¬ã¯ããªã® Zip ãã¡ã€ã«ã§ãã
æ¡åŒµåã.vvpp
ã«ãããšãããã«ã¯ãªãã¯ã§ VOICEVOX ãšãã£ã¿ãŒã«ã€ã³ã¹ããŒã«ã§ããŸãã
ãšãã£ã¿ãŒåŽã¯åãåã£ã VVPP ãã¡ã€ã«ãããŒã«ã«ãã£ã¹ã¯äžã« Zip å±éããããšãã«ãŒãã®çŽäžã«ããengine_manifest.json
ã«åŸã£ãŠãã¡ã€ã«ãæ¢æ»ããŸãã
VOICEVOX ãšãã£ã¿ãŒã«ããŸãèªã¿èŸŒãŸããããªããšãã¯ããšãã£ã¿ãŒã®ãšã©ãŒãã°ãåç
§ããŠãã ããã
ãŸããxxx.vvpp
ã¯åå²ããŠé£çªãä»ããxxx.0.vvppp
ãã¡ã€ã«ãšããŠé
åžããããšãå¯èœã§ãã
ããã¯ãã¡ã€ã«å®¹éã倧ãããŠé
åžãå°é£ãªå Žåã«æçšã§ãã
GitHub Actions
Variables
name | description |
---|---|
DOCKERHUB_USERNAME | Docker Hub ãŠãŒã¶å |
Secrets
name | description |
---|---|
DOCKERHUB_TOKEN | Docker Hub ã¢ã¯ã»ã¹ããŒã¯ã³ |
äºäŸçŽ¹ä»
voicevox-client @tuna2134  VOICEVOX ENGINE ã®ããã® Python ã©ãããŒ
ã©ã€ã»ã³ã¹
LGPL v3 ãšããœãŒã¹ã³ãŒãã®å ¬éãäžèŠãªå¥ã©ã€ã»ã³ã¹ã®ãã¥ã¢ã«ã©ã€ã»ã³ã¹ã§ãã å¥ã©ã€ã»ã³ã¹ãååŸãããå Žåã¯ãããïŒtwitter: @hiho_karutaïŒã«æ±ããŠãã ããã