Skip to content

Commit e7bcc5b

Browse files
committed
Add support for new Chinese voices
1 parent 4a115cb commit e7bcc5b

8 files changed

Lines changed: 173 additions & 138 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ __pycache__/
1616
.tox/
1717

1818
/dist/
19+
/g2pW/

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2.2.0
4+
5+
- Bump `piper-tts` to 1.4.0
6+
- Add `zh` optional dependencies for new Chinese voices
7+
- Add `zeroconf` optional dependencies
8+
39
## 2.1.2
410

511
- Add `--data-dir /data` to Docker run script

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ RUN \
1212
python3 \
1313
python3-pip \
1414
python3-venv \
15+
wget \
1516
\
1617
&& python3 -m venv .venv \
1718
&& .venv/bin/pip3 install --no-cache-dir -U \
1819
setuptools \
1920
wheel \
2021
&& .venv/bin/pip3 install --no-cache-dir \
2122
--extra-index-url https://www.piwheels.org/simple \
22-
-e . \
23+
--extra-index-url https://download.pytorch.org/whl/cpu \
24+
-e '.[zeroconf,zh]' \
2325
\
26+
&& mkdir -p ./g2pW \
27+
&& wget -qO- 'https://huggingface.co/datasets/rhasspy/piper-checkpoints/resolve/main/zh/zh_CN/_resources/g2pw.tar.gz?download=true' | tar -xz -C ./g2pW \
2428
&& rm -rf /var/lib/apt/lists/*
2529

2630
COPY ./ ./

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "wyoming-piper"
3-
version = "2.1.2"
3+
version = "2.2.0"
44
description = "Wyoming Server for Piper"
55
readme = "README.md"
66
requires-python = ">=3.9"
@@ -22,7 +22,7 @@ classifiers = [
2222
dependencies = [
2323
"wyoming>=1.8,<2",
2424
"regex>=2024.11.6",
25-
"piper-tts>=1.3.0,<2",
25+
"piper-tts>=1.4.0,<2",
2626
"sentence-stream>=1.2.0,<2",
2727
]
2828

@@ -69,3 +69,9 @@ dev = [
6969
"numpy>=1.20,<2",
7070
"python-speech-features>=0.6,<1",
7171
]
72+
zeroconf = [
73+
"piper-tts[zeroconf]",
74+
]
75+
zh = [
76+
"piper-tts[zh]",
77+
]

script/setup

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ _VENV_DIR = _PROGRAM_DIR / ".venv"
1010

1111
parser = argparse.ArgumentParser()
1212
parser.add_argument("--dev", action="store_true", help="Install dev requirements")
13+
parser.add_argument("--zh", action="store_true", help="Install Chinese requirements")
1314
args = parser.parse_args()
1415

1516
# Create virtual environment
@@ -26,6 +27,9 @@ extras = []
2627
if args.dev:
2728
extras.append("dev")
2829

30+
if args.zh:
31+
extras.append("zh")
32+
2933
extras_str = ""
3034
if extras:
3135
extras_str = "[" + ",".join(extras) + "]"

wyoming_piper/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ async def main() -> None:
5555
)
5656
#
5757
parser.add_argument(
58-
"--auto-punctuation", default=".?!", help="Automatically add punctuation"
58+
"--auto-punctuation",
59+
default=".?!。?!.؟",
60+
help="Automatically add punctuation",
5961
)
6062
parser.add_argument("--samples-per-chunk", type=int, default=1024)
6163
parser.add_argument(

wyoming_piper/handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ async def _handle_synthesize(
260260
for i in range(num_chunks):
261261
offset = i * bytes_per_chunk
262262
chunk = audio_bytes[offset : offset + bytes_per_chunk]
263+
263264
await self.write_event(
264265
AudioChunk(
265266
audio=chunk,

0 commit comments

Comments
 (0)