whisper_refs: normalize transcripts (sentence-case, strip quote artifacts)
normalize_text() handles three Whisper quirks that produced messy F5
ref_texts:
1. Lowercase output with no terminal period — capitalize first letter,
append "." if missing.
2. Hallucinated "' clusters Whisper inserts when it interprets a
fragment as quoted dialogue (cora, ivan, atlas, hope had these).
Strip everywhere; never legitimate English punctuation.
3. Trailing apostrophe-then-period (.'.) from earlier rounds where a
closing-quoted line got an extra "." appended — collapse to single
terminal. Function is now idempotent.
Adds --from-cache flag: skip ASR, re-apply normalize from cached
whisper_refs.json. No GPU needed, useful after tuning the normalizer.
Lazy-imports torch so --from-cache works on any host.
Affects 9 of 40 voices: clara, grace, hazel, iris, felix, hugo
(lowercase fix); cora, ivan, atlas, hope (quote-cluster fix).
This commit is contained in:
parent
72a9553047
commit
c5247cd993
4 changed files with 116 additions and 67 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"clara": {
|
"clara": {
|
||||||
"ref_audio": "cloned-voices/clara.wav",
|
"ref_audio": "cloned-voices/clara.wav",
|
||||||
"ref_text": "but it is not with a view to distinction that you should cultivate this talent if you consult your own happiness.",
|
"ref_text": "But it is not with a view to distinction that you should cultivate this talent if you consult your own happiness.",
|
||||||
"speaker_id": "3575",
|
"speaker_id": "3575",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"duration": 7.0
|
"duration": 7.0
|
||||||
|
|
@ -22,21 +22,21 @@
|
||||||
},
|
},
|
||||||
"grace": {
|
"grace": {
|
||||||
"ref_audio": "cloned-voices/grace.wav",
|
"ref_audio": "cloned-voices/grace.wav",
|
||||||
"ref_text": "as to his age and also the name of his master jacob's statement varied somewhat from the advertisement",
|
"ref_text": "As to his age and also the name of his master jacob's statement varied somewhat from the advertisement.",
|
||||||
"speaker_id": "8463",
|
"speaker_id": "8463",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"duration": 6.7
|
"duration": 6.7
|
||||||
},
|
},
|
||||||
"hazel": {
|
"hazel": {
|
||||||
"ref_audio": "cloned-voices/hazel.wav",
|
"ref_audio": "cloned-voices/hazel.wav",
|
||||||
"ref_text": "i believe in the training of people to their highest capacity the englishman here heartily seconded him",
|
"ref_text": "I believe in the training of people to their highest capacity the englishman here heartily seconded him.",
|
||||||
"speaker_id": "1995",
|
"speaker_id": "1995",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"duration": 7.0
|
"duration": 7.0
|
||||||
},
|
},
|
||||||
"iris": {
|
"iris": {
|
||||||
"ref_audio": "cloned-voices/iris.wav",
|
"ref_audio": "cloned-voices/iris.wav",
|
||||||
"ref_text": "gold is the most common metal in the land of oz and is used for many purposes because it is soft and pliable",
|
"ref_text": "Gold is the most common metal in the land of oz and is used for many purposes because it is soft and pliable.",
|
||||||
"speaker_id": "1284",
|
"speaker_id": "1284",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"duration": 7.2
|
"duration": 7.2
|
||||||
|
|
@ -92,7 +92,7 @@
|
||||||
},
|
},
|
||||||
"cora": {
|
"cora": {
|
||||||
"ref_audio": "cloned-voices/cora.wav",
|
"ref_audio": "cloned-voices/cora.wav",
|
||||||
"ref_text": "\"'The alternative was that someone passing \"'had observed the key in the door, \"'had known that I was out, \"'and had entered to look at the papers.'",
|
"ref_text": "The alternative was that someone passing had observed the key in the door, had known that I was out, and had entered to look at the papers.",
|
||||||
"speaker_id": "1580",
|
"speaker_id": "1580",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"duration": 7.0
|
"duration": 7.0
|
||||||
|
|
@ -127,7 +127,7 @@
|
||||||
},
|
},
|
||||||
"hope": {
|
"hope": {
|
||||||
"ref_audio": "cloned-voices/hope.wav",
|
"ref_audio": "cloned-voices/hope.wav",
|
||||||
"ref_text": "\"'Mr. Graff,' said Kenneth, noticing the boy's face critically, as he stood where the light from the passage fell upon it.",
|
"ref_text": "Mr. Graff,' said Kenneth, noticing the boy's face critically, as he stood where the light from the passage fell upon it.",
|
||||||
"speaker_id": "6829",
|
"speaker_id": "6829",
|
||||||
"gender": "female",
|
"gender": "female",
|
||||||
"duration": 7.1
|
"duration": 7.1
|
||||||
|
|
@ -141,7 +141,7 @@
|
||||||
},
|
},
|
||||||
"atlas": {
|
"atlas": {
|
||||||
"ref_audio": "cloned-voices/atlas.wav",
|
"ref_audio": "cloned-voices/atlas.wav",
|
||||||
"ref_text": "\"'It is you who are mistaken, Raoul. I have read his distress in his eyes, in his every gesture and action the whole day.'",
|
"ref_text": "It is you who are mistaken, Raoul. I have read his distress in his eyes, in his every gesture and action the whole day.",
|
||||||
"speaker_id": "6930",
|
"speaker_id": "6930",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"duration": 7.3
|
"duration": 7.3
|
||||||
|
|
@ -155,14 +155,14 @@
|
||||||
},
|
},
|
||||||
"felix": {
|
"felix": {
|
||||||
"ref_audio": "cloned-voices/felix.wav",
|
"ref_audio": "cloned-voices/felix.wav",
|
||||||
"ref_text": "she saw that the bed was gilded and so rich that it seemed that of a prince rather than of a private gentleman",
|
"ref_text": "She saw that the bed was gilded and so rich that it seemed that of a prince rather than of a private gentleman.",
|
||||||
"speaker_id": "5639",
|
"speaker_id": "5639",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"duration": 6.9
|
"duration": 6.9
|
||||||
},
|
},
|
||||||
"hugo": {
|
"hugo": {
|
||||||
"ref_audio": "cloned-voices/hugo.wav",
|
"ref_audio": "cloned-voices/hugo.wav",
|
||||||
"ref_text": "cried Alice again, for this time the mouse was bristling all over, and she felt certain it must be really offended.",
|
"ref_text": "Cried Alice again, for this time the mouse was bristling all over, and she felt certain it must be really offended.",
|
||||||
"speaker_id": "260",
|
"speaker_id": "260",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"duration": 6.6
|
"duration": 6.6
|
||||||
|
|
@ -176,7 +176,7 @@
|
||||||
},
|
},
|
||||||
"kai": {
|
"kai": {
|
||||||
"ref_audio": "cloned-voices/kai.wav",
|
"ref_audio": "cloned-voices/kai.wav",
|
||||||
"ref_text": "Upon this, Madame deigned to turn her eyes languishingly towards the comte, observing a",
|
"ref_text": "Upon this, Madame deigned to turn her eyes languishingly towards the comte, observing a.",
|
||||||
"speaker_id": "7127",
|
"speaker_id": "7127",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"duration": 6.6
|
"duration": 6.6
|
||||||
|
|
@ -211,7 +211,7 @@
|
||||||
},
|
},
|
||||||
"archer": {
|
"archer": {
|
||||||
"ref_audio": "cloned-voices/archer.wav",
|
"ref_audio": "cloned-voices/archer.wav",
|
||||||
"ref_text": "\"'What is the tumult and rioting?' cried out the squire authoritatively, and he blew twice on the silver whistle which hung at his belt.",
|
"ref_text": "What is the tumult and rioting?' cried out the squire authoritatively, and he blew twice on the silver whistle which hung at his belt.",
|
||||||
"speaker_id": "61",
|
"speaker_id": "61",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"duration": 7.5
|
"duration": 7.5
|
||||||
|
|
@ -225,7 +225,7 @@
|
||||||
},
|
},
|
||||||
"cole": {
|
"cole": {
|
||||||
"ref_audio": "cloned-voices/cole.wav",
|
"ref_audio": "cloned-voices/cole.wav",
|
||||||
"ref_text": "like the dove's voice, like transient day, like music in the air. Ah!",
|
"ref_text": "Like the dove's voice, like transient day, like music in the air. Ah!",
|
||||||
"speaker_id": "908",
|
"speaker_id": "908",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"duration": 7.0
|
"duration": 7.0
|
||||||
|
|
@ -246,7 +246,7 @@
|
||||||
},
|
},
|
||||||
"finn": {
|
"finn": {
|
||||||
"ref_audio": "cloned-voices/finn.wav",
|
"ref_audio": "cloned-voices/finn.wav",
|
||||||
"ref_text": "\"'Why, if we erect a station at the Falls, it is a great economy to get it up to the city.'",
|
"ref_text": "Why, if we erect a station at the Falls, it is a great economy to get it up to the city.",
|
||||||
"speaker_id": "2300",
|
"speaker_id": "2300",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"duration": 6.9
|
"duration": 6.9
|
||||||
|
|
@ -267,14 +267,14 @@
|
||||||
},
|
},
|
||||||
"ivan": {
|
"ivan": {
|
||||||
"ref_audio": "cloned-voices/ivan.wav",
|
"ref_audio": "cloned-voices/ivan.wav",
|
||||||
"ref_text": "Then, turning to Jane, she asked, in a somewhat altered tone, \"'Has she been a good girl, Jane?'",
|
"ref_text": "Then, turning to Jane, she asked, in a somewhat altered tone, Has she been a good girl, Jane?",
|
||||||
"speaker_id": "7021",
|
"speaker_id": "7021",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"duration": 7.0
|
"duration": 7.0
|
||||||
},
|
},
|
||||||
"jude": {
|
"jude": {
|
||||||
"ref_audio": "cloned-voices/jude.wav",
|
"ref_audio": "cloned-voices/jude.wav",
|
||||||
"ref_text": "The king stood up and called for that psalm which begins with these words,",
|
"ref_text": "The king stood up and called for that psalm which begins with these words,.",
|
||||||
"speaker_id": "8224",
|
"speaker_id": "8224",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
"duration": 6.8
|
"duration": 6.8
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"amber": "Hay fever. A heart trouble caused by falling in love with a grass widow.",
|
"amber": "Hay fever. A heart trouble caused by falling in love with a grass widow.",
|
||||||
"archer": "\"'What is the tumult and rioting?' cried out the squire authoritatively, and he blew twice on the silver whistle which hung at his belt.",
|
"archer": "What is the tumult and rioting?' cried out the squire authoritatively, and he blew twice on the silver whistle which hung at his belt.",
|
||||||
"aria": "But the windows are patched with wooden panes, and the door, I think, is like the gate. It is never opened.",
|
"aria": "But the windows are patched with wooden panes, and the door, I think, is like the gate. It is never opened.",
|
||||||
"atlas": "\"'It is you who are mistaken, Raoul. I have read his distress in his eyes, in his every gesture and action the whole day.'",
|
"atlas": "It is you who are mistaken, Raoul. I have read his distress in his eyes, in his every gesture and action the whole day.",
|
||||||
"blake": "In autumn, the woodcutters always came and felled some of the largest trees.",
|
"blake": "In autumn, the woodcutters always came and felled some of the largest trees.",
|
||||||
"brooke": "Frank read English slowly, and the more he read about this divorce case, the angrier he grew.",
|
"brooke": "Frank read English slowly, and the more he read about this divorce case, the angrier he grew.",
|
||||||
"caleb": "Four or five of the latter only lingered about the door of the prison of Uncas, wary but close observers of the manner of their captive.",
|
"caleb": "Four or five of the latter only lingered about the door of the prison of Uncas, wary but close observers of the manner of their captive.",
|
||||||
"clara": "but it is not with a view to distinction that you should cultivate this talent if you consult your own happiness.",
|
"clara": "But it is not with a view to distinction that you should cultivate this talent if you consult your own happiness.",
|
||||||
"cole": "like the dove's voice, like transient day, like music in the air. Ah!",
|
"cole": "Like the dove's voice, like transient day, like music in the air. Ah!",
|
||||||
"cora": "\"'The alternative was that someone passing \"'had observed the key in the door, \"'had known that I was out, \"'and had entered to look at the papers.'",
|
"cora": "The alternative was that someone passing had observed the key in the door, had known that I was out, and had entered to look at the papers.",
|
||||||
"dane": "The pride of that dim image brought back to his mind the dignity of the office he had refused.",
|
"dane": "The pride of that dim image brought back to his mind the dignity of the office he had refused.",
|
||||||
"diana": "The wearers of uniforms and liveries may be roughly divided into two classes, the free and the servile, or the noble and the ignoble.",
|
"diana": "The wearers of uniforms and liveries may be roughly divided into two classes, the free and the servile, or the noble and the ignoble.",
|
||||||
"eden": "Ruth sat quite still for a time, with face intent and flushed. It was out now.",
|
"eden": "Ruth sat quite still for a time, with face intent and flushed. It was out now.",
|
||||||
|
|
@ -16,21 +16,21 @@
|
||||||
"ezra": "But in this vignette, copied from Turner, you have the two principles brought out perfectly.",
|
"ezra": "But in this vignette, copied from Turner, you have the two principles brought out perfectly.",
|
||||||
"f5_native": "Some call me nature. Others call me Mother Nature.",
|
"f5_native": "Some call me nature. Others call me Mother Nature.",
|
||||||
"faye": "He gave up his position and shut the family up in that tomb of a house so he could study his books.",
|
"faye": "He gave up his position and shut the family up in that tomb of a house so he could study his books.",
|
||||||
"felix": "she saw that the bed was gilded and so rich that it seemed that of a prince rather than of a private gentleman",
|
"felix": "She saw that the bed was gilded and so rich that it seemed that of a prince rather than of a private gentleman.",
|
||||||
"finn": "\"'Why, if we erect a station at the Falls, it is a great economy to get it up to the city.'",
|
"finn": "Why, if we erect a station at the Falls, it is a great economy to get it up to the city.",
|
||||||
"gemma": "Do you know? Lake? Oh, I really can't tell, but he'll soon tire of country life.",
|
"gemma": "Do you know? Lake? Oh, I really can't tell, but he'll soon tire of country life.",
|
||||||
"grace": "as to his age and also the name of his master jacob's statement varied somewhat from the advertisement",
|
"grace": "As to his age and also the name of his master jacob's statement varied somewhat from the advertisement.",
|
||||||
"grant": "At the inception of plural marriage among the Latter-day Saints, there was no law, national or state, against its practice.",
|
"grant": "At the inception of plural marriage among the Latter-day Saints, there was no law, national or state, against its practice.",
|
||||||
"hazel": "i believe in the training of people to their highest capacity the englishman here heartily seconded him",
|
"hazel": "I believe in the training of people to their highest capacity the englishman here heartily seconded him.",
|
||||||
"heath": "And what demonstration do you offer, asked Cervidac eagerly, that it will not happen?",
|
"heath": "And what demonstration do you offer, asked Cervidac eagerly, that it will not happen?",
|
||||||
"hope": "\"'Mr. Graff,' said Kenneth, noticing the boy's face critically, as he stood where the light from the passage fell upon it.",
|
"hope": "Mr. Graff,' said Kenneth, noticing the boy's face critically, as he stood where the light from the passage fell upon it.",
|
||||||
"hugo": "cried Alice again, for this time the mouse was bristling all over, and she felt certain it must be really offended.",
|
"hugo": "Cried Alice again, for this time the mouse was bristling all over, and she felt certain it must be really offended.",
|
||||||
"iris": "gold is the most common metal in the land of oz and is used for many purposes because it is soft and pliable",
|
"iris": "Gold is the most common metal in the land of oz and is used for many purposes because it is soft and pliable.",
|
||||||
"ivan": "Then, turning to Jane, she asked, in a somewhat altered tone, \"'Has she been a good girl, Jane?'",
|
"ivan": "Then, turning to Jane, she asked, in a somewhat altered tone, Has she been a good girl, Jane?",
|
||||||
"ivy": "Over the track-lined city street the young men, the grinning men, pass.",
|
"ivy": "Over the track-lined city street the young men, the grinning men, pass.",
|
||||||
"jasper": "That summer's immigration, however, being mainly from the free states, greatly changed the relative strengths of the two parties.",
|
"jasper": "That summer's immigration, however, being mainly from the free states, greatly changed the relative strengths of the two parties.",
|
||||||
"jude": "The king stood up and called for that psalm which begins with these words,",
|
"jude": "The king stood up and called for that psalm which begins with these words,.",
|
||||||
"kai": "Upon this, Madame deigned to turn her eyes languishingly towards the comte, observing a",
|
"kai": "Upon this, Madame deigned to turn her eyes languishingly towards the comte, observing a.",
|
||||||
"leo": "The behaviorist who attempts to make psychology a record of behavior has to trust his memory in making the record.",
|
"leo": "The behaviorist who attempts to make psychology a record of behavior has to trust his memory in making the record.",
|
||||||
"luna": "The door opened again while I was still studying the two brothers, without, I honestly confess, being very favorably impressed by either of them.",
|
"luna": "The door opened again while I was still studying the two brothers, without, I honestly confess, being very favorably impressed by either of them.",
|
||||||
"marcus": "In the old badly made play, it was frequently necessary for one of the characters to take the audience into his confidence.",
|
"marcus": "In the old badly made play, it was frequently necessary for one of the characters to take the audience into his confidence.",
|
||||||
|
|
|
||||||
|
|
@ -13,18 +13,19 @@ on text. Whisper hears what F5 will hear, so its transcript is the better ref.
|
||||||
|
|
||||||
Run on a GPU host (4090 / 3090). Idempotent: rerun any time cloned-voices/
|
Run on a GPU host (4090 / 3090). Idempotent: rerun any time cloned-voices/
|
||||||
changes. Use `make whisper-refs` rather than calling this directly.
|
changes. Use `make whisper-refs` rather than calling this directly.
|
||||||
|
|
||||||
|
Pass --from-cache to skip ASR and only re-apply normalization from an existing
|
||||||
|
whisper_refs.json — useful after tweaking normalize_text(). No GPU needed.
|
||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import torch
|
|
||||||
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
|
||||||
|
|
||||||
|
|
||||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||||
VOICES_DIR = REPO_ROOT / "cloned-voices"
|
VOICES_DIR = REPO_ROOT / "cloned-voices"
|
||||||
|
|
@ -34,7 +35,38 @@ WHISPER_JSON = VOICES_DIR / "whisper_refs.json"
|
||||||
MODEL_ID = os.environ.get("WHISPER_MODEL", "openai/whisper-large-v3")
|
MODEL_ID = os.environ.get("WHISPER_MODEL", "openai/whisper-large-v3")
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_text(text: str) -> str:
|
||||||
|
"""Clean Whisper output for use as F5 ref_text.
|
||||||
|
|
||||||
|
Whisper occasionally hallucinates `"'` cluster characters when it interprets
|
||||||
|
a fragment as quoted dialogue — at sentence start, mid-clause, anywhere. It
|
||||||
|
also returns lowercase output and drops terminal punctuation on some clips.
|
||||||
|
F5 tokenizes the raw string, so messy ref_text → noisy conditioning signal.
|
||||||
|
Designed to be idempotent: running it twice on the same input is a no-op.
|
||||||
|
"""
|
||||||
|
text = re.sub(r"\s+", " ", text).strip()
|
||||||
|
# `"'` never appears as legitimate English punctuation — always Whisper noise
|
||||||
|
text = text.replace('"\'', "")
|
||||||
|
# strip leading whitespace and opening-quote junk
|
||||||
|
text = re.sub(r'^[\s"\'`]+', "", text)
|
||||||
|
# strip trailing whitespace and any quote/apostrophe chars (legit closing quote
|
||||||
|
# after a terminal `.` is also dropped — F5 only cares about the prosody marker)
|
||||||
|
text = re.sub(r'[\s"\'`]+$', "", text)
|
||||||
|
# if a terminal punct is followed by stray apostrophe-then-period (`.'.`),
|
||||||
|
# collapse to the terminal — happens when a closing-quoted line gets a `.` appended
|
||||||
|
text = re.sub(r"([.!?])['\"`]+\.?$", r"\1", text)
|
||||||
|
text = re.sub(r"\s+", " ", text).strip()
|
||||||
|
if text and text[0].isalpha():
|
||||||
|
text = text[0].upper() + text[1:]
|
||||||
|
if text and text[-1] not in ".!?":
|
||||||
|
text = text + "."
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
def load_pipeline():
|
def load_pipeline():
|
||||||
|
import torch
|
||||||
|
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
||||||
|
|
||||||
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
||||||
dtype = torch.float16 if device.startswith("cuda") else torch.float32
|
dtype = torch.float16 if device.startswith("cuda") else torch.float32
|
||||||
print(f"[whisper_refs] loading {MODEL_ID} on {device} ({dtype})", flush=True)
|
print(f"[whisper_refs] loading {MODEL_ID} on {device} ({dtype})", flush=True)
|
||||||
|
|
@ -62,8 +94,7 @@ def transcribe_all(asr) -> dict[str, str]:
|
||||||
str(wav),
|
str(wav),
|
||||||
generate_kwargs={"language": "en", "task": "transcribe"},
|
generate_kwargs={"language": "en", "task": "transcribe"},
|
||||||
)
|
)
|
||||||
text = result["text"].strip()
|
text = normalize_text(result["text"])
|
||||||
text = re.sub(r"\s+", " ", text)
|
|
||||||
voice = wav.stem
|
voice = wav.stem
|
||||||
out[voice] = text
|
out[voice] = text
|
||||||
print(f"[whisper_refs] [{i:2d}/{len(wavs)}] {voice:10s} -> {text}", flush=True)
|
print(f"[whisper_refs] [{i:2d}/{len(wavs)}] {voice:10s} -> {text}", flush=True)
|
||||||
|
|
@ -120,11 +151,29 @@ def rewrite_metadata(refs: dict[str, str]) -> int:
|
||||||
|
|
||||||
|
|
||||||
def main() -> int:
|
def main() -> int:
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||||
|
parser.add_argument(
|
||||||
|
"--from-cache",
|
||||||
|
action="store_true",
|
||||||
|
help="skip ASR; re-apply normalize_text() to cached whisper_refs.json",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
if not VOICES_DIR.is_dir():
|
if not VOICES_DIR.is_dir():
|
||||||
print(f"[whisper_refs] no cloned-voices dir at {VOICES_DIR}", file=sys.stderr)
|
print(f"[whisper_refs] no cloned-voices dir at {VOICES_DIR}", file=sys.stderr)
|
||||||
return 2
|
return 2
|
||||||
asr = load_pipeline()
|
|
||||||
refs = transcribe_all(asr)
|
if args.from_cache:
|
||||||
|
if not WHISPER_JSON.is_file():
|
||||||
|
print(f"[whisper_refs] --from-cache but {WHISPER_JSON} missing", file=sys.stderr)
|
||||||
|
return 2
|
||||||
|
raw = json.loads(WHISPER_JSON.read_text())
|
||||||
|
refs = {voice: normalize_text(text) for voice, text in raw.items()}
|
||||||
|
print(f"[whisper_refs] re-normalized {len(refs)} entries from cache", flush=True)
|
||||||
|
else:
|
||||||
|
asr = load_pipeline()
|
||||||
|
refs = transcribe_all(asr)
|
||||||
|
|
||||||
WHISPER_JSON.write_text(json.dumps(refs, indent=2, ensure_ascii=False) + "\n")
|
WHISPER_JSON.write_text(json.dumps(refs, indent=2, ensure_ascii=False) + "\n")
|
||||||
print(f"[whisper_refs] wrote {WHISPER_JSON} ({len(refs)} entries)", flush=True)
|
print(f"[whisper_refs] wrote {WHISPER_JSON} ({len(refs)} entries)", flush=True)
|
||||||
yaml_changed = rewrite_yaml(refs)
|
yaml_changed = rewrite_yaml(refs)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ tts-1-qwen:
|
||||||
# female - speaker 3575
|
# female - speaker 3575
|
||||||
clara:
|
clara:
|
||||||
ref_audio: cloned-voices/clara.wav
|
ref_audio: cloned-voices/clara.wav
|
||||||
ref_text: "but it is not with a view to distinction that you should cultivate this talent if you consult your own happiness."
|
ref_text: "But it is not with a view to distinction that you should cultivate this talent if you consult your own happiness."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 2961
|
# female - speaker 2961
|
||||||
|
|
@ -33,19 +33,19 @@ tts-1-qwen:
|
||||||
# female - speaker 8463
|
# female - speaker 8463
|
||||||
grace:
|
grace:
|
||||||
ref_audio: cloned-voices/grace.wav
|
ref_audio: cloned-voices/grace.wav
|
||||||
ref_text: "as to his age and also the name of his master jacob's statement varied somewhat from the advertisement"
|
ref_text: "As to his age and also the name of his master jacob's statement varied somewhat from the advertisement."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 1995
|
# female - speaker 1995
|
||||||
hazel:
|
hazel:
|
||||||
ref_audio: cloned-voices/hazel.wav
|
ref_audio: cloned-voices/hazel.wav
|
||||||
ref_text: "i believe in the training of people to their highest capacity the englishman here heartily seconded him"
|
ref_text: "I believe in the training of people to their highest capacity the englishman here heartily seconded him."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 1284
|
# female - speaker 1284
|
||||||
iris:
|
iris:
|
||||||
ref_audio: cloned-voices/iris.wav
|
ref_audio: cloned-voices/iris.wav
|
||||||
ref_text: "gold is the most common metal in the land of oz and is used for many purposes because it is soft and pliable"
|
ref_text: "Gold is the most common metal in the land of oz and is used for many purposes because it is soft and pliable."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 5142
|
# female - speaker 5142
|
||||||
|
|
@ -93,7 +93,7 @@ tts-1-qwen:
|
||||||
# female - speaker 1580
|
# female - speaker 1580
|
||||||
cora:
|
cora:
|
||||||
ref_audio: cloned-voices/cora.wav
|
ref_audio: cloned-voices/cora.wav
|
||||||
ref_text: "\"'The alternative was that someone passing \"'had observed the key in the door, \"'had known that I was out, \"'and had entered to look at the papers.'"
|
ref_text: "The alternative was that someone passing had observed the key in the door, had known that I was out, and had entered to look at the papers."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 3570
|
# female - speaker 3570
|
||||||
|
|
@ -123,7 +123,7 @@ tts-1-qwen:
|
||||||
# female - speaker 6829
|
# female - speaker 6829
|
||||||
hope:
|
hope:
|
||||||
ref_audio: cloned-voices/hope.wav
|
ref_audio: cloned-voices/hope.wav
|
||||||
ref_text: "\"'Mr. Graff,' said Kenneth, noticing the boy's face critically, as he stood where the light from the passage fell upon it."
|
ref_text: "Mr. Graff,' said Kenneth, noticing the boy's face critically, as he stood where the light from the passage fell upon it."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 8555
|
# female - speaker 8555
|
||||||
|
|
@ -135,7 +135,7 @@ tts-1-qwen:
|
||||||
# male - speaker 6930
|
# male - speaker 6930
|
||||||
atlas:
|
atlas:
|
||||||
ref_audio: cloned-voices/atlas.wav
|
ref_audio: cloned-voices/atlas.wav
|
||||||
ref_text: "\"'It is you who are mistaken, Raoul. I have read his distress in his eyes, in his every gesture and action the whole day.'"
|
ref_text: "It is you who are mistaken, Raoul. I have read his distress in his eyes, in his every gesture and action the whole day."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 1320
|
# male - speaker 1320
|
||||||
|
|
@ -147,13 +147,13 @@ tts-1-qwen:
|
||||||
# male - speaker 5639
|
# male - speaker 5639
|
||||||
felix:
|
felix:
|
||||||
ref_audio: cloned-voices/felix.wav
|
ref_audio: cloned-voices/felix.wav
|
||||||
ref_text: "she saw that the bed was gilded and so rich that it seemed that of a prince rather than of a private gentleman"
|
ref_text: "She saw that the bed was gilded and so rich that it seemed that of a prince rather than of a private gentleman."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 260
|
# male - speaker 260
|
||||||
hugo:
|
hugo:
|
||||||
ref_audio: cloned-voices/hugo.wav
|
ref_audio: cloned-voices/hugo.wav
|
||||||
ref_text: "cried Alice again, for this time the mouse was bristling all over, and she felt certain it must be really offended."
|
ref_text: "Cried Alice again, for this time the mouse was bristling all over, and she felt certain it must be really offended."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 7729
|
# male - speaker 7729
|
||||||
|
|
@ -165,7 +165,7 @@ tts-1-qwen:
|
||||||
# male - speaker 7127
|
# male - speaker 7127
|
||||||
kai:
|
kai:
|
||||||
ref_audio: cloned-voices/kai.wav
|
ref_audio: cloned-voices/kai.wav
|
||||||
ref_text: "Upon this, Madame deigned to turn her eyes languishingly towards the comte, observing a"
|
ref_text: "Upon this, Madame deigned to turn her eyes languishingly towards the comte, observing a."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 8230
|
# male - speaker 8230
|
||||||
|
|
@ -195,7 +195,7 @@ tts-1-qwen:
|
||||||
# male - speaker 61
|
# male - speaker 61
|
||||||
archer:
|
archer:
|
||||||
ref_audio: cloned-voices/archer.wav
|
ref_audio: cloned-voices/archer.wav
|
||||||
ref_text: "\"'What is the tumult and rioting?' cried out the squire authoritatively, and he blew twice on the silver whistle which hung at his belt."
|
ref_text: "What is the tumult and rioting?' cried out the squire authoritatively, and he blew twice on the silver whistle which hung at his belt."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 672
|
# male - speaker 672
|
||||||
|
|
@ -207,7 +207,7 @@ tts-1-qwen:
|
||||||
# male - speaker 908
|
# male - speaker 908
|
||||||
cole:
|
cole:
|
||||||
ref_audio: cloned-voices/cole.wav
|
ref_audio: cloned-voices/cole.wav
|
||||||
ref_text: "like the dove's voice, like transient day, like music in the air. Ah!"
|
ref_text: "Like the dove's voice, like transient day, like music in the air. Ah!"
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 1089
|
# male - speaker 1089
|
||||||
|
|
@ -225,7 +225,7 @@ tts-1-qwen:
|
||||||
# male - speaker 2300
|
# male - speaker 2300
|
||||||
finn:
|
finn:
|
||||||
ref_audio: cloned-voices/finn.wav
|
ref_audio: cloned-voices/finn.wav
|
||||||
ref_text: "\"'Why, if we erect a station at the Falls, it is a great economy to get it up to the city.'"
|
ref_text: "Why, if we erect a station at the Falls, it is a great economy to get it up to the city."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 4077
|
# male - speaker 4077
|
||||||
|
|
@ -243,13 +243,13 @@ tts-1-qwen:
|
||||||
# male - speaker 7021
|
# male - speaker 7021
|
||||||
ivan:
|
ivan:
|
||||||
ref_audio: cloned-voices/ivan.wav
|
ref_audio: cloned-voices/ivan.wav
|
||||||
ref_text: "Then, turning to Jane, she asked, in a somewhat altered tone, \"'Has she been a good girl, Jane?'"
|
ref_text: "Then, turning to Jane, she asked, in a somewhat altered tone, Has she been a good girl, Jane?"
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 8224
|
# male - speaker 8224
|
||||||
jude:
|
jude:
|
||||||
ref_audio: cloned-voices/jude.wav
|
ref_audio: cloned-voices/jude.wav
|
||||||
ref_text: "The king stood up and called for that psalm which begins with these words,"
|
ref_text: "The king stood up and called for that psalm which begins with these words,."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# Other TTS engines (disabled by default)
|
# Other TTS engines (disabled by default)
|
||||||
|
|
@ -282,7 +282,7 @@ tts-1-f5:
|
||||||
# female - speaker 3575
|
# female - speaker 3575
|
||||||
clara:
|
clara:
|
||||||
ref_audio: cloned-voices/clara.wav
|
ref_audio: cloned-voices/clara.wav
|
||||||
ref_text: "but it is not with a view to distinction that you should cultivate this talent if you consult your own happiness."
|
ref_text: "But it is not with a view to distinction that you should cultivate this talent if you consult your own happiness."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 2961
|
# female - speaker 2961
|
||||||
|
|
@ -294,19 +294,19 @@ tts-1-f5:
|
||||||
# female - speaker 8463
|
# female - speaker 8463
|
||||||
grace:
|
grace:
|
||||||
ref_audio: cloned-voices/grace.wav
|
ref_audio: cloned-voices/grace.wav
|
||||||
ref_text: "as to his age and also the name of his master jacob's statement varied somewhat from the advertisement"
|
ref_text: "As to his age and also the name of his master jacob's statement varied somewhat from the advertisement."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 1995
|
# female - speaker 1995
|
||||||
hazel:
|
hazel:
|
||||||
ref_audio: cloned-voices/hazel.wav
|
ref_audio: cloned-voices/hazel.wav
|
||||||
ref_text: "i believe in the training of people to their highest capacity the englishman here heartily seconded him"
|
ref_text: "I believe in the training of people to their highest capacity the englishman here heartily seconded him."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 1284
|
# female - speaker 1284
|
||||||
iris:
|
iris:
|
||||||
ref_audio: cloned-voices/iris.wav
|
ref_audio: cloned-voices/iris.wav
|
||||||
ref_text: "gold is the most common metal in the land of oz and is used for many purposes because it is soft and pliable"
|
ref_text: "Gold is the most common metal in the land of oz and is used for many purposes because it is soft and pliable."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 5142
|
# female - speaker 5142
|
||||||
|
|
@ -354,7 +354,7 @@ tts-1-f5:
|
||||||
# female - speaker 1580
|
# female - speaker 1580
|
||||||
cora:
|
cora:
|
||||||
ref_audio: cloned-voices/cora.wav
|
ref_audio: cloned-voices/cora.wav
|
||||||
ref_text: "\"'The alternative was that someone passing \"'had observed the key in the door, \"'had known that I was out, \"'and had entered to look at the papers.'"
|
ref_text: "The alternative was that someone passing had observed the key in the door, had known that I was out, and had entered to look at the papers."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 3570
|
# female - speaker 3570
|
||||||
|
|
@ -384,7 +384,7 @@ tts-1-f5:
|
||||||
# female - speaker 6829
|
# female - speaker 6829
|
||||||
hope:
|
hope:
|
||||||
ref_audio: cloned-voices/hope.wav
|
ref_audio: cloned-voices/hope.wav
|
||||||
ref_text: "\"'Mr. Graff,' said Kenneth, noticing the boy's face critically, as he stood where the light from the passage fell upon it."
|
ref_text: "Mr. Graff,' said Kenneth, noticing the boy's face critically, as he stood where the light from the passage fell upon it."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# female - speaker 8555
|
# female - speaker 8555
|
||||||
|
|
@ -396,7 +396,7 @@ tts-1-f5:
|
||||||
# male - speaker 6930
|
# male - speaker 6930
|
||||||
atlas:
|
atlas:
|
||||||
ref_audio: cloned-voices/atlas.wav
|
ref_audio: cloned-voices/atlas.wav
|
||||||
ref_text: "\"'It is you who are mistaken, Raoul. I have read his distress in his eyes, in his every gesture and action the whole day.'"
|
ref_text: "It is you who are mistaken, Raoul. I have read his distress in his eyes, in his every gesture and action the whole day."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 1320
|
# male - speaker 1320
|
||||||
|
|
@ -408,13 +408,13 @@ tts-1-f5:
|
||||||
# male - speaker 5639
|
# male - speaker 5639
|
||||||
felix:
|
felix:
|
||||||
ref_audio: cloned-voices/felix.wav
|
ref_audio: cloned-voices/felix.wav
|
||||||
ref_text: "she saw that the bed was gilded and so rich that it seemed that of a prince rather than of a private gentleman"
|
ref_text: "She saw that the bed was gilded and so rich that it seemed that of a prince rather than of a private gentleman."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 260
|
# male - speaker 260
|
||||||
hugo:
|
hugo:
|
||||||
ref_audio: cloned-voices/hugo.wav
|
ref_audio: cloned-voices/hugo.wav
|
||||||
ref_text: "cried Alice again, for this time the mouse was bristling all over, and she felt certain it must be really offended."
|
ref_text: "Cried Alice again, for this time the mouse was bristling all over, and she felt certain it must be really offended."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 7729
|
# male - speaker 7729
|
||||||
|
|
@ -426,7 +426,7 @@ tts-1-f5:
|
||||||
# male - speaker 7127
|
# male - speaker 7127
|
||||||
kai:
|
kai:
|
||||||
ref_audio: cloned-voices/kai.wav
|
ref_audio: cloned-voices/kai.wav
|
||||||
ref_text: "Upon this, Madame deigned to turn her eyes languishingly towards the comte, observing a"
|
ref_text: "Upon this, Madame deigned to turn her eyes languishingly towards the comte, observing a."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 8230
|
# male - speaker 8230
|
||||||
|
|
@ -456,7 +456,7 @@ tts-1-f5:
|
||||||
# male - speaker 61
|
# male - speaker 61
|
||||||
archer:
|
archer:
|
||||||
ref_audio: cloned-voices/archer.wav
|
ref_audio: cloned-voices/archer.wav
|
||||||
ref_text: "\"'What is the tumult and rioting?' cried out the squire authoritatively, and he blew twice on the silver whistle which hung at his belt."
|
ref_text: "What is the tumult and rioting?' cried out the squire authoritatively, and he blew twice on the silver whistle which hung at his belt."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 672
|
# male - speaker 672
|
||||||
|
|
@ -468,7 +468,7 @@ tts-1-f5:
|
||||||
# male - speaker 908
|
# male - speaker 908
|
||||||
cole:
|
cole:
|
||||||
ref_audio: cloned-voices/cole.wav
|
ref_audio: cloned-voices/cole.wav
|
||||||
ref_text: "like the dove's voice, like transient day, like music in the air. Ah!"
|
ref_text: "Like the dove's voice, like transient day, like music in the air. Ah!"
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 1089
|
# male - speaker 1089
|
||||||
|
|
@ -486,7 +486,7 @@ tts-1-f5:
|
||||||
# male - speaker 2300
|
# male - speaker 2300
|
||||||
finn:
|
finn:
|
||||||
ref_audio: cloned-voices/finn.wav
|
ref_audio: cloned-voices/finn.wav
|
||||||
ref_text: "\"'Why, if we erect a station at the Falls, it is a great economy to get it up to the city.'"
|
ref_text: "Why, if we erect a station at the Falls, it is a great economy to get it up to the city."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 4077
|
# male - speaker 4077
|
||||||
|
|
@ -504,13 +504,13 @@ tts-1-f5:
|
||||||
# male - speaker 7021
|
# male - speaker 7021
|
||||||
ivan:
|
ivan:
|
||||||
ref_audio: cloned-voices/ivan.wav
|
ref_audio: cloned-voices/ivan.wav
|
||||||
ref_text: "Then, turning to Jane, she asked, in a somewhat altered tone, \"'Has she been a good girl, Jane?'"
|
ref_text: "Then, turning to Jane, she asked, in a somewhat altered tone, Has she been a good girl, Jane?"
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# male - speaker 8224
|
# male - speaker 8224
|
||||||
jude:
|
jude:
|
||||||
ref_audio: cloned-voices/jude.wav
|
ref_audio: cloned-voices/jude.wav
|
||||||
ref_text: "The king stood up and called for that psalm which begins with these words,"
|
ref_text: "The king stood up and called for that psalm which begins with these words,."
|
||||||
language: English
|
language: English
|
||||||
|
|
||||||
# Other TTS engines (disabled by default)
|
# Other TTS engines (disabled by default)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue