Joshuant commited on
Commit
6cd92e1
·
verified ·
1 Parent(s): 5f6a457

Voxi Lite 1.0.0: emotion tags, payal's retrained styles (plain voices unchanged), name pronunciations, clean sentence endings

Browse files
Files changed (8) hide show
  1. CHANGELOG.md +16 -0
  2. Dockerfile +2 -2
  3. MANIFEST.json +8 -8
  4. README.md +43 -3
  5. config.json +1 -1
  6. voices.safetensors +1 -1
  7. voxi.py +93 -8
  8. writer.safetensors +1 -1
CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
  # Changelog
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ## 0.5.0 (2026-11-13)
4
 
5
  - **New voices:** `varun` and `vijay` (male) and `vysh` (female), learned from Maya 2 Native's built-in synthetic
 
1
  # Changelog
2
 
3
+ ## 1.0.0 (2026-11-13)
4
+
5
+ First launch release (was the 0.5.1 candidate).
6
+ - **Emotion tags:** call-friendly emotions as a voice (`payal@sorry`) or inline before the text they cover
7
+ (`[sorry] I'm so sorry. [cheerful] Good news!`): warm, cheerful, sorry, firm, calm, plus the six base styles and
8
+ `[neutral]`. A voice without styles speaks those parts plainly.
9
+ - **Payal's styles retrained** (lite9 A) on real emotional speech from AI4Bharat Rasa in 11 languages (22 speakers,
10
+ about 30 h, was 4). Only the style rows changed: every plain voice and every other writer weight is bit-identical to
11
+ 0.5.0 (checked at export).
12
+ - **Names in English:** Payal as PAA-yal and Voxi as VOK-see (were guessed as PAY-ul and VAHK-see). Per-voice
13
+ pronunciations: arjun says "tomorrow" with a shorter o.
14
+ - **Sentence endings:** no artificial hold on the last vowel; the moment after a sentence's last word is silent (no
15
+ hiss), and every rendered piece fades in and out over a few milliseconds (no clicks or cut-offs at sentence joins).
16
+ `VOXI_FADE_IN` / `VOXI_FADE_OUT` set the fades.
17
+ - Release check 22/22.
18
+
19
  ## 0.5.0 (2026-11-13)
20
 
21
  - **New voices:** `varun` and `vijay` (male) and `vysh` (female), learned from Maya 2 Native's built-in synthetic
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  # Voxi Lite server image (CPU). Build from the release folder:
2
- # docker build -t voxi-lite:0.5.0 .
3
- # docker run --rm -p 8080:8080 -e VOXI_THREADS=4 voxi-lite:0.5.0
4
  # One model per container; scale with more containers (about 1.5 GB RAM each). Nothing is downloaded at runtime.
5
  FROM python:3.11-slim
6
 
 
1
  # Voxi Lite server image (CPU). Build from the release folder:
2
+ # docker build -t voxi-lite:1.0.0 .
3
+ # docker run --rm -p 8080:8080 -e VOXI_THREADS=4 voxi-lite:1.0.0
4
  # One model per container; scale with more containers (about 1.5 GB RAM each). Nothing is downloaded at runtime.
5
  FROM python:3.11-slim
6
 
