piper-tts-plus 20250622.114312__py3-none-any.whl → 20250624.105509__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- piper/voice.py +86 -4
- {piper_tts_plus-20250622.114312.dist-info → piper_tts_plus-20250624.105509.dist-info}/METADATA +1 -1
- {piper_tts_plus-20250622.114312.dist-info → piper_tts_plus-20250624.105509.dist-info}/RECORD +6 -6
- {piper_tts_plus-20250622.114312.dist-info → piper_tts_plus-20250624.105509.dist-info}/WHEEL +0 -0
- {piper_tts_plus-20250622.114312.dist-info → piper_tts_plus-20250624.105509.dist-info}/entry_points.txt +0 -0
- {piper_tts_plus-20250622.114312.dist-info → piper_tts_plus-20250624.105509.dist-info}/top_level.txt +0 -0
piper/voice.py
CHANGED
@@ -7,8 +7,32 @@ from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
|
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
import onnxruntime
|
10
|
-
|
11
|
-
|
10
|
+
|
11
|
+
# Try to import piper_phonemize, but make it optional
|
12
|
+
try:
|
13
|
+
from piper_phonemize import phonemize_codepoints, phonemize_espeak, tashkeel_run
|
14
|
+
HAS_PIPER_PHONEMIZE = True
|
15
|
+
except ImportError:
|
16
|
+
HAS_PIPER_PHONEMIZE = False
|
17
|
+
# Provide fallback implementations
|
18
|
+
def phonemize_codepoints(text, lang=None):
|
19
|
+
# Simple fallback: return text as list of characters
|
20
|
+
return list(text)
|
21
|
+
|
22
|
+
def phonemize_espeak(text, voice=None):
|
23
|
+
# Simple fallback: return text as list of characters
|
24
|
+
return list(text)
|
25
|
+
|
26
|
+
def tashkeel_run(text):
|
27
|
+
# Simple fallback: return original text
|
28
|
+
return text
|
29
|
+
|
30
|
+
# Try to import pyopenjtalk, but make it optional
|
31
|
+
try:
|
32
|
+
import pyopenjtalk
|
33
|
+
HAS_PYOPENJTALK = True
|
34
|
+
except ImportError:
|
35
|
+
HAS_PYOPENJTALK = False
|
12
36
|
|
13
37
|
from .config import PhonemeType, PiperConfig
|
14
38
|
from .const import BOS, EOS, PAD
|
@@ -16,6 +40,33 @@ from .util import audio_float_to_int16
|
|
16
40
|
|
17
41
|
_LOGGER = logging.getLogger(__name__)
|
18
42
|
|
43
|
+
# Multi-character phoneme to PUA character mapping for Japanese
|
44
|
+
# This must match the C++ side and Python training side
|
45
|
+
MULTI_CHAR_TO_PUA = {
|
46
|
+
"a:": "\ue000",
|
47
|
+
"i:": "\ue001",
|
48
|
+
"u:": "\ue002",
|
49
|
+
"e:": "\ue003",
|
50
|
+
"o:": "\ue004",
|
51
|
+
"cl": "\ue005",
|
52
|
+
"ky": "\ue006",
|
53
|
+
"kw": "\ue007",
|
54
|
+
"gy": "\ue008",
|
55
|
+
"gw": "\ue009",
|
56
|
+
"ty": "\ue00a",
|
57
|
+
"dy": "\ue00b",
|
58
|
+
"py": "\ue00c",
|
59
|
+
"by": "\ue00d",
|
60
|
+
"ch": "\ue00e",
|
61
|
+
"ts": "\ue00f",
|
62
|
+
"sh": "\ue010",
|
63
|
+
"zy": "\ue011",
|
64
|
+
"hy": "\ue012",
|
65
|
+
"ny": "\ue013",
|
66
|
+
"my": "\ue014",
|
67
|
+
"ry": "\ue015",
|
68
|
+
}
|
69
|
+
|
19
70
|
|
20
71
|
@dataclass
|
21
72
|
class PiperVoice:
|
@@ -81,16 +132,47 @@ class PiperVoice:
|
|
81
132
|
phonemes = pyopenjtalk.g2p(text, kana=False).split()
|
82
133
|
|
83
134
|
converted = []
|
135
|
+
# Add BOS marker
|
136
|
+
converted.append("^")
|
137
|
+
|
84
138
|
for ph in phonemes:
|
85
139
|
if ph == "pau":
|
86
140
|
converted.append("_")
|
87
141
|
continue
|
142
|
+
|
143
|
+
if ph == "sil":
|
144
|
+
# Skip sil in the middle, it will be added as EOS
|
145
|
+
continue
|
88
146
|
|
89
147
|
# Devoiced vowels come back as upper-case (A,I,U,E,O)
|
148
|
+
# But NOT 'N' which is a special phoneme
|
90
149
|
if ph in {"A", "I", "U", "E", "O"}:
|
91
150
|
ph = ph.lower()
|
92
|
-
|
93
|
-
|
151
|
+
|
152
|
+
# Check if this is a multi-character phoneme that needs PUA mapping
|
153
|
+
if ph in MULTI_CHAR_TO_PUA:
|
154
|
+
converted.append(MULTI_CHAR_TO_PUA[ph])
|
155
|
+
else:
|
156
|
+
converted.append(ph)
|
157
|
+
|
158
|
+
# Add EOS marker
|
159
|
+
converted.append("$")
|
160
|
+
|
161
|
+
# Log readable phonemes if debug logging is enabled
|
162
|
+
if _LOGGER.isEnabledFor(logging.DEBUG):
|
163
|
+
readable_phonemes = []
|
164
|
+
for ph in converted:
|
165
|
+
if len(ph) == 1 and ord(ph) >= 0xE000 and ord(ph) <= 0xF8FF:
|
166
|
+
# Find the original multi-char phoneme
|
167
|
+
for orig, pua in MULTI_CHAR_TO_PUA.items():
|
168
|
+
if pua == ph:
|
169
|
+
readable_phonemes.append(orig)
|
170
|
+
break
|
171
|
+
else:
|
172
|
+
readable_phonemes.append(ph)
|
173
|
+
else:
|
174
|
+
readable_phonemes.append(ph)
|
175
|
+
_LOGGER.debug("Phonemized '%s' to: %s", text, ' '.join(readable_phonemes))
|
94
176
|
|
95
177
|
return [converted]
|
96
178
|
|
{piper_tts_plus-20250622.114312.dist-info → piper_tts_plus-20250624.105509.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: piper-tts-plus
|
3
|
-
Version:
|
3
|
+
Version: 20250624.105509
|
4
4
|
Summary: A fast, local neural text to speech system that sounds great and is optimized for the Raspberry Pi 4.
|
5
5
|
Home-page: https://github.com/ayutaz/piper-plus
|
6
6
|
Author: yousan
|
{piper_tts_plus-20250622.114312.dist-info → piper_tts_plus-20250624.105509.dist-info}/RECORD
RENAMED
@@ -6,10 +6,10 @@ piper/download.py,sha256=zyF2oyvuZiQr1HiAIBspiQByAcGOkXJfTj_KOecImxU,4604
|
|
6
6
|
piper/file_hash.py,sha256=HMuwrgEIg-bCOXHG0wE3vtjrqGD7QaA_UNfvBMXeUcY,1107
|
7
7
|
piper/http_server.py,sha256=12B9PJCY4UN_fcoH-gunxq7o3obj7NEfpXgo9tESKR4,4065
|
8
8
|
piper/util.py,sha256=QQnvx_HZGUk9gHCsqifR1ob7-2QRfN9jZMqF0poQS8k,397
|
9
|
-
piper/voice.py,sha256=
|
9
|
+
piper/voice.py,sha256=jCCoipLyHD44XYA1esE4HLftdPr13nB9i5Zl0MXqKLY,10172
|
10
10
|
piper/voices.json,sha256=pusxO-rZHvmWXkbRpp05lQCwYns7oKXAU6SIH3wFkUQ,130859
|
11
|
-
piper_tts_plus-
|
12
|
-
piper_tts_plus-
|
13
|
-
piper_tts_plus-
|
14
|
-
piper_tts_plus-
|
15
|
-
piper_tts_plus-
|
11
|
+
piper_tts_plus-20250624.105509.dist-info/METADATA,sha256=NhhN-9kpge9xgfb6mDFFv-D5tfunCnV0qk8PZMRePq0,1201
|
12
|
+
piper_tts_plus-20250624.105509.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
13
|
+
piper_tts_plus-20250624.105509.dist-info/entry_points.txt,sha256=R-zJAXMPM47DHJDk5K0toz7iOATx38RV98fkowMxj0o,46
|
14
|
+
piper_tts_plus-20250624.105509.dist-info/top_level.txt,sha256=3FjLp04vySCS6YYps6jbChyOvij45fGR-MHPpBFUIlw,6
|
15
|
+
piper_tts_plus-20250624.105509.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{piper_tts_plus-20250622.114312.dist-info → piper_tts_plus-20250624.105509.dist-info}/top_level.txt
RENAMED
File without changes
|