Skip to content

Commit e5de02a

Browse files
authored
Merge pull request #532 from k-okada/voicevox
2 parents 37af272 + 34b9ff1 commit e5de02a

27 files changed

+1328
-1
lines changed

.github/workflows/python2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
- name: Check Python2
1616
run: |
1717
apt update -q && apt install -y -q python2
18-
python2 -m compileall .
18+
python2 -m compileall -x 'voicevox/' .

3rdparty/voicevox/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build
2+
dict
3+
lib
4+
node_scripts/voicevox_engine
5+
requirements.txt
6+
!.gitignore

3rdparty/voicevox/CMakeLists.txt

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
cmake_minimum_required(VERSION 2.8.3)
2+
project(voicevox)
3+
4+
find_package(catkin REQUIRED
5+
COMPONENTS
6+
catkin_virtualenv
7+
)
8+
9+
catkin_python_setup()
10+
11+
set(INSTALL_DIR ${PROJECT_SOURCE_DIR})
12+
13+
catkin_package()
14+
15+
find_package(Python3 QUIET COMPONENTS Interpreter)
16+
if(NOT Python3_FOUND)
17+
message(WARNING "voicevox requires python3")
18+
return()
19+
endif()
20+
# generate the virtualenv
21+
find_package(Python3 QUIET COMPONENTS Interpreter)
22+
if(Python3_FOUND)
23+
message(STATUS "Found Python: ${Python3_EXECUTABLE}")
24+
message(STATUS "Python Version: ${Python3_VERSION}")
25+
endif()
26+
27+
if("$ENV{ROS_DISTRO}" STREQUAL "melodic")
28+
set(REQUIREMENTS_TXT_FILE requirements_melodic.txt)
29+
elseif(Python3_VERSION VERSION_LESS "3.12")
30+
set(REQUIREMENTS_TXT_FILE requirements_noetic.txt)
31+
else()
32+
set(REQUIREMENTS_TXT_FILE requirements_python3.12.txt)
33+
endif()
34+
catkin_generate_virtualenv(
35+
INPUT_REQUIREMENTS ${REQUIREMENTS_TXT_FILE}
36+
PYTHON_INTERPRETER python3
37+
USE_SYSTEM_PACKAGES FALSE
38+
CHECK_VENV FALSE # Default TRUE
39+
)
40+
41+
add_custom_command(
42+
OUTPUT voicevox_model_installed
43+
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.model
44+
MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum
45+
INSTALL_DIR=${INSTALL_DIR}
46+
)
47+
48+
49+
add_custom_command(
50+
OUTPUT voicevox_core_installed
51+
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.core
52+
MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum
53+
INSTALL_DIR=${INSTALL_DIR}
54+
)
55+
56+
add_custom_command(
57+
OUTPUT voicevox_engine_installed
58+
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.engine
59+
MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum
60+
INSTALL_DIR=${INSTALL_DIR}
61+
)
62+
63+
add_custom_command(
64+
OUTPUT open_jtalk_dic_installed
65+
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.open_jtalk_dic
66+
MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum
67+
INSTALL_DIR=${INSTALL_DIR}
68+
)
69+
70+
add_custom_target(all_installed ALL DEPENDS
71+
voicevox_model_installed
72+
voicevox_core_installed
73+
voicevox_engine_installed
74+
open_jtalk_dic_installed)
75+
76+
file(GLOB NODE_SCRIPTS_FILES node_scripts/*.py)
77+
catkin_install_python(
78+
PROGRAMS ${NODE_SCRIPTS_FILES}
79+
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}/node_scripts/
80+
)
81+
install(DIRECTORY node_scripts/voicevox_engine
82+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/catkin_virtualenv_scripts/
83+
USE_SOURCE_PERMISSIONS)
84+
install(DIRECTORY launch dict
85+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
86+
USE_SOURCE_PERMISSIONS)
87+
install(PROGRAMS bin/text2wave
88+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/bin)
89+
90+
install(DIRECTORY
91+
${INSTALL_DIR}/lib
92+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
93+
USE_SOURCE_PERMISSIONS)

3rdparty/voicevox/LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2021 Hiroshiba Kazuyuki
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

3rdparty/voicevox/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
all:
2+
make -f Makefile.core
3+
make -f Makefile.model
4+
make -f Makefile.engine
5+
make -f Makefile.open_jtalk_dic
6+
clean:
7+
make -f Makefile.core clean
8+
make -f Makefile.model clean
9+
make -f Makefile.engine clean
10+
make -f Makefile.open_jtalk_dic clean
11+
rm -rf build

3rdparty/voicevox/Makefile.core

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# -*- makefile -*-
2+
3+
all: installed.viocevox_core
4+
5+
VERSION = 0.12.4
6+
MD5SUM_DIR = $(CURDIR)/md5sum
7+
ifeq ($(shell uname -m),x86_64)
8+
DIRNAME = voicevox_core-linux-x64-cpu-$(VERSION)
9+
FILENAME = voicevox_core-linux-x64-cpu-$(VERSION).zip
10+
SOURCE_DIR = build/voicevox_core-linux-x64-cpu-$(VERSION)
11+
MD5SUM_FILE = $(MD5SUM_DIR)/core-linux-x64-cpu.md5sum
12+
endif
13+
ifeq ($(shell uname -m),aarch64)
14+
DIRNAME = voicevox_core-linux-arm64-cpu-$(VERSION)
15+
FILENAME = voicevox_core-linux-arm64-cpu-$(VERSION).zip
16+
SOURCE_DIR = build/voicevox_core-linux-arm64-cpu-$(VERSION)
17+
MD5SUM_FILE = $(MD5SUM_DIR)/core-linux-arm64-cpu.md5sum
18+
endif
19+
20+
TARBALL_URL = "https://github.com/VOICEVOX/voicevox_core/releases/download/$(VERSION)/$(FILENAME)"
21+
TARBALL = build/$(FILENAME)
22+
UNPACK_CMD = unzip
23+
SCRIPT_DIR = $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
24+
include $(shell rospack find mk)/download_unpack_build.mk
25+
INSTALL_DIR = './'
26+
27+
28+
installed.viocevox_core: $(SOURCE_DIR)/unpacked
29+
mkdir -p $(INSTALL_DIR)/lib
30+
cp build/$(DIRNAME)/lib*.so $(INSTALL_DIR)/lib/
31+
32+
clean:
33+
rm -rf $(TARBALL)
34+
rm -rf $(SOURCE_DIR)
35+
rm -rf $(INSTALL_DIR)/lib
36+
rm -rf build

3rdparty/voicevox/Makefile.engine

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -*- makefile -*-
2+
3+
all: installed.voicevox_engine
4+
5+
VERSION = 0.12.4
6+
FILENAME = $(VERSION).tar.gz
7+
TARBALL = build/$(FILENAME)
8+
TARBALL_URL = "https://github.com/VOICEVOX/voicevox_engine/archive/refs/tags/$(FILENAME)"
9+
SOURCE_DIR = build/voicevox_engine-$(VERSION)
10+
UNPACK_CMD = tar xvzf
11+
MD5SUM_DIR = $(CURDIR)/md5sum
12+
MD5SUM_FILE = $(MD5SUM_DIR)/voicevox_engine.tar.gz.md5sum
13+
include $(shell rospack find mk)/download_unpack_build.mk
14+
INSTALL_DIR = './'
15+
16+
17+
installed.voicevox_engine: $(SOURCE_DIR)/unpacked
18+
cp -r build/voicevox_engine-$(VERSION) $(INSTALL_DIR)/node_scripts/voicevox_engine
19+
20+
clean:
21+
rm -rf $(TARBALL)
22+
rm -rf $(SOURCE_DIR)
23+
rm -rf $(INSTALL_DIR)/node_scripts/voicevox_engine
24+
rm -rf build

3rdparty/voicevox/Makefile.model

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# -*- makefile -*-
2+
3+
all: installed.voicevox_model
4+
5+
VERSION = 1.10.0
6+
ifeq ($(shell uname -m),x86_64)
7+
DIRNAME = onnxruntime-linux-x64-$(VERSION)
8+
endif
9+
ifeq ($(shell uname -m),aarch64)
10+
DIRNAME = onnxruntime-linux-aarch64-$(VERSION)
11+
endif
12+
13+
SOURCE_DIR = build/$(DIRNAME)
14+
FILENAME = $(DIRNAME).tgz
15+
TARBALL = build/$(FILENAME)
16+
TARBALL_URL = "https://github.com/microsoft/onnxruntime/releases/download/v$(VERSION)/$(FILENAME)"
17+
UNPACK_CMD = tar xvzf
18+
MD5SUM_DIR = $(CURDIR)/md5sum
19+
MD5SUM_FILE = $(MD5SUM_DIR)/$(FILENAME).md5sum
20+
SCRIPT_DIR = $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
21+
include $(shell rospack find mk)/download_unpack_build.mk
22+
INSTALL_DIR = './'
23+
24+
25+
installed.voicevox_model: $(SOURCE_DIR)/unpacked
26+
mkdir -p $(INSTALL_DIR)/lib
27+
cp build/$(DIRNAME)/lib/* $(INSTALL_DIR)/lib
28+
29+
clean:
30+
rm -rf $(TARBALL)
31+
rm -rf $(SOURCE_DIR)
32+
rm -rf $(INSTALL_DIR)/lib
33+
rm -rf build
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- makefile -*-
2+
3+
all: installed.open_jtalk_dic
4+
5+
VERSION = 1.11.1
6+
FILENAME = open_jtalk_dic_utf_8-1.11.tar.gz
7+
TARBALL = build/$(FILENAME)
8+
TARBALL_URL = "https://github.com/r9y9/open_jtalk/releases/download/v$(VERSION)/$(FILENAME)"
9+
SOURCE_DIR = build/open_jtalk_dic_utf_8-1.11
10+
UNPACK_CMD = tar xvzf
11+
MD5SUM_DIR = $(CURDIR)/md5sum
12+
MD5SUM_FILE = $(MD5SUM_DIR)/open_jtalk_dic.tar.gz.md5sum
13+
include $(shell rospack find mk)/download_unpack_build.mk
14+
INSTALL_DIR = './'
15+
16+
17+
installed.open_jtalk_dic: $(SOURCE_DIR)/unpacked
18+
mkdir -p $(INSTALL_DIR)/dict
19+
cp -r build/open_jtalk_dic_utf_8-1.11 $(INSTALL_DIR)/dict
20+
21+
clean:
22+
rm -rf $(TARBALL)
23+
rm -rf $(SOURCE_DIR)
24+
rm -rf $(INSTALL_DIR)/dict/open_jtalk_dic_utf_8-1.11
25+
rm -rf build

3rdparty/voicevox/README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# voicevox
2+
3+
ROS Interface for [VOICEVOX](https://voicevox.hiroshiba.jp/) (AI speech synthesis)
4+
5+
## TERM
6+
7+
[VOICEVOX](https://voicevox.hiroshiba.jp/) is basically free to use, but please check the terms of use below.
8+
9+
[TERM](https://voicevox.hiroshiba.jp/term)
10+
11+
Each voice synthesis character has its own rules. Please use this package according to those terms.
12+
13+
| Character name | term link |
14+
| ---- | ---- |
15+
| 四国めたん | https://zunko.jp/con_ongen_kiyaku.html |
16+
| ずんだもん | https://zunko.jp/con_ongen_kiyaku.html |
17+
| 春日部つむぎ | https://tsukushinyoki10.wixsite.com/ktsumugiofficial/利用規約 |
18+
| 波音リツ | http://canon-voice.com/kiyaku.html |
19+
| 雨晴はう | https://amehau.com/?page_id=225 |
20+
| 玄野武宏 | https://virvoxproject.wixsite.com/official/voicevoxの利用規約 |
21+
| 白上虎太郎 | https://virvoxproject.wixsite.com/official/voicevoxの利用規約 |
22+
| 青山龍星 | https://virvoxproject.wixsite.com/official/voicevoxの利用規約 |
23+
| 冥鳴ひまり | https://kotoran8zunzun.wixsite.com/my-site/利用規約 |
24+
| 九州そら | https://zunko.jp/con_ongen_kiyaku.html |
25+
26+
## Installation
27+
28+
Build this package.
29+
30+
```bash
31+
cd /path/to/catkin_workspace
32+
catkin build voicevox
33+
```
34+
35+
## Usage
36+
37+
### Launch sound_play with VOICEVOX Text-to-Speech
38+
39+
```bash
40+
roslaunch voicevox voicevox_texttospeech.launch
41+
```
42+
43+
<a id="saysomething"></a>
44+
### Say something
45+
46+
#### For python users
47+
48+
```python
49+
import rospy
50+
from sound_play.libsoundplay import SoundClient
51+
52+
rospy.init_node('say_node')
53+
54+
client = SoundClient(sound_action='robotsound_jp', sound_topic='robotsound_jp')
55+
56+
client.say('こんにちは', voice='四国めたん-あまあま')
57+
```
58+
59+
You can change the voice by changing the voice_name.
60+
You can also specify the speaker id.
61+
Look at the following tables for further details.
62+
63+
| speaker_id | voice_name |
64+
| ---- | ---- |
65+
| 0 | 四国めたん-あまあま |
66+
| 1 | ずんだもん-あまあま |
67+
| 2 | 四国めたん-ノーマル |
68+
| 3 | ずんだもん-ノーマル |
69+
| 4 | 四国めたん-セクシー |
70+
| 5 | ずんだもん-セクシー |
71+
| 6 | 四国めたん-ツンツン |
72+
| 7 | ずんだもん-ツンツン |
73+
| 8 | 春日部つむぎ-ノーマル |
74+
| 9 | 波音リツ-ノーマル |
75+
| 10 | 雨晴はう-ノーマル |
76+
| 11 | 玄野武宏-ノーマル |
77+
| 12 | 白上虎太郎-ノーマル |
78+
| 13 | 青山龍星-ノーマル |
79+
| 14 | 冥鳴ひまり-ノーマル |
80+
| 15 | 九州そら-あまあま |
81+
| 16 | 九州そら-ノーマル |
82+
| 17 | 九州そら-セクシー |
83+
| 18 | 九州そら-ツンツン |
84+
| 19 | 九州そら-ささやき |
85+
86+
#### For roseus users
87+
88+
```
89+
$ roseus
90+
(load "package://pr2eus/speak.l")
91+
92+
(ros::roseus "say_node")
93+
94+
(speak "JSKへようこそ。" :lang "波音リツ" :wait t :topic-name "robotsound_jp")
95+
```
96+
97+
### Tips
98+
99+
Normally, the server for speech synthesis starts up at `http://localhost:50021`.
100+
You can change the url and port by setting values for `VOICEVOX_TEXTTOSPEECH_URL` and `VOICEVOX_TEXTTOSPEECH_PORT`.
101+
102+
You can also set the default character by setting `VOICEVOX_DEFAULT_SPEAKER_ID`.
103+
Please refer to [here](#saysomething) for the speaker id.

0 commit comments

Comments
 (0)