brenorb commited on
Commit
7c6795b
·
verified ·
1 Parent(s): 223e248

Dataset: 2026-11-19

Browse files

Synthetic two-voice Brazilian Portuguese speech, assembled by scripts/assemble_dataset.py

.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ annotations/train.jsonl filter=lfs diff=lfs merge=lfs -text
LICENSE.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # License
2
+
3
+ The tiny-broca dataset (audio, metadata and annotations) is released under the
4
+ Creative Commons Attribution 4.0 International License (CC BY 4.0):
5
+ https://creativecommons.org/licenses/by/4.0/
6
+
7
+ ## Attribution
8
+
9
+ Please credit "tiny-broca dataset, brenorb (https://github.com/brenorb)" and
10
+ link to the dataset page.
11
+
12
+ ## Third-party material
13
+
14
+ - Text with `source` `cv` comes from the Mozilla Common Voice Brazilian
15
+ Portuguese sentence files (CC0), https://github.com/common-voice/common-voice.
16
+ The `source_id` and `source_url` columns identify each sentence.
17
+ - Text with `source` `converse` is generated by this project's deterministic
18
+ conversational slot pools, and text with `source` `templates` is generated
19
+ by its number/date/money templates. Both are written for this project.
20
+ - The audio was generated with Qwen3-TTS 1.7B Base (Apache-2.0). The two
21
+ voices are clones of real speakers from Mozilla Common Voice: short CC0
22
+ recordings, used only as voice prompts for the generator. The recordings
23
+ themselves are not distributed as training audio.
README.md ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: pt
3
+ task_categories:
4
+ - text-to-speech
5
+ license: cc-by-4.0
6
+ pretty_name: tiny-broca
7
+ configs:
8
+ - config_name: batch1
9
+ default: true
10
+ data_files:
11
+ - split: train
12
+ path: data/train-*.parquet
13
+ - split: validation
14
+ path: data/validation-*.parquet
15
+ - split: test
16
+ path: data/test-*.parquet
17
+ - config_name: batch2
18
+ data_files:
19
+ - split: train
20
+ path: batch2/data/train-*.parquet
21
+ - config_name: batch3
22
+ data_files:
23
+ - split: train
24
+ path: batch3/data/train-*.parquet
25
+ ---
26
+ # tiny-broca dataset
27
+
28
+ A synthetic **Brazilian Portuguese** speech corpus with two voices, F1
29
+ (female) and M1 (male), made to train the tiny-broca text-to-speech model.
30
+ Every sentence is read by both voices.
31
+
32
+ | | |
33
+ |---|---|
34
+ | Sentences | 9,384 |
35
+ | Clips | 16,434 accepted of 19,504 generated |
36
+ | Duration | 17.3 hours |
37
+ | Voices | F1, M1 |
38
+ | Audio | 24 kHz mono, 16-bit FLAC, stored inside the Parquet files |
39
+ | Language | Portuguese (Brazil) |
40
+ | License | CC BY 4.0 |
41
+
42
+ ## Usage
43
+
44
+ ```python
45
+ from datasets import load_dataset
46
+
47
+ batch1 = load_dataset("brenorb/tiny-broca", "batch1")
48
+ batch2 = load_dataset("brenorb/tiny-broca", "batch2")
49
+ batch3 = load_dataset("brenorb/tiny-broca", "batch3")
50
+
51
+ row = batch1["train"][0]
52
+ print(row["voice"], row["text"])
53
+ audio = row["audio"]["array"]
54
+ ```
55
+
56
+ ## Contents
57
+
58
+ Counts are the accepted clips' unique sentences; each sentence is read by
59
+ both voices, so the clip count is roughly twice the sentence count.
60
+
61
+ | Config | Split | Sentences | Clips | 16,434 accepted of 19,504 generated |
62
+ |---|---|---:|---:|---|
63
+ | `batch1` | train | 3,560 | 7,119 | conversational sentences and Common Voice |
64
+ | `batch1` | validation | 647 | 1,294 | same |
65
+ | `batch1` | test | 404 | 807 | same |
66
+ | `batch2` | train | 3,327 | 6,653 | Common Voice and templates |
67
+ | `batch3` | train | 343 | 561 | money phrases: amounts, cards and bills |
68
+
69
+ `batch1` mirrors the first batch of the corpus this project follows
70
+ (conversational speech plus natural sentences); `batch2` is training data
71
+ only, mirroring its second batch (news-style sentences plus sentences that
72
+ exercise every rule of the text normalisation). `batch3` is training data
73
+ only: phrases dominated by money amounts, generated after the first training
74
+ run so the model hears numbers read at their full value. Splits are made by
75
+ sentence: both readings of a sentence are always in the same split, so the
76
+ validation and test sentences are the same for every model trained on this
77
+ corpus.
78
+
79
+ ## How it was made
80
+
81
+ 1. The two voices were created by voice cloning: each is Qwen3-TTS 1.7B
82
+ prompted with a short clean recording of a real speaker from Mozilla Common
83
+ Voice (CC0). Voices designed from text descriptions (the English model's
84
+ method) were auditioned and rejected as less natural. The reference clips
85
+ are in `references/`, with their sources and seeds in `voices.json`.
86
+ 2. Each sentence was synthesised in both voices with Qwen3-TTS 1.7B Base,
87
+ using the reference clips as the voice prompt.
88
+ 3. Each clip was transcribed with Whisper (multilingual, pt). Clips above 15%
89
+ word error rate, or with implausible duration, speaking rate or silence,
90
+ were generated a second time; clips that failed twice were left out. 0 clips failed twice and are listed in `generation/*/review.jsonl`.
91
+ 4. Accepted clips were peak-normalised to 0.95.
92
+
93
+ The generation scripts and their settings are in `generation/`.
94
+
95
+ The automatic screening catches wrong or missing words. It does not measure
96
+ naturalness, and the corpus has not been checked by listeners clip by clip.
97
+
98
+ ## Text sources
99
+
100
+ The `source` column records where every sentence came from.
101
+
102
+ | Source | Sentences | License of the text |
103
+ |---|---:|---|
104
+ | Mozilla Common Voice (Brazilian Portuguese) | 4,405 | CC0 |
105
+ | Conversational sentences, generated deterministically from written slot pools | 3,500 | this project |
106
+ | Templates: Brazilian numbers, dates, times, money, identifiers, questions | 1,079 | this project |
107
+ | Money phrases (`batch3`) | 400 | this project |
108
+
109
+ Accepted clips by source: Common Voice 7,706, conversational 6,589,
110
+ templates 1,578, money 561.
111
+
112
+ The conversational slots keep the corpus reproducible: the same seed produces
113
+ the same sentences.
114
+
115
+ ## Columns
116
+
117
+ | Column | Description |
118
+ |---|---|
119
+ | `id` | Clip ID: batch, voice, split and sentence index, e.g. `b1_F1_test_00390` |
120
+ | `text_id` | Sentence ID in the corpus, e.g. `broca01_00000` |
121
+ | `batch` | 1 (conversational and Common Voice) or 2 (Common Voice and templates) |
122
+ | `split` | train, validation or test |
123
+ | `text` | The sentence that was read |
124
+ | `source` | `cv`, `converse` or `templates` |
125
+ | `source_license`, `source_url` | `cc0-1.0` for Common Voice sentences, otherwise `project-own` |
126
+ | `voice` | F1 or M1 |
127
+ | `audio` | 24 kHz audio, as bytes, path and sample rate |
128
+ | `duration_seconds`, `sample_rate` | Audio length and rate |
129
+ | `asr_transcript`, `normalized_wer` | Whisper transcript and its word error rate against `text` |
130
+ | `gen_seconds`, `rtf` | Generation time and real-time factor of the clip |
131
+ | `teacher_model`, `reference_audio` | Model and voice prompt used |
132
+
133
+ ## Annotations
134
+
135
+ `annotations/` holds the letter-level annotations used for training: the
136
+ letter tokens, the stress feature, and the duration of each letter in 10.7 ms
137
+ frames, from forced alignment with
138
+ `jonatasgrosman/wav2vec2-xls-r-1b-portuguese`. Clips that fail the alignment
139
+ checks are listed with a reason in the `*.rejected.jsonl` files. See
140
+ [docs/annotations.md](https://github.com/brenorb/tiny-broca/blob/main/docs/annotations.md)
141
+ in the code repository. 14,290 clips are annotated; 933 failed the alignment checks.
142
+
143
+ ## Limitations
144
+
145
+ - The speech is synthetic. It carries the pronunciation habits and errors of
146
+ the model that generated it (for example, a reduced vowel in the standalone
147
+ word *se* in some clips).
148
+ - Two voices, one accent, read speech only.
149
+ - The two voice references are real recordings of Common Voice contributors;
150
+ they are included as `references/` for provenance and are not training
151
+ audio.
152
+
153
+ ## License
154
+
155
+ CC BY 4.0. Please credit "tiny-broca dataset, brenorb" and link to this page.
156
+
157
+ ```bibtex
158
+ @misc{brenorb2026tinybrocadata,
159
+ author = {brenorb},
160
+ title = {tiny-broca dataset: synthetic two-voice Brazilian Portuguese speech},
161
+ year = {2026},
162
+ url = {https://huggingface.co/datasets/brenorb/tiny-broca}
163
+ }
164
+ ```
165
+
166
+ The Common Voice sentences are CC0, from
167
+ https://github.com/common-voice/common-voice. The audio was generated with
168
+ Qwen3-TTS (Apache-2.0). See `LICENSE.md`.
annotations/phonemes.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
annotations/test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
annotations/test.rejected.jsonl ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"id": "b1_M1_test_00001", "speaker": "M1", "text": "Sabe, quando o carregador chega?", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.974, "weak_phone_fraction": 0.0, "max_phone_frames": 76, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.07, "pause_frames": 13, "leading_frames": 9, "trailing_frames": 4, "vowel_voiced": 0.875, "voiceless_voiced": 0.0, "pause_voiced": 0.0, "pause_level_db": -82.8, "speech_level_db": -10.4, "silence_threshold_db": -55.5}}
2
+ {"id": "b1_M1_test_00017", "speaker": "M1", "text": "Oi, Renata, como você está? Eu estou bem surpreso né?", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9579, "weak_phone_fraction": 0.025, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.68, "pause_frames": 54, "leading_frames": 54, "trailing_frames": 0, "vowel_voiced": 0.5734, "voiceless_voiced": 0.3333, "pause_voiced": 0.0, "pause_level_db": -83.6, "speech_level_db": -12.4, "silence_threshold_db": -57.9}}
3
+ {"id": "b1_M1_test_00031", "speaker": "M1", "text": "Olha só, sério? Eu nunca imaginei que fosse assim.", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9962, "weak_phone_fraction": 0.0, "max_phone_frames": 73, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.5, "pause_frames": 13, "leading_frames": 8, "trailing_frames": 5, "vowel_voiced": 0.3975, "voiceless_voiced": 0.2727, "pause_voiced": 0.0, "pause_level_db": -77.4, "speech_level_db": -9.4, "silence_threshold_db": -54.4}}
4
+ {"id": "b1_M1_test_00044", "speaker": "M1", "text": "Eu não deveria ter dito isso!", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9988, "weak_phone_fraction": 0.0, "max_phone_frames": 43, "one_frame_phone_fraction": 0.0, "phones_per_second": 12.99, "pause_frames": 22, "leading_frames": 18, "trailing_frames": 4, "vowel_voiced": 0.4842, "voiceless_voiced": 0.8182, "pause_voiced": 0.0, "pause_level_db": -84.3, "speech_level_db": -10.9, "silence_threshold_db": -56.0}}
5
+ {"id": "b1_M1_test_00047", "speaker": "M1", "text": "Olha esse tempo, parece que vai chover a tarde hein?", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.8494, "weak_phone_fraction": 0.0732, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 13.25, "pause_frames": 18, "leading_frames": 18, "trailing_frames": 0, "vowel_voiced": 0.5776, "voiceless_voiced": 0.6471, "pause_voiced": 0.0, "pause_level_db": -89.6, "speech_level_db": -13.0, "silence_threshold_db": -58.1}}
6
+ {"id": "b1_M1_test_00106", "speaker": "M1", "text": "Então, vamos passar na a praia no caminho?", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9694, "weak_phone_fraction": 0.0303, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 11.81, "pause_frames": 31, "leading_frames": 19, "trailing_frames": 12, "vowel_voiced": 0.4797, "voiceless_voiced": 0.7917, "pause_voiced": 0.0, "pause_level_db": -76.1, "speech_level_db": -10.8, "silence_threshold_db": -56.1}}
7
+ {"id": "b1_M1_test_00136", "speaker": "M1", "text": "global, asperger, savantismo", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9905, "weak_phone_fraction": 0.0, "max_phone_frames": 97, "one_frame_phone_fraction": 0.0, "phones_per_second": 6.62, "pause_frames": 58, "leading_frames": 58, "trailing_frames": 0, "vowel_voiced": 0.443, "voiceless_voiced": 0.5, "pause_voiced": 0.0, "pause_level_db": -83.4, "speech_level_db": -10.8, "silence_threshold_db": -56.1}}
8
+ {"id": "b1_M1_test_00137", "speaker": "M1", "text": "Peço desculpa, que tava ocupado. Não teve como chegar antes viu?", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9875, "weak_phone_fraction": 0.0, "max_phone_frames": 83, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.68, "pause_frames": 16, "leading_frames": 12, "trailing_frames": 4, "vowel_voiced": 0.489, "voiceless_voiced": 0.4706, "pause_voiced": 0.0, "pause_level_db": -81.1, "speech_level_db": -9.9, "silence_threshold_db": -55.0}}
9
+ {"id": "b1_M1_test_00168", "speaker": "M1", "text": "Sabe de uma coisa? posso te buscar às 11 e quinze? Aí a gente vai junto.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9559, "weak_phone_fraction": 0.0, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 11.59, "pause_frames": 12, "leading_frames": 12, "trailing_frames": 0, "vowel_voiced": 0.6274, "voiceless_voiced": 0.5263, "pause_voiced": 0.0, "pause_level_db": -80.4, "speech_level_db": -18.0, "silence_threshold_db": -63.0}}
10
+ {"id": "b1_M1_test_00174", "speaker": "M1", "text": "Beatriz, você comeu alguma coisa hoje?", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9997, "weak_phone_fraction": 0.0, "max_phone_frames": 72, "one_frame_phone_fraction": 0.0, "phones_per_second": 8.89, "pause_frames": 18, "leading_frames": 13, "trailing_frames": 5, "vowel_voiced": 0.8658, "voiceless_voiced": 0.5, "pause_voiced": 0.0, "pause_level_db": -84.3, "speech_level_db": -11.9, "silence_threshold_db": -57.1}}
11
+ {"id": "b1_M1_test_00207", "speaker": "M1", "text": "Olha, no fim de semana a gente vai no cinema, quer ir junto?", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9834, "weak_phone_fraction": 0.0, "max_phone_frames": 62, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.42, "pause_frames": 38, "leading_frames": 32, "trailing_frames": 6, "vowel_voiced": 0.4941, "voiceless_voiced": 0.5556, "pause_voiced": 0.0, "pause_level_db": -75.2, "speech_level_db": -10.7, "silence_threshold_db": -55.7}}
12
+ {"id": "b1_M1_test_00209", "speaker": "M1", "text": "É que bom dia, Vera. Dormiu bem? Eu acordei cedo hoje.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9721, "weak_phone_fraction": 0.0, "max_phone_frames": 77, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.74, "pause_frames": 50, "leading_frames": 6, "trailing_frames": 44, "vowel_voiced": 0.8043, "voiceless_voiced": null, "pause_voiced": 0.0, "pause_level_db": -63.1, "speech_level_db": -11.1, "silence_threshold_db": -56.3}}
13
+ {"id": "b1_M1_test_00216", "speaker": "M1", "text": "Olha, faz quanto tempo você não vai à a farmácia?", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.97, "weak_phone_fraction": 0.0263, "max_phone_frames": 79, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.36, "pause_frames": 91, "leading_frames": 88, "trailing_frames": 3, "vowel_voiced": 0.5867, "voiceless_voiced": 0.4, "pause_voiced": 0.0, "pause_level_db": -86.3, "speech_level_db": -13.9, "silence_threshold_db": -59.7}}
14
+ {"id": "b1_M1_test_00255", "speaker": "M1", "text": "Esta não é sua caixa de correio.", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9939, "weak_phone_fraction": 0.0, "max_phone_frames": 80, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.41, "pause_frames": 21, "leading_frames": 17, "trailing_frames": 4, "vowel_voiced": 0.4826, "voiceless_voiced": 0.3333, "pause_voiced": 0.0, "pause_level_db": -80.6, "speech_level_db": -10.1, "silence_threshold_db": -55.3}}
15
+ {"id": "b1_M1_test_00259", "speaker": "M1", "text": "Assisti o projeto ontem à noite, não foi nada demais.", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9764, "weak_phone_fraction": 0.0, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.99, "pause_frames": 19, "leading_frames": 18, "trailing_frames": 1, "vowel_voiced": 0.479, "voiceless_voiced": 0.2955, "pause_voiced": 0.0, "pause_level_db": -82.2, "speech_level_db": -13.0, "silence_threshold_db": -58.0}}
16
+ {"id": "b1_M1_test_00260", "speaker": "M1", "text": "Bom dia, Felipe. Dormiu bem? Eu acordei cedo hoje.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9756, "weak_phone_fraction": 0.0, "max_phone_frames": 79, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.16, "pause_frames": 31, "leading_frames": 28, "trailing_frames": 3, "vowel_voiced": 0.7978, "voiceless_voiced": 0.3333, "pause_voiced": 0.0, "pause_level_db": -82.9, "speech_level_db": -10.7, "silence_threshold_db": -56.4}}
17
+ {"id": "b1_M1_test_00268", "speaker": "M1", "text": "Sabe de uma coisa? o boleto vence semana que vem, não precisa se preocupar de verdade", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9987, "weak_phone_fraction": 0.0, "max_phone_frames": 75, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.52, "pause_frames": 62, "leading_frames": 42, "trailing_frames": 20, "vowel_voiced": 0.7226, "voiceless_voiced": 0.2917, "pause_voiced": 0.0, "pause_level_db": -69.7, "speech_level_db": -10.2, "silence_threshold_db": -55.2}}
18
+ {"id": "b1_M1_test_00306", "speaker": "M1", "text": "É que passou água pra mim? Eu te devolvo depois.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9742, "weak_phone_fraction": 0.0, "max_phone_frames": 75, "one_frame_phone_fraction": 0.027, "phones_per_second": 10.77, "pause_frames": 16, "leading_frames": 14, "trailing_frames": 2, "vowel_voiced": 0.7212, "voiceless_voiced": 0.1961, "pause_voiced": 0.0, "pause_level_db": -83.9, "speech_level_db": -12.6, "silence_threshold_db": -57.7}}
19
+ {"id": "b1_M1_test_00341", "speaker": "M1", "text": "Olha, oi, Rafael, como você está? Eu estou um pouco nervoso.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.994, "weak_phone_fraction": 0.0, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.85, "pause_frames": 31, "leading_frames": 27, "trailing_frames": 4, "vowel_voiced": 0.5519, "voiceless_voiced": 0.1818, "pause_voiced": 0.0, "pause_level_db": -80.4, "speech_level_db": -12.1, "silence_threshold_db": -57.3}}
20
+ {"id": "b1_M1_test_00381", "speaker": "M1", "text": "Pois é, coloquei a festa pra tocar, fica aí.", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9442, "weak_phone_fraction": 0.0, "max_phone_frames": 62, "one_frame_phone_fraction": 0.0303, "phones_per_second": 10.67, "pause_frames": 33, "leading_frames": 4, "trailing_frames": 5, "vowel_voiced": 0.4859, "voiceless_voiced": 0.3913, "pause_voiced": 0.0606, "pause_level_db": -66.0, "speech_level_db": -10.7, "silence_threshold_db": -55.9}}
21
+ {"id": "b1_M1_test_00397", "speaker": "M1", "text": "Armando Torres da Silva", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9959, "weak_phone_fraction": 0.0, "max_phone_frames": 74, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.47, "pause_frames": 27, "leading_frames": 21, "trailing_frames": 6, "vowel_voiced": 0.4188, "voiceless_voiced": 0.5455, "pause_voiced": 0.0, "pause_level_db": -82.6, "speech_level_db": -12.5, "silence_threshold_db": -57.6}}
22
+ {"id": "b1_M1_test_00411", "speaker": "M1", "text": "Pois é, que dia lindo hoje! né?", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9645, "weak_phone_fraction": 0.0, "max_phone_frames": 56, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.38, "pause_frames": 13, "leading_frames": 5, "trailing_frames": 8, "vowel_voiced": 0.4966, "voiceless_voiced": 0.5714, "pause_voiced": 0.0, "pause_level_db": -65.5, "speech_level_db": -10.8, "silence_threshold_db": -55.9}}
23
+ {"id": "b1_M1_test_00418", "speaker": "M1", "text": "Então, nossa, Matheus, eu tava muito feliz depois de saber disso.", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9745, "weak_phone_fraction": 0.0, "max_phone_frames": 72, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.87, "pause_frames": 40, "leading_frames": 38, "trailing_frames": 2, "vowel_voiced": 0.4961, "voiceless_voiced": 0.6154, "pause_voiced": 0.0, "pause_level_db": -88.8, "speech_level_db": -14.8, "silence_threshold_db": -60.2}}
24
+ {"id": "b1_M1_test_00445", "speaker": "M1", "text": "O corpo docente está superqualificado.", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9996, "weak_phone_fraction": 0.0, "max_phone_frames": 23, "one_frame_phone_fraction": 0.0, "phones_per_second": 12.42, "pause_frames": 14, "leading_frames": 11, "trailing_frames": 3, "vowel_voiced": 0.4135, "voiceless_voiced": 0.2222, "pause_voiced": 0.0, "pause_level_db": -83.4, "speech_level_db": -13.1, "silence_threshold_db": -58.3}}
25
+ {"id": "b1_M1_test_00464", "speaker": "M1", "text": "De qualquer forma, você viu o embrulho? Tô procurando desde cedo.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9632, "weak_phone_fraction": 0.0, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 11.69, "pause_frames": 11, "leading_frames": 6, "trailing_frames": 5, "vowel_voiced": 0.6707, "voiceless_voiced": 0.4444, "pause_voiced": 0.0, "pause_level_db": -83.7, "speech_level_db": -11.5, "silence_threshold_db": -56.5}}
26
+ {"id": "b1_M1_test_00254", "speaker": "M1", "text": "É que passou água pra mim? Tô com sede.", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9518, "weak_phone_fraction": 0.0, "max_phone_frames": 21, "one_frame_phone_fraction": 0.0, "phones_per_second": 13.46, "pause_frames": 68, "leading_frames": 33, "trailing_frames": 13, "vowel_voiced": 0.4535, "voiceless_voiced": 0.2941, "pause_voiced": 0.0147, "pause_level_db": -61.4, "speech_level_db": -13.1, "silence_threshold_db": -59.2}}
27
+ {"id": "b1_M1_test_00378", "speaker": "M1", "text": "Pois é, ei, Beatriz, faz tempo que a gente não se vê.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.931, "weak_phone_fraction": 0.0, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.3, "pause_frames": 15, "leading_frames": 13, "trailing_frames": 2, "vowel_voiced": 0.5882, "voiceless_voiced": 0.4737, "pause_voiced": 0.0, "pause_level_db": -85.7, "speech_level_db": -16.4, "silence_threshold_db": -61.5}}
annotations/train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b5295428aec1ddfca7eb08b94d2fa7a0a7787f7c2bd5474563d0842328cde76
3
+ size 24672444
annotations/train.rejected.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
annotations/validation.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
annotations/validation.rejected.jsonl ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"id": "b1_M1_val_00002", "speaker": "M1", "text": "A xícara de café está muito alta.", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9991, "weak_phone_fraction": 0.0, "max_phone_frames": 54, "one_frame_phone_fraction": 0.0, "phones_per_second": 8.99, "pause_frames": 7, "leading_frames": 7, "trailing_frames": 0, "vowel_voiced": 0.3441, "voiceless_voiced": 0.4375, "pause_voiced": 0.0, "pause_level_db": -77.0, "speech_level_db": -12.5, "silence_threshold_db": -57.7}}
2
+ {"id": "b1_M1_val_00009", "speaker": "M1", "text": "Sabe, assisti a música ontem à noite, não foi nada demais.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.922, "weak_phone_fraction": 0.0444, "max_phone_frames": 78, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.83, "pause_frames": 14, "leading_frames": 13, "trailing_frames": 1, "vowel_voiced": 0.7812, "voiceless_voiced": 0.1418, "pause_voiced": 0.0, "pause_level_db": -84.6, "speech_level_db": -14.6, "silence_threshold_db": -59.8}}
3
+ {"id": "b1_M1_val_00046", "speaker": "M1", "text": "Isso é ótimo!", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9991, "weak_phone_fraction": 0.0, "max_phone_frames": 37, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.97, "pause_frames": 19, "leading_frames": 17, "trailing_frames": 2, "vowel_voiced": 0.3485, "voiceless_voiced": 0.1667, "pause_voiced": 0.0, "pause_level_db": -77.8, "speech_level_db": -9.1, "silence_threshold_db": -54.6}}
4
+ {"id": "b1_M1_val_00059", "speaker": "M1", "text": "Sabe, cheguei atrasado, porque o carro quebrou. A partir de agora prometo melhorar viu?", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.927, "weak_phone_fraction": 0.0429, "max_phone_frames": 77, "one_frame_phone_fraction": 0.0, "phones_per_second": 11.55, "pause_frames": 40, "leading_frames": 21, "trailing_frames": 19, "vowel_voiced": 0.6544, "voiceless_voiced": 0.303, "pause_voiced": 0.0, "pause_level_db": -68.7, "speech_level_db": -11.1, "silence_threshold_db": -56.2}}
5
+ {"id": "b1_M1_val_00067", "speaker": "M1", "text": "Você viu o controle? Tô procurando desde cedo com certeza", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9619, "weak_phone_fraction": 0.0, "max_phone_frames": 81, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.38, "pause_frames": 55, "leading_frames": 17, "trailing_frames": 38, "vowel_voiced": 0.5798, "voiceless_voiced": 0.5833, "pause_voiced": 0.0, "pause_level_db": -73.7, "speech_level_db": -9.9, "silence_threshold_db": -55.3}}
6
+ {"id": "b1_M1_val_00081", "speaker": "M1", "text": "Oi, Thiago, tudo bem? Vi que você veio, que bom com certeza", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.97, "weak_phone_fraction": 0.0227, "max_phone_frames": 74, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.01, "pause_frames": 53, "leading_frames": 24, "trailing_frames": 29, "vowel_voiced": 0.7749, "voiceless_voiced": 0.0, "pause_voiced": 0.0189, "pause_level_db": -64.3, "speech_level_db": -10.5, "silence_threshold_db": -55.7}}
7
+ {"id": "b1_M1_val_00083", "speaker": "M1", "text": "Passou café pra mim? Eu te devolvo depois.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9768, "weak_phone_fraction": 0.0, "max_phone_frames": 73, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.63, "pause_frames": 9, "leading_frames": 6, "trailing_frames": 3, "vowel_voiced": 0.8148, "voiceless_voiced": 0.1613, "pause_voiced": 0.0, "pause_level_db": -80.1, "speech_level_db": -9.2, "silence_threshold_db": -54.2}}
8
+ {"id": "b1_M1_val_00118", "speaker": "M1", "text": "Do bastião, o melhor é a espinha.", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9621, "weak_phone_fraction": 0.0, "max_phone_frames": 72, "one_frame_phone_fraction": 0.0, "phones_per_second": 7.32, "pause_frames": 18, "leading_frames": 15, "trailing_frames": 3, "vowel_voiced": 0.4975, "voiceless_voiced": 0.25, "pause_voiced": 0.0, "pause_level_db": -81.1, "speech_level_db": -10.3, "silence_threshold_db": -55.7}}
9
+ {"id": "b1_M1_val_00149", "speaker": "M1", "text": "Eu não acho que eu te siga.", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9801, "weak_phone_fraction": 0.0, "max_phone_frames": 128, "one_frame_phone_fraction": 0.0, "phones_per_second": 7.91, "pause_frames": 56, "leading_frames": 51, "trailing_frames": 5, "vowel_voiced": 0.2541, "voiceless_voiced": 0.0, "pause_voiced": 0.0, "pause_level_db": -82.6, "speech_level_db": -11.0, "silence_threshold_db": -56.5}}
10
+ {"id": "b1_M1_val_00181", "speaker": "M1", "text": "O que vai acontecer?", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9906, "weak_phone_fraction": 0.0, "max_phone_frames": 77, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.2, "pause_frames": 17, "leading_frames": 14, "trailing_frames": 3, "vowel_voiced": 0.7727, "voiceless_voiced": 1.0, "pause_voiced": 0.0, "pause_level_db": -66.5, "speech_level_db": -10.0, "silence_threshold_db": -55.0}}
11
+ {"id": "b1_M1_val_00183", "speaker": "M1", "text": "Olha só, meu, Seu João, eu sei que dá pra resolver isso hoje em dia", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9955, "weak_phone_fraction": 0.0, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.61, "pause_frames": 15, "leading_frames": 10, "trailing_frames": 5, "vowel_voiced": 0.5364, "voiceless_voiced": 0.6667, "pause_voiced": 0.0, "pause_level_db": -81.7, "speech_level_db": -12.9, "silence_threshold_db": -58.1}}
12
+ {"id": "b1_M1_val_00198", "speaker": "M1", "text": "Ninguém pretende construir uma parede.", "reasons": ["overlong_phone", "vowels_not_voiced"], "qc": {"token_probability_mean": 0.9996, "weak_phone_fraction": 0.0, "max_phone_frames": 79, "one_frame_phone_fraction": 0.0, "phones_per_second": 12.73, "pause_frames": 35, "leading_frames": 24, "trailing_frames": 11, "vowel_voiced": 0.3846, "voiceless_voiced": 0.2143, "pause_voiced": 0.0, "pause_level_db": -74.5, "speech_level_db": -11.0, "silence_threshold_db": -56.1}}
13
+ {"id": "b1_M1_val_00215", "speaker": "M1", "text": "É que eu fiquei preocupado com a notícia.", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9674, "weak_phone_fraction": 0.0, "max_phone_frames": 42, "one_frame_phone_fraction": 0.0, "phones_per_second": 13.57, "pause_frames": 12, "leading_frames": 10, "trailing_frames": 2, "vowel_voiced": 0.4599, "voiceless_voiced": 0.3333, "pause_voiced": 0.0, "pause_level_db": -77.7, "speech_level_db": -9.6, "silence_threshold_db": -54.6}}
14
+ {"id": "b1_M1_val_00246", "speaker": "M1", "text": "Então, peço desculpa, que tava ocupado. Não teve como chegar antes hoje em dia", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9791, "weak_phone_fraction": 0.0161, "max_phone_frames": 73, "one_frame_phone_fraction": 0.0, "phones_per_second": 11.2, "pause_frames": 14, "leading_frames": 11, "trailing_frames": 3, "vowel_voiced": 0.6623, "voiceless_voiced": 0.5, "pause_voiced": 0.0, "pause_level_db": -82.2, "speech_level_db": -13.3, "silence_threshold_db": -58.3}}
15
+ {"id": "b1_M1_val_00279", "speaker": "M1", "text": "Ei, Sofia, faz tempo que a gente não se vê.", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9274, "weak_phone_fraction": 0.0323, "max_phone_frames": 71, "one_frame_phone_fraction": 0.0, "phones_per_second": 9.95, "pause_frames": 8, "leading_frames": 2, "trailing_frames": 6, "vowel_voiced": 0.5303, "voiceless_voiced": 0.3077, "pause_voiced": 0.0, "pause_level_db": -82.0, "speech_level_db": -11.8, "silence_threshold_db": -56.8}}
16
+ {"id": "b1_M1_val_00322", "speaker": "M1", "text": "Sabe de uma coisa? o cartão não passou, o caixa disse que é falha faz sentido", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.9523, "weak_phone_fraction": 0.0, "max_phone_frames": 80, "one_frame_phone_fraction": 0.0, "phones_per_second": 10.92, "pause_frames": 33, "leading_frames": 32, "trailing_frames": 1, "vowel_voiced": 0.5495, "voiceless_voiced": 0.3256, "pause_voiced": 0.0, "pause_level_db": -87.6, "speech_level_db": -13.3, "silence_threshold_db": -58.6}}
17
+ {"id": "b1_M1_val_00359", "speaker": "M1", "text": "Força mais forte", "reasons": ["vowels_not_voiced"], "qc": {"token_probability_mean": 0.9995, "weak_phone_fraction": 0.0, "max_phone_frames": 15, "one_frame_phone_fraction": 0.0, "phones_per_second": 13.53, "pause_frames": 8, "leading_frames": 5, "trailing_frames": 3, "vowel_voiced": 0.4667, "voiceless_voiced": 0.25, "pause_voiced": 0.0, "pause_level_db": -83.1, "speech_level_db": -11.9, "silence_threshold_db": -57.3}}
18
+ {"id": "b1_M1_val_00243", "speaker": "M1", "text": "Eu vou à a praça amanhã de manhã hein?", "reasons": ["overlong_phone"], "qc": {"token_probability_mean": 0.8337, "weak_phone_fraction": 0.1379, "max_phone_frames": 92, "one_frame_phone_fraction": 0.0, "phones_per_second": 8.91, "pause_frames": 18, "leading_frames": 18, "trailing_frames": 0, "vowel_voiced": 0.5957, "voiceless_voiced": 0.5, "pause_voiced": 0.0, "pause_level_db": -84.5, "speech_level_db": -13.9, "silence_threshold_db": -59.1}}
batch2/data/train-2026-11-19.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c785d6a6e6088160635d25ad79df745ab588c52ef6c605d2bce328b927ab945a
3
+ size 621243104
batch3/data/train-2026-11-19.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f53014da7c06b8c7b6f1de7c466cb9204ea89da9f3209a0a83c89b937687f5a
3
+ size 76487197
data/test-2026-11-19.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9bca5fe26b34b333c20c22b9083aed6cebcf0f82b412365b29c8441dee681cb9
3
+ size 75865831
data/train-2026-11-19.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45377afdf0271f2d3db4831ab4f2f1bf656101b63f5402d9c9b9bb3fc82b16bf
3
+ size 665376506
data/validation-2026-11-19.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0dbadec71ad64617b90abe7752b300f81ce515321849582599a9c9237491c67e
3
+ size 122246411
generation/generate_audio.py ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ """Generate the tiny-broca training audio with Qwen3-TTS (Brazilian Portuguese).
3
+
4
+ Every corpus sentence is read by both voices (F1, M1), like the original
5
+ tiny-voca dataset. Generation is resumable (sqlite state in the output dir),
6
+ peak-normalised to 0.95, and quality-checked per clip with faster-whisper
7
+ (int8 on CPU): WER with a number-masking normaliser plus a duration range.
8
+
9
+ Write a file named STOP inside the output directory to stop gracefully after
10
+ the current batch; rerun to continue.
11
+
12
+ Usage:
13
+ python scripts/generate_audio.py \
14
+ --corpus data/corpus --refs data/pilot/references \
15
+ --out data/audio --device mps
16
+ """
17
+
18
+ import argparse
19
+ import json
20
+ import sqlite3
21
+ import sys
22
+ import time
23
+ from pathlib import Path
24
+
25
+ import numpy as np
26
+ import soundfile as sf
27
+ import torch
28
+ from faster_whisper import WhisperModel
29
+ from jiwer import wer
30
+ from qwen_tts import Qwen3TTSModel
31
+
32
+ BASE_MODEL = "Qwen/Qwen3-TTS-12Hz-1.7B-Base"
33
+ VOICE_REFS = {"F1": "F1", "M1": "M1"} # selected Common Voice clones (data/refs)
34
+
35
+ from tiny_broca.text import wer_normalize
36
+
37
+
38
+ def load_corpus(corpus_dir: Path):
39
+ import pyarrow.parquet as pq
40
+
41
+ sentences = []
42
+ for batch in (1, 2, 3):
43
+ for path in sorted(corpus_dir.glob(f"batch{batch}/*.parquet")):
44
+ table = pq.read_table(path)
45
+ for i, (text, source) in enumerate(zip(table.column("text").to_pylist(),
46
+ table.column("source").to_pylist())):
47
+ sentences.append({"batch": batch, "split": path.stem,
48
+ "index": i, "text": text, "source": source})
49
+ return sentences
50
+
51
+
52
+ def open_db(path: Path) -> sqlite3.Connection:
53
+ conn = sqlite3.connect(path)
54
+ conn.execute("""CREATE TABLE IF NOT EXISTS clips (
55
+ clip_id TEXT PRIMARY KEY, voice TEXT, batch INTEGER, split TEXT,
56
+ text TEXT, seconds REAL, sr INTEGER, gen_seconds REAL, rtf REAL,
57
+ wer REAL, transcript TEXT, status TEXT)""")
58
+ conn.execute("CREATE INDEX IF NOT EXISTS clips_status ON clips(status)")
59
+ return conn
60
+
61
+
62
+ def main():
63
+ ap = argparse.ArgumentParser()
64
+ ap.add_argument("--corpus", type=Path, default=Path("data/corpus"))
65
+ ap.add_argument("--refs", type=Path, default=Path("data/refs"))
66
+ ap.add_argument("--out", type=Path, default=Path("data/audio"))
67
+ ap.add_argument("--device", default="mps")
68
+ ap.add_argument("--threads", type=int, default=12)
69
+ ap.add_argument("--batch", type=int, default=8)
70
+ ap.add_argument("--seed", type=int, default=20261117)
71
+ args = ap.parse_args()
72
+
73
+ args.out.mkdir(parents=True, exist_ok=True)
74
+ torch.set_num_threads(args.threads)
75
+
76
+ refs = json.loads((args.refs / "voices.json").read_text())
77
+ sentences = load_corpus(args.corpus)
78
+ print(f"corpus: {len(sentences)} sentences", flush=True)
79
+
80
+ print("loading whisper small ...", flush=True)
81
+ asr = WhisperModel("small", device="cpu", compute_type="int8", cpu_threads=args.threads)
82
+
83
+ def transcribe(path):
84
+ import librosa
85
+ wave, rate = sf.read(str(path), dtype="float32")
86
+ if rate != 16000:
87
+ wave = librosa.resample(wave, orig_sr=rate, target_sr=16000)
88
+ segments, _ = asr.transcribe(wave, language="pt", beam_size=1, vad_filter=False)
89
+ return " ".join(s.text for s in segments)
90
+
91
+ print("loading Qwen3-TTS Base ...", flush=True)
92
+ base = Qwen3TTSModel.from_pretrained(BASE_MODEL, device_map=args.device,
93
+ dtype=torch.bfloat16, attn_implementation="sdpa")
94
+ prompts = {}
95
+ for voice, ref_tag in VOICE_REFS.items():
96
+ prompts[voice] = base.create_voice_clone_prompt(
97
+ ref_audio=str(args.refs / f"{ref_tag}.wav"),
98
+ ref_text=refs[ref_tag]["text"], x_vector_only_mode=False)
99
+ print(f"voice {voice} <- {ref_tag}.wav", flush=True)
100
+
101
+ conn = open_db(args.out / "state.db")
102
+ # Every attempted clip (ok or bad) is skipped: a clip that failed its two
103
+ # attempts is excluded by design and must not be regenerated on a resume.
104
+ done = {r[0] for r in conn.execute("SELECT clip_id FROM clips")}
105
+ jobs = []
106
+ for voice in VOICE_REFS:
107
+ for s in sentences:
108
+ cid = f"b{s['batch']}_{voice}_{s['split']}_{s['index']:05d}"
109
+ if cid not in done:
110
+ jobs.append((voice, cid, s))
111
+ print(f"to generate: {len(jobs)} clips "
112
+ f"({sum(1 for j in jobs if j[0] == 'F1')} F1, "
113
+ f"{sum(1 for j in jobs if j[0] == 'M1')} M1)", flush=True)
114
+
115
+ audio_dir = args.out / "audio"
116
+ audio_dir.mkdir(exist_ok=True)
117
+ t_start = time.time()
118
+ n_ok = n_bad = 0
119
+ last_report = 0
120
+ wers, rtfs = [], []
121
+
122
+ # Group remaining jobs by voice into batches.
123
+ per_voice = {v: [j for j in jobs if j[0] == v] for v in VOICE_REFS}
124
+ for voice, vjobs in per_voice.items():
125
+ prompt = prompts[voice]
126
+ for b0 in range(0, len(vjobs), args.batch):
127
+ if (args.out / "STOP").exists():
128
+ print("STOP file present, exiting", flush=True)
129
+ return
130
+ chunk = vjobs[b0:b0 + args.batch]
131
+ t0 = time.time()
132
+ wavs, sr = base.generate_voice_clone(
133
+ text=[s["text"] for _, _, s in chunk],
134
+ language=["Portuguese"] * len(chunk),
135
+ voice_clone_prompt=prompt, max_new_tokens=600,
136
+ seed=args.seed + b0)
137
+ gen = time.time() - t0
138
+ for (v, cid, s), wave in zip(chunk, wavs):
139
+ wave = np.asarray(wave, dtype=np.float32)
140
+ seconds = len(wave) / sr
141
+ peak = float(np.abs(wave).max())
142
+ if peak > 1e-9:
143
+ wave = wave / peak * 0.95
144
+ path = audio_dir / f"{cid}.flac"
145
+ sf.write(path, wave, sr)
146
+ transcript = transcribe(path)
147
+ w = wer(wer_normalize(s["text"]), wer_normalize(transcript)) if transcript else 1.0
148
+ ok = (0.5 <= seconds <= 35.0) and (w < 0.15) and transcript
149
+ conn.execute("INSERT OR REPLACE INTO clips VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
150
+ (cid, voice, s["batch"], s["split"], s["text"],
151
+ round(seconds, 3), sr, round(gen / len(chunk), 2),
152
+ round(gen / len(chunk) / max(seconds, 1e-9), 3),
153
+ round(w, 4), transcript, "ok" if ok else "bad"))
154
+ conn.commit()
155
+ if ok:
156
+ n_ok += 1
157
+ wers.append(w)
158
+ rtfs.append(gen / len(chunk) / max(seconds, 1e-9))
159
+ else:
160
+ n_bad += 1
161
+ print(f" BAD {cid}: {seconds:.1f}s WER {w:.2f}", flush=True)
162
+ done_n = n_ok + n_bad
163
+ if done_n - last_report >= 50 or b0 + args.batch >= len(vjobs):
164
+ last_report = done_n
165
+ (args.out / "progress.json").write_text(json.dumps({
166
+ "done": done_n, "ok": n_ok, "bad": n_bad,
167
+ "wer_mean": round(float(np.mean(wers)), 4) if wers else None,
168
+ "rtf_mean": round(float(np.mean(rtfs)), 3) if rtfs else None,
169
+ "elapsed_min": round((time.time() - t_start) / 60, 1),
170
+ "eta_h": round((time.time() - t_start) / max(done_n, 1)
171
+ * max(len(jobs) - done_n, 0) / 3600, 2)}))
172
+ print(f"voice {voice} batch {b0 // args.batch + 1}: "
173
+ f"total {done_n} (bad {n_bad}), "
174
+ f"WER {np.mean(wers) if wers else 0:.1%}, "
175
+ f"RTF {np.mean(rtfs) if rtfs else 0:.2f}, "
176
+ f"ETA {json.loads((args.out / 'progress.json').read_text())['eta_h']}h",
177
+ flush=True)
178
+
179
+ # Clips that failed the gate get one regeneration with a different seed;
180
+ # clips that fail twice are left out and listed in review.jsonl.
181
+ jobs_by_cid = {j[1]: j for j in jobs}
182
+ bad = [r for r in conn.execute('SELECT clip_id, voice FROM clips WHERE status="bad"')
183
+ if r[0] in jobs_by_cid]
184
+ for voice in VOICE_REFS:
185
+ vbad = [(cid, jobs_by_cid[cid][2]) for cid, v in bad if v == voice]
186
+ for b0 in range(0, len(vbad), args.batch):
187
+ if (args.out / "STOP").exists():
188
+ print("STOP file present, exiting", flush=True)
189
+ return
190
+ chunk = vbad[b0:b0 + args.batch]
191
+ t0 = time.time()
192
+ wavs, sr = base.generate_voice_clone(
193
+ text=[s["text"] for _, s in chunk],
194
+ language=["Portuguese"] * len(chunk),
195
+ voice_clone_prompt=prompts[voice], max_new_tokens=600,
196
+ seed=args.seed + 7919 + b0)
197
+ gen = time.time() - t0
198
+ for (cid, s), wave in zip(chunk, wavs):
199
+ wave = np.asarray(wave, dtype=np.float32)
200
+ seconds = len(wave) / sr
201
+ peak = float(np.abs(wave).max())
202
+ if peak > 1e-9:
203
+ wave = wave / peak * 0.95
204
+ path = audio_dir / f"{cid}.flac"
205
+ sf.write(path, wave, sr)
206
+ transcript = transcribe(path)
207
+ w = wer(wer_normalize(s["text"]), wer_normalize(transcript)) if transcript else 1.0
208
+ ok = (0.5 <= seconds <= 35.0) and (w < 0.15) and transcript
209
+ conn.execute("INSERT OR REPLACE INTO clips VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
210
+ (cid, voice, s["batch"], s["split"], s["text"],
211
+ round(seconds, 3), sr, round(gen / len(chunk), 2),
212
+ round(gen / len(chunk) / max(seconds, 1e-9), 3),
213
+ round(w, 4), transcript, "ok" if ok else "bad"))
214
+ conn.commit()
215
+ print(f" RETRY {cid}: {seconds:.1f}s WER {w:.2f} -> {'ok' if ok else 'bad'}", flush=True)
216
+ with (args.out / "review.jsonl").open("w") as fh:
217
+ for row in conn.execute(
218
+ 'SELECT clip_id, voice, text, seconds, wer, transcript FROM clips WHERE status="bad"'):
219
+ fh.write(json.dumps(dict(zip(
220
+ ("id", "voice", "text", "seconds", "wer", "transcript"), row)), ensure_ascii=False) + "\n")
221
+ hours = sum(r[0] for r in conn.execute(
222
+ 'SELECT seconds FROM clips WHERE status="ok"')) / 3600
223
+ conn.close()
224
+ print(json.dumps({"ok": n_ok, "bad": n_bad,
225
+ "wer_mean": round(float(np.mean(wers)), 4) if wers else None,
226
+ "rtf_mean": round(float(np.mean(rtfs)), 3) if rtfs else None,
227
+ "hours_audio": round(hours, 2)}))
228
+
229
+
230
+ if __name__ == "__main__":
231
+ main()
references/F1.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b51d95cf618c15c2174ca1a4e395bf11dd0e755339b8e3faf8cb1f150bbb0d5c
3
+ size 303404
references/M1.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8cff93e3a89a740d9c00c1e06588c8eac9af78d325ce8787a581c1d5a55e5c85
3
+ size 341804
references/voices.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "F1": {
3
+ "id": "F1",
4
+ "cv_clip": "cv_32377163",
5
+ "cv_text": "Quem fez isso por burros não deve se surpreender se os outros estão andando.",
6
+ "cv_url": "https://common-voice.org/datasets",
7
+ "render": "clone_32377163_s1_000.wav",
8
+ "text": "Estava pensando em tomar um café depois do trabalho e contar as novidades. Te espero lá!",
9
+ "sr": 24000,
10
+ "provenance": "Common Voice clip rendered by Qwen3-TTS 1.7B (MLX 4-bit), auditioned and selected"
11
+ },
12
+ "M1": {
13
+ "id": "M1",
14
+ "cv_clip": "cv_32377163",
15
+ "cv_text": "Quem fez isso por burros não deve se surpreender se os outros estão andando.",
16
+ "cv_url": "https://common-voice.org/datasets",
17
+ "render": "clone_32377163_s1_000.wav",
18
+ "text": "Estava pensando em tomar um café depois do trabalho e contar as novidades. Te espero lá!",
19
+ "sr": 24000,
20
+ "provenance": "Common Voice clip rendered by Qwen3-TTS 1.7B (MLX 4-bit), auditioned and selected"
21
+ }
22
+ }