MANIFEST.json CHANGED
@@ -1,16 +1,16 @@
1
  {
2
  "name": "voxi-lite",
3
- "version": "0.5.0",
4
  "onnx_logmel_l1": 0.0385,
5
  "files": {
6
  ".dockerignore": "254b095cf3ce7c01084350dbd03c9524ab82c6abe906dd9fabd5a86639687966",
7
- "CHANGELOG.md": "2a3a18729bdcd6ee0defdaf08805bb22a536f69ac186b599efe96d13697b54c0",
8
- "Dockerfile": "695d6ff865fa1606ae75c883dd02034db5d773958798b09530fd1019f28d1299",
9
  "LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
10
  "NOTICE": "2fc69863a5eb219c3f46c01af6d625a56b1ea0497c0b612c43cea0ea26d8dc8b",
11
- "README.md": "7b2bab3ca35104b08ecec5e9b8590e77b03ab961db3b2d76c1ec7de2a5c13f7d",
12
  "banner.png": "cb4f4e38c924c943245af93d971764baa17b4e8d4d1d3c58c27f413e3e982d23",
13
- "config.json": "751c6147194064150821de29634c1eef5ac0b5b01a969b31b86019ea9f737c29",
14
  "decoder.safetensors": "4a5e3d638d4ee403365d05883c26745463407cb993f32b0b9929d674b956c5e2",
15
  "fast/decoder.onnx": "dde72786f10785304810659fb51e007e3ac5e2708122ac8f5e3ead45b616885c",
16
  "fast/exact_stft.py": "c9109e8023c3088cb328babfbd1934a3a0ca3c04f094097ac5d822d2739b7d69",
@@ -172,10 +172,10 @@
172
  "tests/latency.py": "95ca568b33f32a5352641ad10522db144d2e5a9cc975e05fa5e906e8aace8027",
173
  "tests/test_server.py": "90beb58455d388aad6f33337f8af9bbd64206e5968dd4ccf175bcda358652d41",
174
  "ui.html": "97ab2cea5097154832512f3d6666629be7ad13de9c8f8e99213b07454d095bbd",
175
- "voices.safetensors": "033018fac83db80cbc412b3bc009a5671aeac214fe39f014c5667b6e883f12c3",
176
- "voxi.py": "d0369df540393966ae223f50382bc06e330b06a47a09710d601a8ae2b21fd001",
177
  "warm_phrases.json": "015fff2d4b1ef95191bb31f0d5d12e7e22b12e47aab5d45cc9c3e8bd1b479350",
178
- "writer.safetensors": "ffa4dfc97e1284847bdfd4f3658308f62789b1f708829f0141b47673d86576fe",
179
  "writer_arjun.safetensors": "6fa673cdace2f146f79596688f7b98a5cfd39a83b346b3ab7fe48fc7d9a94b04",
180
  "writer_emo.safetensors": "b786f139a9e8b4689821aad829e21bdb345854bcd916aa32675a6809d7909f18"
181
  }
 
1
  {
2
  "name": "voxi-lite",
3
+ "version": "1.0.0",
4
  "onnx_logmel_l1": 0.0385,
5
  "files": {
6
  ".dockerignore": "254b095cf3ce7c01084350dbd03c9524ab82c6abe906dd9fabd5a86639687966",
7
+ "CHANGELOG.md": "4d15113e18695c0323f3482a337c99e1c71cee34b43972e1cd0d050e89a65b78",
8
+ "Dockerfile": "1291cc67e4f3b58ce77b9d8455e0d1636d5ea18adf90431477119d608df94d85",
9
  "LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
10
  "NOTICE": "2fc69863a5eb219c3f46c01af6d625a56b1ea0497c0b612c43cea0ea26d8dc8b",
11
+ "README.md": "3977881d63fcd995bb44ff63f73a316337e28d9ada9d8660443f6ae10b2da068",
12
  "banner.png": "cb4f4e38c924c943245af93d971764baa17b4e8d4d1d3c58c27f413e3e982d23",
13
+ "config.json": "9d3cb37a5d5ced0b3eeb92ab5fceeba3a2a8d1667799763e02e0b71aa8f8094c",
14
  "decoder.safetensors": "4a5e3d638d4ee403365d05883c26745463407cb993f32b0b9929d674b956c5e2",
15
  "fast/decoder.onnx": "dde72786f10785304810659fb51e007e3ac5e2708122ac8f5e3ead45b616885c",
16
  "fast/exact_stft.py": "c9109e8023c3088cb328babfbd1934a3a0ca3c04f094097ac5d822d2739b7d69",
 
172
  "tests/latency.py": "95ca568b33f32a5352641ad10522db144d2e5a9cc975e05fa5e906e8aace8027",
173
  "tests/test_server.py": "90beb58455d388aad6f33337f8af9bbd64206e5968dd4ccf175bcda358652d41",
174
  "ui.html": "97ab2cea5097154832512f3d6666629be7ad13de9c8f8e99213b07454d095bbd",
175
+ "voices.safetensors": "11aebacffcdf2fcf4aeb26fccf565e9635771d264da5dcbf5a45573efc973790",
176
+ "voxi.py": "efd766fcfbf3cca290c03c16573c0e4019ca070e94cb94cbeefe1a16a66329bd",
177
  "warm_phrases.json": "015fff2d4b1ef95191bb31f0d5d12e7e22b12e47aab5d45cc9c3e8bd1b479350",
178
+ "writer.safetensors": "73289e62bdc506ad240e692b96af5744816fa7707d2767e3820293cdd0b43c4c",
179
  "writer_arjun.safetensors": "6fa673cdace2f146f79596688f7b98a5cfd39a83b346b3ab7fe48fc7d9a94b04",
180
  "writer_emo.safetensors": "b786f139a9e8b4689821aad829e21bdb345854bcd916aa32675a6809d7909f18"
181
  }
README.md CHANGED
@@ -8,7 +8,7 @@ tags: [text-to-speech, indic, cpu, phone-agent, streaming]
8
 
9
  ![Voxi Lite: Indian phone-agent voices that run on a CPU](https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/banner.png)
10
 
11
- # Voxi Lite 0.5.0
12
 
13
  CPU text-to-speech for Indian phone-agent calls, with streaming. Voxi Lite is built on
14
  [Mithi v1 Flash](https://huggingface.co/Oomni/mithi-v1-flash) (Apache-2.0) with our own fine-tuned prosody writers
@@ -78,6 +78,26 @@ Hmm, let me check that for you. [laughs] Okay, your booking for tomorrow at 10 A
78
  Each sound has several takes that rotate, so repeats do not sound identical. Unknown tags are dropped silently.
79
  Breaths are not available. The English-only voices (harper, ethan, amelia, oliver) have no sound recordings.
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  ## Listen
82
 
83
  Every clip was made by this release on a CPU, with the default settings (24 kHz).
@@ -91,6 +111,26 @@ Every clip was made by this release on a CPU, with the default settings (24 kHz)
91
 
92
  Lines: *Hindi:* नमस्ते, मैं Voxi से बोल रही हूँ। आपका बकाया ₹1,250 है, जो 15 तारीख़ तक भरना है। · *Hinglish:* Aapka order kal shaam tak deliver ho jayega, aur tracking link SMS par bhej diya hai. · *Tamil:* வணக்கம்! உங்கள் ஆர்டர் நாளை மாலைக்குள் வந்துவிடும். வேறு ஏதாவது உதவி வேண்டுமா? · *Tanglish:* Vanakkam! Unga order naalaikku varum, tracking link SMS-la anuppirukom. · *English:* Thank you for calling. Your refund of rupees 2,400 has been processed and will reach you in three to five days.
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  ### English accents
95
 
96
  American and British English voices (`lang: en` only).
@@ -196,8 +236,8 @@ on the as-sent text: Voxi Lite 2 of 140, Mithi 4 of 140, MMS-TTS 8 of 80.
196
  ## Run the server
197
 
198
  ```bash
199
- docker build -t voxi-lite:0.5.0 .
200
- docker run --rm -p 8080:8080 -e VOXI_THREADS=4 -e VOXI_API_KEY=change-me voxi-lite:0.5.0
201
  # or without Docker (Python 3.11):
202
  pip install --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt
203
  VOXI_WARM=warm_phrases.json uvicorn server:app --host 0.0.0.0 --port 8080
 
8
 
9
  ![Voxi Lite: Indian phone-agent voices that run on a CPU](https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/banner.png)
10
 
11
+ # Voxi Lite 1.0.0
12
 
13
  CPU text-to-speech for Indian phone-agent calls, with streaming. Voxi Lite is built on
14
  [Mithi v1 Flash](https://huggingface.co/Oomni/mithi-v1-flash) (Apache-2.0) with our own fine-tuned prosody writers
 
78
  Each sound has several takes that rotate, so repeats do not sound identical. Unknown tags are dropped silently.
79
  Breaths are not available. The English-only voices (harper, ethan, amelia, oliver) have no sound recordings.
80
 
81
+ ## Emotions
82
+
83
+ Use an emotion as the voice (`"voice": "payal@sorry"`) or write it in the text before the part it covers:
84
+
85
+ ```text
86
+ Hello, this is Payal. [sorry] I'm really sorry for the delay. [cheerful] Good news, your refund is approved!
87
+ ```
88
+
89
+ | Emotion | Plays (payal, arjun) |
90
+ |---|---|
91
+ | `warm` | `@happy-soft` |
92
+ | `cheerful` | `@happy` |
93
+ | `sorry` | `@sad-soft` |
94
+ | `firm` | `@angry-soft` |
95
+ | `calm`, `neutral` | the plain voice |
96
+ | `happy`, `sad`, `angry`, `fearful`, `surprised`, `disgusted` | that style |
97
+
98
+ A tag lasts until the next tag. Voices without styles (sanjana, vishnu, varun, vijay, vysh, the English voices) read
99
+ tagged parts in their plain voice.
100
+
101
  ## Listen
102
 
103
  Every clip was made by this release on a CPU, with the default settings (24 kHz).
 
111
 
112
  Lines: *Hindi:* नमस्ते, मैं Voxi से बोल रही हूँ। आपका बकाया ₹1,250 है, जो 15 तारीख़ तक भरना है। · *Hinglish:* Aapka order kal shaam tak deliver ho jayega, aur tracking link SMS par bhej diya hai. · *Tamil:* வணக்கம்! உங்கள் ஆர்டர் நாளை மாலைக்குள் வந்துவிடும். வேறு ஏதாவது உதவி வேண்டுமா? · *Tanglish:* Vanakkam! Unga order naalaikku varum, tracking link SMS-la anuppirukom. · *English:* Thank you for calling. Your refund of rupees 2,400 has been processed and will reach you in three to five days.
113
 
114
+ ### Launch clips (1.0)
115
+
116
+ | Clip | Text | Listen |
117
+ |---|---|---|
118
+ | payal · en | Hello, I'm Payal from Voxi. [cheerful] I can talk to your customers in Hindi, Tamil and English, right from a regular computer. [laughs] No GPU needed! | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/01_payal_intro_en.wav"></audio> |
119
+ | payal · en | [sorry] I'm so sorry about the delay with your order. Hmm, let me check that for you. [cheerful] Good news! It's out for delivery, and it will reach you by 6 PM today. | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/03_payal_sorry_to_cheerful_en.wav"></audio> |
120
+ | payal · hi | [warm] नमस्ते! मैं पायल बोल रही हूँ। आपका फिर से स्वागत है। बताइए, मैं आपकी क्या मदद कर सकती हूँ? | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/04_payal_warm_hi.wav"></audio> |
121
+ | payal · hinglish | Haan ji, aapka EMI ₹4,999 har mahine ki 5 tareekh ko auto-debit hoga. [laughs] Aur koi sawaal ho toh bataiye! | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/05_payal_hinglish.wav"></audio> |
122
+ | arjun · en | [firm] This is a final reminder. Your payment of ₹12,500 is due by tomorrow evening. Please pay today to avoid late charges. | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/06_arjun_firm_en.wav"></audio> |
123
+ | arjun · hi | [cheerful] बधाई हो! आपका लोन मंज़ूर हो गया है। राशि कल तक आपके खाते में आ जाएगी। | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/07_arjun_cheerful_hi.wav"></audio> |
124
+ | arjun · ta | வணக்கம்! உங்கள் ஆர்டர் நாளை காலை 11 மணிக்குள் டெலிவரி செய்யப்படும். நன்றி! | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/08_arjun_tamil.wav"></audio> |
125
+ | varun · en | Mm-hmm, got it. Your booking for tomorrow at 10 AM is confirmed. See you then! | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/09_varun_en.wav"></audio> |
126
+ | vysh · hi | जी बिल्कुल। आपका OTP 482913 है। कृपया इसे किसी के साथ साझा न करें। | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/10_vysh_hi.wav"></audio> |
127
+ | vijay · tanglish | Sir, unga payment already process aayiduchu. Refund amount ₹1,500 next week-kulla account-la credit aagum. | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/11_vijay_tanglish.wav"></audio> |
128
+ | sanjana · ta | மன்னிக்கவும், உங்கள் கட்டணம் தோல்வியடைந்தது. தயவுசெய்து மீண்டும் முயற்சிக்கவும். | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/12_sanjana_tamil.wav"></audio> |
129
+ | harper · en | Thanks for calling! Your appointment is confirmed for tomorrow at 3 PM. | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/13_harper_us.wav"></audio> |
130
+ | ethan · en | Your package has shipped, and it should arrive on Friday. | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/14_ethan_us.wav"></audio> |
131
+ | amelia · en | Lovely to hear from you. Your refund has been processed. | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/15_amelia_uk.wav"></audio> |
132
+ | oliver · en | Good afternoon. Your account has been updated successfully. | <audio controls preload="none" src="https://huggingface.co/IOTEverythin/voxi-lite/resolve/main/samples/launch/16_oliver_uk.wav"></audio> |
133
+
134
  ### English accents
135
 
136
  American and British English voices (`lang: en` only).
 
236
  ## Run the server
237
 
238
  ```bash
239
+ docker build -t voxi-lite:1.0.0 .
240
+ docker run --rm -p 8080:8080 -e VOXI_THREADS=4 -e VOXI_API_KEY=change-me voxi-lite:1.0.0
241
  # or without Docker (Python 3.11):
242
  pip install --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt
243
  VOXI_WARM=warm_phrases.json uvicorn server:app --host 0.0.0.0 --port 8080
config.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "voxi-lite",
3
- "version": "0.5.0",
4
  "sample_rate": 24000,
5
  "languages": [
6
  "hi",
 
1
  {
2
  "name": "voxi-lite",
3
+ "version": "1.0.0",
4
  "sample_rate": 24000,
5
  "languages": [
6
  "hi",
voices.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:033018fac83db80cbc412b3bc009a5671aeac214fe39f014c5667b6e883f12c3
3
  size 14366408
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11aebacffcdf2fcf4aeb26fccf565e9635771d264da5dcbf5a45573efc973790
3
  size 14366408
voxi.py CHANGED
@@ -33,7 +33,9 @@ SR = 24000
33
  MAX_CHARS = 2000
34
  # Front-end fixes (2026-11-10, from the AI4Bharat benchmark failures); VOXI_FIXES="" turns them off for A/B tests
35
  # + prosody-code fixes (2026-11-12, WriterFixes): styletiming (styles on the plain voice's timing), endings (English)
36
- FIXES = {f for f in os.environ.get("VOXI_FIXES", "nasal,endpunct,chandra,styletiming,endings,sounds,en_in,pauses,sentsplit").split(",") if f}
 
 
37
  NASAL_N = re.compile(r"(̃ː?)n(?=[ʋsʃhjɾl])") # espeak hi: nasal vowel + stray n before v/s/sh/h/y/r/l
38
  END_MARK = {"hi": "।", "ta": ".", "en": ".", "hinglish": ".", "tanglish": "."}
39
  # chandrabindu after a vowel sign or independent vowel (2026-11-11): espeak hi turns it into vowel + n (आँख -> aːnkʰ,
@@ -57,7 +59,13 @@ def fix_nasal(phonemize_hi):
57
  # təmˈɑɹO, which our voices (learned from Indian English) render badly; Indian English says tʊmˈɔːɹO. Applied to the
58
  # words where American has ɑɹ and British ɒɹ (misaki's own two lexicons), names and loanwords left out.
59
  EN_IN_LEX = {"tomorrow": "tʊmˈɔːɹO", "borrow": "bˈɔːɹO", "borrower": "bˈɔːɹəwəɹ", "borrowing": "bˈɔːɹəwɪŋ",
60
- "majority": "məʤˈɔːɹəti"}
 
 
 
 
 
 
61
  # Mithi's normaliser turns "10 AM" into "ten a m" and misaki reads that "a" as the article (ɐ): "ten uh-em"
62
  EN_AM = re.compile(r"(?:one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|teen|ty|hundred|o'clock)\s+a m\b",
63
  re.I)
@@ -77,6 +85,9 @@ def fix_english(phonemes):
77
  norm, ps = phonemes(text, lang)
78
  if lang == "en" and EN_AM.search(norm):
79
  ps = ps.replace("ɐ ˈɛm", "ˈA ˈɛm")
 
 
 
80
  return norm, ps
81
  return wrapped
82
 
@@ -106,6 +117,22 @@ def split_pieces(text, long_clause=90):
106
  SENT_PAUSE = float(os.environ.get("VOXI_SENT_PAUSE", "0.45"))
107
 
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  def gap_after(ends_sentence):
110
  if ends_sentence:
111
  return max(0.15, SENT_PAUSE - 0.05) if "pauses" in FIXES else 0.15 # the closing mark adds ~50 ms itself
@@ -214,6 +241,11 @@ class WriterFixes:
214
  a sentence are at most 25 ms."""
215
 
216
  VOWELS = set("aeiouæɑɐɒɔəɛɜɪʊʌAEIOUWYQ")
 
 
 
 
 
217
  PUNCT = set(".,!?;:—…")
218
 
219
  def __init__(self, writer, voices, vocab, style_timing=True):
@@ -277,9 +309,9 @@ class WriterFixes:
277
  def _endings(self, dec, c):
278
  d = [int(x) for x in dec]
279
  sym = [self.inv.get(x, "") for x in d]
280
- for i in range(1, len(d) - 1): # word gaps inside a sentence: at most 1 unit (25 ms)
281
  if d[i] == self.space and sym[i - 1] not in self.PUNCT and sym[i + 1] not in self.PUNCT:
282
- c[i, 0] = min(int(c[i, 0]), 1)
283
  end = len(d) - 1
284
  while end > 0 and (sym[end] in self.PUNCT or d[end] == 0):
285
  end -= 1
@@ -289,11 +321,11 @@ class WriterFixes:
289
  vs = [i for i in range(start, end + 1) if sym[i] in self.VOWELS]
290
  if vs:
291
  v = vs[-1]
292
- c[v, 0] = max(int(c[v, 0]), 5) # final vowel >= 125 ms
293
  c[v, 2] = min(int(c[v, 2]), 1) # voiced to its end
294
- if bool((c[v, 3:8] != self.pitch_none).all()):
295
  for j in range(8, 11): # no whisper-level energy inside it
296
- c[v, j] = max(int(c[v, j]), self.sil_e + 16)
297
  for i in range(end + 1, len(d)): # closing mark and end pad: silent, unvoiced
298
  c[i, 3:8] = self.pitch_none
299
  c[i, 8:11] = self.sil_e
@@ -331,6 +363,13 @@ SOUND_ANY = re.compile(r"\[\s*(?P<tag>[A-Za-z][A-Za-z \-]{0,28}?)\s*\][,.]?"
331
  r"|(?<![\w'])(?P<umm>u+m+|u+h+|e+r+m+)(?![\w'-])[,.…]*"
332
  r"|(?P<hmm_hi>हम्म+्?)[,।]?|(?P<umm_hi>उम्म+्?)[,।]?", re.I)
333
  CLIP_GAP = 0.12 # silence between speech and a clip (s)
 
 
 
 
 
 
 
334
 
335
 
336
  class KokoroEngine:
@@ -458,7 +497,28 @@ class VoxiLite:
458
  return self._digits_en(text), lang # phone numbers / OTPs / IDs in groups; the rest to Mithi
459
  return text, lang
460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  def _check_voice(self, voice, lang=None):
 
462
  if voice not in self.voices:
463
  raise ValueError(f"unknown voice {voice!r}; have {self.voices}")
464
  if lang is not None and voice in self.english_only and lang != "en":
@@ -499,6 +559,17 @@ class VoxiLite:
499
 
500
  def synthesize(self, text, lang="hi", voice="payal", seed=None):
501
  self._check_voice(voice, lang)
 
 
 
 
 
 
 
 
 
 
 
502
  segs = self._sound_segments(text, voice)
503
  if segs is not None:
504
  gap = np.zeros(int(CLIP_GAP * SR), np.float32); out = []
@@ -526,12 +597,13 @@ class VoxiLite:
526
  def _checked(self, eng, text, mlang, voice, seed, retries=2):
527
  """Render; if the audio fails audio_issue(), try again with the next seeds and keep the first good take."""
528
  base = self.tts.settings["seed"] if seed is None else seed
 
529
  for k in range(retries + 1):
530
  y = np.asarray(eng.synthesize(text, lang=mlang, voice=voice, seed=base + k), np.float32)
531
  self.stats["renders"] += 1
532
  issue = audio_issue(y, text)
533
  if issue is None:
534
- return y
535
  self.stats["failed_checks"] += 1
536
  if k < retries:
537
  self.stats["retries"] += 1
@@ -552,6 +624,7 @@ class VoxiLite:
552
  is rendered the way stream() will chunk it."""
553
  for voice in voices or ["payal"]:
554
  self._check_voice(voice, lang)
 
555
  for ph in phrases:
556
  text, mlang = self.prepare(ph, lang)
557
  for chunk, _ in plan_chunks(text):
@@ -565,6 +638,18 @@ class VoxiLite:
565
  when the first chunk is yielded). Chunks found in the cache (warm()) are used whole.
566
  chunking="sentence": one chunk per sentence."""
567
  self._check_voice(voice, lang)
 
 
 
 
 
 
 
 
 
 
 
 
568
  segs = self._sound_segments(text, voice)
569
  if segs is None:
570
  yield from self._stream_text(text, lang, voice, seed, chunking, first_max, safety, max_chunk)
 
33
  MAX_CHARS = 2000
34
  # Front-end fixes (2026-11-10, from the AI4Bharat benchmark failures); VOXI_FIXES="" turns them off for A/B tests
35
  # + prosody-code fixes (2026-11-12, WriterFixes): styletiming (styles on the plain voice's timing), endings (English)
36
+ # endings since 2026-11-13: no held final vowel (owner's pick "E": it made "...due tomorrow." sound wrong), only the
37
+ # silent closing mark (pick "F": removes the hiss after a sentence) and the word-gap cap
38
+ FIXES = {f for f in os.environ.get("VOXI_FIXES", "nasal,endpunct,chandra,styletiming,endings,sounds,en_in,pauses,sentsplit,fade").split(",") if f}
39
  NASAL_N = re.compile(r"(̃ː?)n(?=[ʋsʃhjɾl])") # espeak hi: nasal vowel + stray n before v/s/sh/h/y/r/l
40
  END_MARK = {"hi": "।", "ta": ".", "en": ".", "hinglish": ".", "tanglish": "."}
41
  # chandrabindu after a vowel sign or independent vowel (2026-11-11): espeak hi turns it into vowel + n (आँख -> aːnkʰ,
 
59
  # təmˈɑɹO, which our voices (learned from Indian English) render badly; Indian English says tʊmˈɔːɹO. Applied to the
60
  # words where American has ɑɹ and British ɒɹ (misaki's own two lexicons), names and loanwords left out.
61
  EN_IN_LEX = {"tomorrow": "tʊmˈɔːɹO", "borrow": "bˈɔːɹO", "borrower": "bˈɔːɹəwəɹ", "borrowing": "bˈɔːɹəwɪŋ",
62
+ "majority": "məʤˈɔːɹəti",
63
+ # names (2026-11-13, owner's pick "F"): misaki guessed PAY-ul and VAHK-see
64
+ "payal": "pˈɑːjəl", "voxi": "vˈɒksi"}
65
+ # per-voice pronunciations (phoneme string replacements), for words one voice renders badly with the shared form:
66
+ # arjun's "tomorrow" with the long o sounded wrong; the owner picked the shorter o for him (2026-11-13, row "B")
67
+ EN_VOICE_SUB = {"arjun": {"tʊmˈɔːɹO": "tʊmˈɔɹO"}}
68
+ _CUR = __import__("threading").local() # the voice being rendered on this thread (set in VoxiLite._checked)
69
  # Mithi's normaliser turns "10 AM" into "ten a m" and misaki reads that "a" as the article (ɐ): "ten uh-em"
70
  EN_AM = re.compile(r"(?:one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|teen|ty|hundred|o'clock)\s+a m\b",
71
  re.I)
 
85
  norm, ps = phonemes(text, lang)
86
  if lang == "en" and EN_AM.search(norm):
87
  ps = ps.replace("ɐ ˈɛm", "ˈA ˈɛm")
88
+ if lang == "en":
89
+ for a, b in EN_VOICE_SUB.get(getattr(_CUR, "voice", None), {}).items():
90
+ ps = ps.replace(a, b)
91
  return norm, ps
92
  return wrapped
93
 
 
117
  SENT_PAUSE = float(os.environ.get("VOXI_SENT_PAUSE", "0.45"))
118
 
119
 
120
+ FADE_IN, FADE_OUT = float(os.environ.get("VOXI_FADE_IN", "0.005")), float(os.environ.get("VOXI_FADE_OUT", "0.02"))
121
+
122
+
123
+ def fade_edges(y):
124
+ """Short raised-cosine fade at both edges of a rendered piece (2026-11-13, owner: "voice cut kinda noise"): pieces
125
+ are joined by digital silence, and a piece that stops at full level is heard as a cut or click. "fade" fix."""
126
+ if "fade" not in FIXES or len(y) < 4 * SR // 100:
127
+ return y
128
+ y = y.copy()
129
+ for n, sl in ((int(FADE_IN * SR), slice(None, None)), (int(FADE_OUT * SR), slice(None, None, -1))):
130
+ if n > 1:
131
+ w = (0.5 - 0.5 * np.cos(np.linspace(0, np.pi, n))).astype(np.float32)
132
+ y[sl][:n] *= w
133
+ return y
134
+
135
+
136
  def gap_after(ends_sentence):
137
  if ends_sentence:
138
  return max(0.15, SENT_PAUSE - 0.05) if "pauses" in FIXES else 0.15 # the closing mark adds ~50 ms itself
 
241
  a sentence are at most 25 ms."""
242
 
243
  VOWELS = set("aeiouæɑɐɒɔəɛɜɪʊʌAEIOUWYQ")
244
+ # 2026-11-13 (owner's picks E then F/G): no hold and no energy floor on the final vowel (the writer's own ending),
245
+ # but the closing mark and end pad stay silent, which removes the hiss after a sentence
246
+ END_MIN = 0 # final vowel at least this many 25 ms units (0 = leave the writer's length; was 5)
247
+ END_FLOOR = None # energy floor in the final vowel, above the writer's silence code (None = off; was 16)
248
+ GAP_CAP = 1 # word gaps inside a sentence at most this many 25 ms units (None = leave them)
249
  PUNCT = set(".,!?;:—…")
250
 
251
  def __init__(self, writer, voices, vocab, style_timing=True):
 
309
  def _endings(self, dec, c):
310
  d = [int(x) for x in dec]
311
  sym = [self.inv.get(x, "") for x in d]
312
+ for i in range(1, len(d) - 1 if self.GAP_CAP is not None else 1): # word gaps inside a sentence: capped
313
  if d[i] == self.space and sym[i - 1] not in self.PUNCT and sym[i + 1] not in self.PUNCT:
314
+ c[i, 0] = min(int(c[i, 0]), self.GAP_CAP)
315
  end = len(d) - 1
316
  while end > 0 and (sym[end] in self.PUNCT or d[end] == 0):
317
  end -= 1
 
321
  vs = [i for i in range(start, end + 1) if sym[i] in self.VOWELS]
322
  if vs:
323
  v = vs[-1]
324
+ c[v, 0] = max(int(c[v, 0]), self.END_MIN) # final vowel >= 125 ms
325
  c[v, 2] = min(int(c[v, 2]), 1) # voiced to its end
326
+ if self.END_FLOOR is not None and bool((c[v, 3:8] != self.pitch_none).all()):
327
  for j in range(8, 11): # no whisper-level energy inside it
328
+ c[v, j] = max(int(c[v, j]), self.sil_e + self.END_FLOOR)
329
  for i in range(end + 1, len(d)): # closing mark and end pad: silent, unvoiced
330
  c[i, 3:8] = self.pitch_none
331
  c[i, 8:11] = self.sil_e
 
363
  r"|(?<![\w'])(?P<umm>u+m+|u+h+|e+r+m+)(?![\w'-])[,.…]*"
364
  r"|(?P<hmm_hi>हम्म+्?)[,।]?|(?P<umm_hi>उम्म+्?)[,।]?", re.I)
365
  CLIP_GAP = 0.12 # silence between speech and a clip (s)
366
+ # Emotion names (2026-11-13): call-friendly names mapped onto the trained styles that sound clean (the old Rasa-learned
367
+ # rows; writer_emo's own styles were judged poor). Used as a voice ("payal@sorry") or inline before the text it covers
368
+ # ("[sorry] I'm so sorry. [cheerful] Good news!"). None = the plain voice. A voice without that style speaks plainly.
369
+ EMOTIONS = {"warm": "happy-soft", "cheerful": "happy", "sorry": "sad-soft", "firm": "angry-soft", "calm": None,
370
+ "neutral": None, "normal": None, "plain": None}
371
+ EMOTIONS.update({s: s for s in ("happy", "sad", "angry", "fearful", "surprised", "disgusted")})
372
+ EMOTION_TAG = re.compile(r"\[\s*(" + "|".join(sorted(EMOTIONS, key=len, reverse=True)) + r")\s*\]\s*", re.I)
373
 
374
 
375
  class KokoroEngine:
 
497
  return self._digits_en(text), lang # phone numbers / OTPs / IDs in groups; the rest to Mithi
498
  return text, lang
499
 
500
+ def _resolve(self, voice):
501
+ """An emotion alias ("payal@sorry") -> the voice row that plays it ("payal@sad-soft"), or the plain voice."""
502
+ base, at, st = voice.partition("@")
503
+ if at and st.lower() in EMOTIONS and voice not in self.voices:
504
+ row = EMOTIONS[st.lower()]
505
+ name = f"{base}@{row}" if row else base
506
+ return name if name in self.voices else base
507
+ return voice
508
+
509
+ def _emotion_runs(self, text, voice):
510
+ """None without inline emotion tags; else [(voice, text)], each run in the voice its tag picks."""
511
+ if not EMOTION_TAG.search(text):
512
+ return None
513
+ base, runs, cur, pos = voice.split("@")[0], [], voice, 0
514
+ for m in EMOTION_TAG.finditer(text):
515
+ runs.append((cur, text[pos:m.start()])); pos = m.end()
516
+ cur = self._resolve(f"{base}@{m.group(1).lower()}")
517
+ runs.append((cur, text[pos:]))
518
+ return [(v, x.strip()) for v, x in runs if re.search(r"[\w\[]", x)]
519
+
520
  def _check_voice(self, voice, lang=None):
521
+ voice = self._resolve(voice)
522
  if voice not in self.voices:
523
  raise ValueError(f"unknown voice {voice!r}; have {self.voices}")
524
  if lang is not None and voice in self.english_only and lang != "en":
 
559
 
560
  def synthesize(self, text, lang="hi", voice="payal", seed=None):
561
  self._check_voice(voice, lang)
562
+ voice = self._resolve(voice)
563
+ runs = self._emotion_runs(text, voice)
564
+ if runs is not None:
565
+ gap, out = np.zeros(int(gap_after(True) * SR), np.float32), []
566
+ for v, x in runs:
567
+ y = self._synth_one(x, lang, v, seed)
568
+ out += ([gap] if out else []) + [y]
569
+ return np.concatenate(out) if out else np.zeros(0, np.float32)
570
+ return self._synth_one(text, lang, voice, seed)
571
+
572
+ def _synth_one(self, text, lang, voice, seed):
573
  segs = self._sound_segments(text, voice)
574
  if segs is not None:
575
  gap = np.zeros(int(CLIP_GAP * SR), np.float32); out = []
 
597
  def _checked(self, eng, text, mlang, voice, seed, retries=2):
598
  """Render; if the audio fails audio_issue(), try again with the next seeds and keep the first good take."""
599
  base = self.tts.settings["seed"] if seed is None else seed
600
+ _CUR.voice = voice.split("@")[0]
601
  for k in range(retries + 1):
602
  y = np.asarray(eng.synthesize(text, lang=mlang, voice=voice, seed=base + k), np.float32)
603
  self.stats["renders"] += 1
604
  issue = audio_issue(y, text)
605
  if issue is None:
606
+ return fade_edges(y)
607
  self.stats["failed_checks"] += 1
608
  if k < retries:
609
  self.stats["retries"] += 1
 
624
  is rendered the way stream() will chunk it."""
625
  for voice in voices or ["payal"]:
626
  self._check_voice(voice, lang)
627
+ voice = self._resolve(voice)
628
  for ph in phrases:
629
  text, mlang = self.prepare(ph, lang)
630
  for chunk, _ in plan_chunks(text):
 
638
  when the first chunk is yielded). Chunks found in the cache (warm()) are used whole.
639
  chunking="sentence": one chunk per sentence."""
640
  self._check_voice(voice, lang)
641
+ voice = self._resolve(voice)
642
+ runs = self._emotion_runs(text, voice)
643
+ if runs is None:
644
+ yield from self._stream_one(text, lang, voice, seed, chunking, first_max, safety, max_chunk)
645
+ return
646
+ gap = np.zeros(int(gap_after(True) * SR), np.float32)
647
+ for n, (v, x) in enumerate(runs):
648
+ if n:
649
+ yield gap
650
+ yield from self._stream_one(x, lang, v, seed, chunking, first_max, safety, max_chunk)
651
+
652
+ def _stream_one(self, text, lang, voice, seed, chunking, first_max, safety, max_chunk):
653
  segs = self._sound_segments(text, voice)
654
  if segs is None:
655
  yield from self._stream_text(text, lang, voice, seed, chunking, first_max, safety, max_chunk)
writer.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ffa4dfc97e1284847bdfd4f3658308f62789b1f708829f0141b47673d86576fe
3
  size 75469256
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73289e62bdc506ad240e692b96af5744816fa7707d2767e3820293cdd0b43c4c
3
  size 75469256