https://github.com/mgonzs13/piper_ros
piper Text-to-Speech (https://github.com/rhasspy/piper) for ROS 2
https://github.com/mgonzs13/piper_ros
cpp piper piper-tts ros2 text-to-speech tts
Last synced: 4 months ago
JSON representation
piper Text-to-Speech (https://github.com/rhasspy/piper) for ROS 2
- Host: GitHub
- URL: https://github.com/mgonzs13/piper_ros
- Owner: mgonzs13
- License: mit
- Created: 2024-12-28T10:21:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-05T15:50:01.000Z (about 1 year ago)
- Last Synced: 2025-04-05T16:29:47.234Z (about 1 year ago)
- Topics: cpp, piper, piper-tts, ros2, text-to-speech, tts
- Language: C++
- Homepage:
- Size: 1.15 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# piper_ros
This repository provides a set of ROS 2 packages to integrate [piper](https://github.com/OHF-Voice/piper1-gpl) TTS (Text-to-Speech) into ROS 2 using [audio_common](https://github.com/mgonzs13/audio_common).
[](https://opensource.org/license/mit) [](https://github.com/mgonzs13/piper_ros/releases) [](https://github.com/mgonzs13/piper_ros?branch=main) [](https://github.com/mgonzs13/piper_ros/commits/main) [](https://github.com/mgonzs13/piper_ros/issues) [](https://github.com/mgonzs13/piper_ros/pulls) [](https://github.com/mgonzs13/piper_ros/graphs/contributors) [](https://github.com/mgonzs13/piper_ros/actions/workflows/python-formatter.yml?branch=main) [](https://github.com/mgonzs13/piper_ros/actions/workflows/cpp-formatter.yml?branch=main) [](https://mgonzs13.github.io/piper_ros/latest)
| ROS 2 Distro | Branch | Build status | Docker Image |
| :----------: | :-------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------: |
| **Humble** | [`main`](https://github.com/mgonzs13/piper_ros/tree/main) | [](https://github.com/mgonzs13/piper_ros/actions/workflows/humble-build-test.yml?branch=main) | [](https://hub.docker.com/r/mgons/piper_ros/tags?name=humble) |
| **Iron** | [`main`](https://github.com/mgonzs13/piper_ros/tree/main) | [](https://github.com/mgonzs13/piper_ros/actions/workflows/iron-build-test.yml?branch=main) | [](https://hub.docker.com/r/mgons/piper_ros/tags?name=iron) |
| **Jazzy** | [`main`](https://github.com/mgonzs13/piper_ros/tree/main) | [](https://github.com/mgonzs13/piper_ros/actions/workflows/jazzy-build-test.yml?branch=main) | [](https://hub.docker.com/r/mgons/piper_ros/tags?name=jazzy) |
| **Kilted** | [`main`](https://github.com/mgonzs13/piper_ros/tree/main) | [](https://github.com/mgonzs13/piper_ros/actions/workflows/kilted-build-test.yml?branch=main) | [](https://hub.docker.com/r/mgons/piper_ros/tags?name=kilted) |
| **Rolling** | [`main`](https://github.com/mgonzs13/piper_ros/tree/main) | [](https://github.com/mgonzs13/piper_ros/actions/workflows/rolling-build-test.yml?branch=main) | [](https://hub.docker.com/r/mgons/piper_ros/tags?name=rolling) |
## Table of Contents
1. [Installation](#installation)
2. [Docker](#docker)
3. [Usage](#usage)
4. [Params](#params)
## Installation
To run piper_ros follow the next commands:
```shell
cd ~/ros2_ws/src
git clone https://github.com/mgonzs13/piper_ros.git
cd ~/ros2_ws
vcs import src < src/whisper_ros/dependencies.repos
rosdep install --from-paths src --ignore-src -r -y
colcon build
```
## Docker
You can build the piper_ros docker:
```shell
docker build -t piper_ros .
```
Then, you can run the docker container:
```shell
docker run -it --rm --device /dev/snd piper_ros
```
## Usage
```shell
ros2 launch piper_bringup piper.launch.py
```
```shell
ros2 action send_goal /say audio_common_msgs/action/TTS "{'text': 'Hello World from ros 2'}"
```
### Spanish Example
```shell
ros2 launch piper_bringup piper_spanish.launch.py
```
```shell
ros2 action send_goal /say audio_common_msgs/action/TTS "{'text': 'Hola Mundo desde ros 2'}"
```
## Params
### General Parameters
| Param | Type | Default | Description |
| ---------- | -------- | ------- | ---------------------------------------------------- |
| `chunk` | `int32` | `512` | Chunk size in samples for audio publication. |
| `frame_id` | `string` | `""` | Frame ID attached to published AudioStamped headers. |
### Model Parameters (`model.*`)
| Param | Type | Default | Description |
| ----------------------- | -------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `model.repo` | `string` | `"rhasspy/piper-voices"` | HuggingFace repository for model download. |
| `model.filename` | `string` | `"en/en_US/lessac/low/en_US-lessac-low.onnx"` | Filename of the model in the repository. |
| `model.path` | `string` | `""` | Local path to the voice model file. If empty, the model is downloaded from `model.repo`. |
| `model.config_repo` | `string` | `"rhasspy/piper-voices"` | HuggingFace repository for the model config download. |
| `model.config_filename` | `string` | `"en/en_US/lessac/low/en_US-lessac-low.onnx.json"` | Filename of the model config in the repository. |
| `model.config_path` | `string` | `""` | Local path to the JSON voice config file. If empty, the config is downloaded from `model.config_repo`. |
### Synthesis Parameters (`synthesis.*`)
| Param | Type | Default | Description |
| ------------------------------------ | ------- | ------- | ------------------------------------------------------- |
| `synthesis.speaker_id` | `int32` | `0` | Numerical speaker ID for multi-speaker voices. |
| `synthesis.noise_scale` | `float` | `0.667` | Amount of noise added during audio generation. |
| `synthesis.length_scale` | `float` | `1.0` | Speed of speaking (1 = normal, < 1 faster, > 1 slower). |
| `synthesis.noise_w_scale` | `float` | `0.8` | Variation in phoneme lengths during synthesis. |
| `synthesis.sentence_silence_seconds` | `float` | `0.2` | Seconds of silence inserted between sentences. |