Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VOICEVOX (AI speech synthesis) package for ROS Interface #337

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cf949de
Add voicevox (AI speech synthesis) package
iory Apr 16, 2022
f7a3740
[voicevox] Add README
iory Apr 17, 2022
23afd1f
[voicevox] Add TERM
iory Apr 17, 2022
357203a
[voicevox] Refactor Makefiles
iory Apr 17, 2022
745c17b
[voicevox] Ignore build directory
iory Apr 17, 2022
eebcb2e
[voicevox] Add python-requests
iory Apr 17, 2022
315f4f4
[voicevox] Fixed typo julius -> voicevox
iory Apr 18, 2022
0b74902
[voicevox] Add USE_SYSTEM_PACKAGES FALSE for building in melodic (#1)
tkmtnt7000 Apr 18, 2022
23da3d0
[voicevox] Install voicevox_engine using Makefile
iory Apr 18, 2022
4e44a1b
[voicevox] Fixed speaker id and voice name
iory Apr 18, 2022
7d1a440
[voicevox] Use python3 as default
iory Apr 18, 2022
5b6dc42
[voicevox] Convert bytes to str
iory Apr 18, 2022
7d1ee9d
[voicevox] Addy DEFAULT SPEAKER ID
iory Apr 18, 2022
452496c
[voicevox] Install open_jtalk_dic
iory Apr 18, 2022
429808d
[voicevox] Load downloaded of open_jtalk_dic
iory Apr 18, 2022
fae3612
[voicevox] Add tips
iory Apr 18, 2022
0b0e381
[voicevox] Remove unnecessary install step
iory Apr 19, 2022
3430e4b
[voicevox] Add get_cache_dir and check md5sum function
iory May 28, 2022
a8f1084
[voicevox] Enable cache
iory May 28, 2022
5b9d9de
[voicevox] Set default cpu numthreads to 1
iory May 28, 2022
7f5ede4
[voicevox] Update to 0.12.4
iory Aug 1, 2022
7f06342
[voicevox] Support arm64
iory Aug 1, 2022
62c0c3d
set version 2.1.24 as other packages
k-okada Sep 8, 2022
5bed4d9
Merge branch 'master' into voicevox
k-okada Sep 8, 2022
b7f20f4
[voicevox] Set default_voice of soundplay_node (#5)
nakane11 Sep 16, 2022
cdef654
add launch_sound_play arg in voicevox launch
knorth55 Oct 13, 2022
2002559
[voicevox] upgrade pyopenjtalk and set package versions in melodic an…
mqcmd196 Apr 12, 2024
a87fe11
[voicevox] downgrade numpy version required in pyopenjtalk
mqcmd196 Apr 12, 2024
a5e9bf6
Merge pull request #10 from mqcmd196/PR/fix-voicevox-build
iory Apr 15, 2024
1fa5313
Fix JSON serialization issue with numpy.float32 values in voicevox se…
iory May 13, 2024
3b58ae2
Merge branch 'master' into voicevox
iory May 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions 3rdparty/voicevox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build
dict
lib
node_scripts/voicevox_engine
requirements.txt
!.gitignore
73 changes: 73 additions & 0 deletions 3rdparty/voicevox/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
cmake_minimum_required(VERSION 2.8.3)
project(voicevox)

find_package(catkin REQUIRED
COMPONENTS
catkin_virtualenv
)

catkin_python_setup()

set(INSTALL_DIR ${PROJECT_SOURCE_DIR})

catkin_package()

catkin_generate_virtualenv(
INPUT_REQUIREMENTS requirements.in
PYTHON_INTERPRETER python3
USE_SYSTEM_PACKAGES FALSE
)

add_custom_command(
OUTPUT voicevox_model_installed
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.model
MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum
INSTALL_DIR=${INSTALL_DIR}
)


add_custom_command(
OUTPUT voicevox_core_installed
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.core
MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum
INSTALL_DIR=${INSTALL_DIR}
)

add_custom_command(
OUTPUT voicevox_engine_installed
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.engine
MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum
INSTALL_DIR=${INSTALL_DIR}
)

add_custom_command(
OUTPUT open_jtalk_dic_installed
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.open_jtalk_dic
MD5SUM_DIR=${PROJECT_SOURCE_DIR}/md5sum
INSTALL_DIR=${INSTALL_DIR}
)

add_custom_target(all_installed ALL DEPENDS
voicevox_model_installed
voicevox_core_installed
voicevox_engine_installed
open_jtalk_dic_installed)

file(GLOB NODE_SCRIPTS_FILES node_scripts/*.py)
catkin_install_python(
PROGRAMS ${NODE_SCRIPTS_FILES}
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}/node_scripts/
)
install(DIRECTORY node_scripts/voicevox_engine
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/catkin_virtualenv_scripts/
USE_SOURCE_PERMISSIONS)
install(DIRECTORY launch dict
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
USE_SOURCE_PERMISSIONS)
install(PROGRAMS bin/text2wave
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/bin)

install(DIRECTORY
${INSTALL_DIR}/lib
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
USE_SOURCE_PERMISSIONS)
11 changes: 11 additions & 0 deletions 3rdparty/voicevox/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
all:
make -f Makefile.core
make -f Makefile.model
make -f Makefile.engine
make -f Makefile.open_jtalk_dic
clean:
make -f Makefile.core clean
make -f Makefile.model clean
make -f Makefile.engine clean
make -f Makefile.open_jtalk_dic clean
rm -rf build
36 changes: 36 additions & 0 deletions 3rdparty/voicevox/Makefile.core
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- makefile -*-

all: installed.viocevox_core

VERSION = 0.12.4
MD5SUM_DIR = $(CURDIR)/md5sum
ifeq ($(shell uname -m),x86_64)
DIRNAME = voicevox_core-linux-x64-cpu-$(VERSION)
FILENAME = voicevox_core-linux-x64-cpu-$(VERSION).zip
SOURCE_DIR = build/voicevox_core-linux-x64-cpu-$(VERSION)
MD5SUM_FILE = $(MD5SUM_DIR)/core-linux-x64-cpu.md5sum
endif
ifeq ($(shell uname -m),aarch64)
DIRNAME = voicevox_core-linux-arm64-cpu-$(VERSION)
FILENAME = voicevox_core-linux-arm64-cpu-$(VERSION).zip
SOURCE_DIR = build/voicevox_core-linux-arm64-cpu-$(VERSION)
MD5SUM_FILE = $(MD5SUM_DIR)/core-linux-arm64-cpu.md5sum
endif

TARBALL_URL = "https://github.com/VOICEVOX/voicevox_core/releases/download/$(VERSION)/$(FILENAME)"
TARBALL = build/$(FILENAME)
UNPACK_CMD = unzip
SCRIPT_DIR = $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
include $(shell rospack find mk)/download_unpack_build.mk
INSTALL_DIR = './'


installed.viocevox_core: $(SOURCE_DIR)/unpacked
mkdir -p $(INSTALL_DIR)/lib
cp build/$(DIRNAME)/lib*.so $(INSTALL_DIR)/lib/

clean:
rm -rf $(TARBALL)
rm -rf $(SOURCE_DIR)
rm -rf $(INSTALL_DIR)/lib
rm -rf build
24 changes: 24 additions & 0 deletions 3rdparty/voicevox/Makefile.engine
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- makefile -*-

all: installed.voicevox_engine

VERSION = 0.12.4
FILENAME = $(VERSION).tar.gz
TARBALL = build/$(FILENAME)
TARBALL_URL = "https://github.com/VOICEVOX/voicevox_engine/archive/refs/tags/$(FILENAME)"
SOURCE_DIR = build/voicevox_engine-$(VERSION)
UNPACK_CMD = tar xvzf
MD5SUM_DIR = $(CURDIR)/md5sum
MD5SUM_FILE = $(MD5SUM_DIR)/voicevox_engine.tar.gz.md5sum
include $(shell rospack find mk)/download_unpack_build.mk
INSTALL_DIR = './'


installed.voicevox_engine: $(SOURCE_DIR)/unpacked
cp -r build/voicevox_engine-$(VERSION) $(INSTALL_DIR)/node_scripts/voicevox_engine

clean:
rm -rf $(TARBALL)
rm -rf $(SOURCE_DIR)
rm -rf $(INSTALL_DIR)/node_scripts/voicevox_engine
rm -rf build
33 changes: 33 additions & 0 deletions 3rdparty/voicevox/Makefile.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- makefile -*-

all: installed.voicevox_model

VERSION = 1.10.0
ifeq ($(shell uname -m),x86_64)
DIRNAME = onnxruntime-linux-x64-$(VERSION)
endif
ifeq ($(shell uname -m),aarch64)
DIRNAME = onnxruntime-linux-aarch64-$(VERSION)
endif

SOURCE_DIR = build/$(DIRNAME)
FILENAME = $(DIRNAME).tgz
TARBALL = build/$(FILENAME)
TARBALL_URL = "https://github.com/microsoft/onnxruntime/releases/download/v$(VERSION)/$(FILENAME)"
UNPACK_CMD = tar xvzf
MD5SUM_DIR = $(CURDIR)/md5sum
MD5SUM_FILE = $(MD5SUM_DIR)/$(FILENAME).md5sum
SCRIPT_DIR = $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
include $(shell rospack find mk)/download_unpack_build.mk
INSTALL_DIR = './'


installed.voicevox_model: $(SOURCE_DIR)/unpacked
mkdir -p $(INSTALL_DIR)/lib
cp build/$(DIRNAME)/lib/* $(INSTALL_DIR)/lib

clean:
rm -rf $(TARBALL)
rm -rf $(SOURCE_DIR)
rm -rf $(INSTALL_DIR)/lib
rm -rf build
25 changes: 25 additions & 0 deletions 3rdparty/voicevox/Makefile.open_jtalk_dic
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- makefile -*-

all: installed.open_jtalk_dic

VERSION = 1.11.1
FILENAME = open_jtalk_dic_utf_8-1.11.tar.gz
TARBALL = build/$(FILENAME)
TARBALL_URL = "https://github.com/r9y9/open_jtalk/releases/download/v$(VERSION)/$(FILENAME)"
SOURCE_DIR = build/open_jtalk_dic_utf_8-1.11
UNPACK_CMD = tar xvzf
MD5SUM_DIR = $(CURDIR)/md5sum
MD5SUM_FILE = $(MD5SUM_DIR)/open_jtalk_dic.tar.gz.md5sum
include $(shell rospack find mk)/download_unpack_build.mk
INSTALL_DIR = './'


installed.open_jtalk_dic: $(SOURCE_DIR)/unpacked
mkdir -p $(INSTALL_DIR)/dict
cp -r build/open_jtalk_dic_utf_8-1.11 $(INSTALL_DIR)/dict

clean:
rm -rf $(TARBALL)
rm -rf $(SOURCE_DIR)
rm -rf $(INSTALL_DIR)/dict/open_jtalk_dic_utf_8-1.11
rm -rf build
103 changes: 103 additions & 0 deletions 3rdparty/voicevox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# voicevox

ROS Interface for [VOICEVOX](https://voicevox.hiroshiba.jp/) (AI speech synthesis)

## TERM

[VOICEVOX](https://voicevox.hiroshiba.jp/) is basically free to use, but please check the terms of use below.

[TERM](https://voicevox.hiroshiba.jp/term)

Each voice synthesis character has its own rules. Please use this package according to those terms.

| Character name | term link |
| ---- | ---- |
| 四国めたん | https://zunko.jp/con_ongen_kiyaku.html |
| ずんだもん | https://zunko.jp/con_ongen_kiyaku.html |
| 春日部つむぎ | https://tsukushinyoki10.wixsite.com/ktsumugiofficial/利用規約 |
| 波音リツ | http://canon-voice.com/kiyaku.html |
| 雨晴はう | https://amehau.com/?page_id=225 |
| 玄野武宏 | https://virvoxproject.wixsite.com/official/voicevoxの利用規約 |
| 白上虎太郎 | https://virvoxproject.wixsite.com/official/voicevoxの利用規約 |
| 青山龍星 | https://virvoxproject.wixsite.com/official/voicevoxの利用規約 |
| 冥鳴ひまり | https://kotoran8zunzun.wixsite.com/my-site/利用規約 |
| 九州そら | https://zunko.jp/con_ongen_kiyaku.html |

## Installation

Build this package.

```bash
cd /path/to/catkin_workspace
catkin build voicevox
```

## Usage

### Launch sound_play with VOICEVOX Text-to-Speech

```bash
roslaunch voicevox voicevox_texttospeech.launch
```

<a id="saysomething"></a>
### Say something

#### For python users

```python
import rospy
from sound_play.libsoundplay import SoundClient

rospy.init_node('say_node')

client = SoundClient(sound_action='robotsound_jp', sound_topic='robotsound_jp')

client.say('こんにちは', voice='四国めたん-あまあま')
```

You can change the voice by changing the voice_name.
You can also specify the speaker id.
Look at the following tables for further details.

| speaker_id | voice_name |
| ---- | ---- |
| 0 | 四国めたん-あまあま |
| 1 | ずんだもん-あまあま |
| 2 | 四国めたん-ノーマル |
| 3 | ずんだもん-ノーマル |
| 4 | 四国めたん-セクシー |
| 5 | ずんだもん-セクシー |
| 6 | 四国めたん-ツンツン |
| 7 | ずんだもん-ツンツン |
| 8 | 春日部つむぎ-ノーマル |
| 9 | 波音リツ-ノーマル |
| 10 | 雨晴はう-ノーマル |
| 11 | 玄野武宏-ノーマル |
| 12 | 白上虎太郎-ノーマル |
| 13 | 青山龍星-ノーマル |
| 14 | 冥鳴ひまり-ノーマル |
| 15 | 九州そら-あまあま |
| 16 | 九州そら-ノーマル |
| 17 | 九州そら-セクシー |
| 18 | 九州そら-ツンツン |
| 19 | 九州そら-ささやき |

#### For roseus users

```
$ roseus
(load "package://pr2eus/speak.l")

(ros::roseus "say_node")

(speak "JSKへようこそ。" :lang "波音リツ" :wait t :topic-name "robotsound_jp")
```

### Tips

Normally, the server for speech synthesis starts up at `http://localhost:50021`.
You can change the url and port by setting values for `VOICEVOX_TEXTTOSPEECH_URL` and `VOICEVOX_TEXTTOSPEECH_PORT`.

You can also set the default character by setting `VOICEVOX_DEFAULT_SPEAKER_ID`.
Please refer to [here](#saysomething) for the speaker id.
Loading