@vocasync/astro 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Language support, which is not one list but two.
3
+ *
4
+ * Speech synthesis covers 57 languages. Forced alignment -- the word-level timing
5
+ * that drives highlighting and click-to-seek -- covers far fewer. A post that needs
6
+ * highlighting is therefore limited to the intersection; a post synthesised without
7
+ * alignment is limited only by the voice.
8
+ *
9
+ * Both lists mirror the enums published in the VocaSync OpenAPI document. Korean was
10
+ * withdrawn from alignment in September 2026 and remains available for synthesis.
11
+ */
12
+
13
+ /** Every language the synthesis voices can speak, ISO 639-1. */
14
+ export const SYNTHESIS_LANGUAGES = [
15
+ "af", // Afrikaans
16
+ "ar", // Arabic
17
+ "hy", // Armenian
18
+ "az", // Azerbaijani
19
+ "be", // Belarusian
20
+ "bs", // Bosnian
21
+ "bg", // Bulgarian
22
+ "ca", // Catalan
23
+ "zh", // Chinese
24
+ "hr", // Croatian
25
+ "cs", // Czech
26
+ "da", // Danish
27
+ "nl", // Dutch
28
+ "en", // English
29
+ "et", // Estonian
30
+ "fi", // Finnish
31
+ "fr", // French
32
+ "gl", // Galician
33
+ "de", // German
34
+ "el", // Greek
35
+ "he", // Hebrew
36
+ "hi", // Hindi
37
+ "hu", // Hungarian
38
+ "is", // Icelandic
39
+ "id", // Indonesian
40
+ "it", // Italian
41
+ "ja", // Japanese
42
+ "kn", // Kannada
43
+ "kk", // Kazakh
44
+ "ko", // Korean
45
+ "lv", // Latvian
46
+ "lt", // Lithuanian
47
+ "mk", // Macedonian
48
+ "ms", // Malay
49
+ "mr", // Marathi
50
+ "mi", // Maori
51
+ "ne", // Nepali
52
+ "no", // Norwegian
53
+ "fa", // Persian
54
+ "pl", // Polish
55
+ "pt", // Portuguese
56
+ "ro", // Romanian
57
+ "ru", // Russian
58
+ "sr", // Serbian
59
+ "sk", // Slovak
60
+ "sl", // Slovenian
61
+ "es", // Spanish
62
+ "sw", // Swahili
63
+ "sv", // Swedish
64
+ "tl", // Tagalog
65
+ "ta", // Tamil
66
+ "th", // Thai
67
+ "tr", // Turkish
68
+ "uk", // Ukrainian
69
+ "ur", // Urdu
70
+ "vi", // Vietnamese
71
+ "cy", // Welsh
72
+ ] as const;
73
+
74
+ /**
75
+ * Synthesis languages that can also be force-aligned, mapped to the locale the
76
+ * alignment API expects. A language absent from here can still be synthesised --
77
+ * it simply cannot carry word timings.
78
+ */
79
+ export const ALIGNMENT_LOCALES: Readonly<Record<string, string>> = {
80
+ en: "en-US", // English
81
+ fr: "fr", // French
82
+ de: "de", // German
83
+ es: "es", // Spanish
84
+ pt: "pt-PT", // Portuguese
85
+ sv: "sv", // Swedish
86
+ cs: "cs", // Czech
87
+ pl: "pl", // Polish
88
+ tr: "tr", // Turkish
89
+ ru: "ru", // Russian
90
+ uk: "uk", // Ukrainian
91
+ ja: "ja", // Japanese
92
+ zh: "zh-CN", // Chinese
93
+ };
94
+
95
+ /** Human-readable names, for error messages and docs. */
96
+ export const LANGUAGE_NAMES: Readonly<Record<string, string>> = {
97
+ af: "Afrikaans",
98
+ ar: "Arabic",
99
+ hy: "Armenian",
100
+ az: "Azerbaijani",
101
+ be: "Belarusian",
102
+ bs: "Bosnian",
103
+ bg: "Bulgarian",
104
+ ca: "Catalan",
105
+ zh: "Chinese",
106
+ hr: "Croatian",
107
+ cs: "Czech",
108
+ da: "Danish",
109
+ nl: "Dutch",
110
+ en: "English",
111
+ et: "Estonian",
112
+ fi: "Finnish",
113
+ fr: "French",
114
+ gl: "Galician",
115
+ de: "German",
116
+ el: "Greek",
117
+ he: "Hebrew",
118
+ hi: "Hindi",
119
+ hu: "Hungarian",
120
+ is: "Icelandic",
121
+ id: "Indonesian",
122
+ it: "Italian",
123
+ ja: "Japanese",
124
+ kn: "Kannada",
125
+ kk: "Kazakh",
126
+ ko: "Korean",
127
+ lv: "Latvian",
128
+ lt: "Lithuanian",
129
+ mk: "Macedonian",
130
+ ms: "Malay",
131
+ mr: "Marathi",
132
+ mi: "Maori",
133
+ ne: "Nepali",
134
+ no: "Norwegian",
135
+ fa: "Persian",
136
+ pl: "Polish",
137
+ pt: "Portuguese",
138
+ ro: "Romanian",
139
+ ru: "Russian",
140
+ sr: "Serbian",
141
+ sk: "Slovak",
142
+ sl: "Slovenian",
143
+ es: "Spanish",
144
+ sw: "Swahili",
145
+ sv: "Swedish",
146
+ tl: "Tagalog",
147
+ ta: "Tamil",
148
+ th: "Thai",
149
+ tr: "Turkish",
150
+ uk: "Ukrainian",
151
+ ur: "Urdu",
152
+ vi: "Vietnamese",
153
+ cy: "Welsh",
154
+ };
155
+
156
+ /** True when a language can carry word-level timings. */
157
+ export function canAlign(language: string): boolean {
158
+ return Object.hasOwn(ALIGNMENT_LOCALES, language);
159
+ }
160
+
161
+ /**
162
+ * The locale the alignment API expects, or null when the language cannot align.
163
+ *
164
+ * Returning null rather than defaulting matters: the previous implementation fell
165
+ * back to `en-US` for anything unrecognised, so a language outside the aligned set
166
+ * would have been aligned against an English acoustic model -- producing timings
167
+ * that are confidently wrong rather than an error.
168
+ */
169
+ export function toAlignmentLocale(language: string): string | null {
170
+ return ALIGNMENT_LOCALES[language] ?? null;
171
+ }
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { ALIGNMENT_LOCALES, canAlign, LANGUAGE_NAMES, SYNTHESIS_LANGUAGES } from "./languages.js";
2
3
 
3
4
  /**
4
5
  * Supported TTS voices (matches the platform's 9 OpenAI voices)
@@ -30,26 +31,14 @@ export const FormatSchema = z.enum(["mp3", "aac", "opus", "flac", "wav"]);
30
31
  export type Format = z.infer<typeof FormatSchema>;
31
32
 
32
33
  /**
33
- * Supported languages for synthesis + alignment
34
- * Uses short ISO 639-1 codes as expected by the VocaSync API
35
- * Only languages where both OpenAI TTS synthesis and MFA forced alignment are available
34
+ * Languages the synthesis voices can speak (ISO 639-1).
35
+ *
36
+ * Wider than the set that can be force-aligned. A post that needs word highlighting is
37
+ * additionally constrained by `ALIGNMENT_LOCALES`; one synthesised with `align: false`
38
+ * is not. `validateConfig` rejects the impossible combination rather than letting a
39
+ * sync pay for synthesis and then fail at the alignment step.
36
40
  */
37
- export const LanguageSchema = z.enum([
38
- "zh",
39
- "cs",
40
- "en",
41
- "fr",
42
- "de",
43
- "ja",
44
- "ko",
45
- "pl",
46
- "pt",
47
- "ru",
48
- "es",
49
- "sv",
50
- "tr",
51
- "uk",
52
- ]);
41
+ export const LanguageSchema = z.enum(SYNTHESIS_LANGUAGES);
53
42
  export type Language = z.infer<typeof LanguageSchema>;
54
43
 
55
44
  /**
@@ -129,6 +118,16 @@ export const VocaSyncConfigSchema = z.object({
129
118
  math: MathConfigSchema.prefault({}),
130
119
  /** Output paths */
131
120
  output: OutputConfigSchema.prefault({}),
121
+ /**
122
+ * Produce word-level timings, which is what powers highlighting and click-to-seek.
123
+ *
124
+ * Turn it off for narration alone: it costs less, and it lifts the language ceiling
125
+ * from the aligned set to every language the voices can speak. Overridable per post
126
+ * with `align: false` in frontmatter.
127
+ *
128
+ * @default true
129
+ */
130
+ align: z.boolean().default(true),
132
131
  /** Frontmatter field to check for audio opt-in/out (true/false) */
133
132
  frontmatterField: z.string().optional(),
134
133
  /** Processing options */
@@ -170,7 +169,30 @@ export type VocaSyncUserConfig = {
170
169
  * Validate and normalize user configuration
171
170
  */
172
171
  export function validateConfig(userConfig: VocaSyncUserConfig): VocaSyncConfig {
173
- return VocaSyncConfigSchema.parse(userConfig);
172
+ const config = VocaSyncConfigSchema.parse(userConfig);
173
+ assertLanguageSupportsAlignment(config.language, config.align);
174
+ return config;
175
+ }
176
+
177
+ /**
178
+ * Reject a language that cannot be aligned while alignment is requested.
179
+ *
180
+ * Caught here rather than at sync time because the failure would otherwise arrive
181
+ * after synthesis has already been paid for, as a rejection from the alignment
182
+ * endpoint that says nothing about how to proceed.
183
+ */
184
+ export function assertLanguageSupportsAlignment(language: string, align: boolean): void {
185
+ if (!align || canAlign(language)) return;
186
+ const name = LANGUAGE_NAMES[language] ?? language;
187
+ throw new Error(
188
+ `${name} ("${language}") can be synthesised but not force-aligned, so it cannot ` +
189
+ "carry the word timings that highlighting and click-to-seek need.\n\n" +
190
+ "Set `align: false` in vocasync.config.mjs to narrate it without highlighting, " +
191
+ "or `align: false` in a single post's frontmatter to make the exception there.\n\n" +
192
+ `Alignment is available for: ${Object.keys(ALIGNMENT_LOCALES)
193
+ .map((c) => `${LANGUAGE_NAMES[c] ?? c} (${c})`)
194
+ .join(", ")}.`
195
+ );
174
196
  }
175
197
 
176
198
  /**
@@ -178,6 +200,7 @@ export function validateConfig(userConfig: VocaSyncUserConfig): VocaSyncConfig {
178
200
  */
179
201
  export const defaultConfig: Omit<VocaSyncConfig, "collection"> = {
180
202
  language: "en",
203
+ align: true,
181
204
  synthesis: {
182
205
  voice: "onyx",
183
206
  quality: "sd",
@@ -79,7 +79,14 @@ const rehypeAudioWords: Plugin<[RehypeAudioWordsOptions?], Root> = (options = {}
79
79
  if (!audioMap) return;
80
80
 
81
81
  const slug = resolveSlug(file, collectionName);
82
- if (!slug || !audioMap.entries[slug]) return; // only wrap posts that have audio
82
+ if (!slug) return;
83
+ const entry = audioMap.entries[slug];
84
+ if (!entry) return; // only wrap posts that have audio
85
+
86
+ // A post synthesised without alignment has no word stream, so `data-i` would index
87
+ // into nothing. Wrapping anyway would bloat the HTML and leave spans that look
88
+ // interactive but can never highlight.
89
+ if (!Array.isArray(entry.words) || entry.words.length === 0) return;
83
90
 
84
91
  let nextIndex = 0;
85
92
  const replacements: Array<{
@@ -1,10 +1,12 @@
1
- import { toAlignmentLocale, type VocaSyncClient, withPublishableKey } from "../api/client.js";
1
+ import { type VocaSyncClient, withPublishableKey } from "../api/client.js";
2
2
  import { FormatSchema, LanguageSchema, type VocaSyncConfig, VoiceSchema } from "../config/index.js";
3
+ import { canAlign, LANGUAGE_NAMES, toAlignmentLocale } from "../config/languages.js";
3
4
  import { getAudioEntry, loadAudioMap, saveAudioMap, setAudioEntry } from "../core/audio-map.js";
4
5
  import { loadContent } from "../core/content-loader.js";
5
6
  import { computeHash } from "../core/hash-manager.js";
6
7
  import { buildSpeechDocument } from "../core/speech-builder.js";
7
8
  import type {
9
+ AlignedWord,
8
10
  AudioArtifact,
9
11
  AudioMap,
10
12
  ContentItem,
@@ -25,7 +27,7 @@ type Progress = NonNullable<SyncOptions["onProgress"]>;
25
27
  function resolveParams(
26
28
  item: ContentItem,
27
29
  config: VocaSyncConfig
28
- ): { voice: string; language: string; format: string } | { error: string } {
30
+ ): { voice: string; language: string; format: string; align: boolean } | { error: string } {
29
31
  const fm = item.frontmatter;
30
32
 
31
33
  let voice = config.synthesis.voice as string;
@@ -49,18 +51,50 @@ function resolveParams(
49
51
  format = parsed.data;
50
52
  }
51
53
 
52
- return { voice, language, format };
54
+ let align = config.align;
55
+ if (fm.align !== undefined && fm.align !== null) {
56
+ if (typeof fm.align !== "boolean") {
57
+ return { error: `frontmatter align must be true or false, got "${String(fm.align)}"` };
58
+ }
59
+ align = fm.align;
60
+ }
61
+
62
+ // A post can ask for a language its own alignment cannot support. Caught here so the
63
+ // run stops before paying for synthesis, naming the post rather than failing later
64
+ // with an opaque rejection from the alignment endpoint.
65
+ if (align && !canAlign(language)) {
66
+ const name = LANGUAGE_NAMES[language] ?? language;
67
+ return {
68
+ error:
69
+ `${name} ("${language}") cannot be force-aligned. ` +
70
+ "Add `align: false` to this post's frontmatter to narrate it without highlighting.",
71
+ };
72
+ }
73
+
74
+ return { voice, language, format, align };
53
75
  }
54
76
 
55
- /** True when an existing entry is a complete v3 artifact matching the hash. */
56
- function isUpToDate(entry: AudioArtifact | undefined, contentHash: string): boolean {
57
- return Boolean(
58
- entry &&
59
- entry.contentHash === contentHash &&
60
- entry.synthesisProjectUuid &&
61
- entry.alignmentProjectUuid &&
62
- Array.isArray(entry.words)
63
- );
77
+ /**
78
+ * True when an existing entry is complete for what was asked of it.
79
+ *
80
+ * `align` is part of the question, not just the answer. Judging completeness by the
81
+ * presence of alignment fields alone would mark every deliberately unaligned entry as
82
+ * incomplete and re-synthesise it on every run -- paying for the same audio forever.
83
+ * Entries written before v2.1.0 carry no `aligned` flag and were always aligned, so
84
+ * their alignment fields stand in for it.
85
+ */
86
+ function isUpToDate(
87
+ entry: AudioArtifact | undefined,
88
+ contentHash: string,
89
+ align: boolean
90
+ ): boolean {
91
+ if (!entry || entry.contentHash !== contentHash || !entry.synthesisProjectUuid) return false;
92
+
93
+ const wasAligned = entry.aligned ?? Boolean(entry.alignmentProjectUuid);
94
+ if (wasAligned !== align) return false;
95
+
96
+ // Only an aligned entry owes timings.
97
+ return align ? Boolean(entry.alignmentProjectUuid) && Array.isArray(entry.words) : true;
64
98
  }
65
99
 
66
100
  /** Orchestrate the full sync: load -> build -> two-POST synthesis+alignment -> persist. */
@@ -121,15 +155,16 @@ async function processItem(
121
155
  onProgress(`⚠ ${item.slug} - skipped: ${resolved.error}`, "warn");
122
156
  return { slug: item.slug, status: "error", error: resolved.error };
123
157
  }
124
- const { voice, language, format } = resolved;
158
+ const { voice, language, format, align } = resolved;
125
159
 
126
160
  const speechDoc = await buildSpeechDocument(item, { math: config.math });
161
+ // `align` participates in the hash: flipping it changes what the artifact is.
127
162
  const contentHash = computeHash(
128
- JSON.stringify([speechDoc.normalisedSpeechtext, voice, language, format])
163
+ JSON.stringify([speechDoc.normalisedSpeechtext, voice, language, format, align])
129
164
  );
130
165
 
131
166
  const existingEntry = getAudioEntry(audioMap, item.slug);
132
- if (!force && isUpToDate(existingEntry, contentHash)) {
167
+ if (!force && isUpToDate(existingEntry, contentHash, align)) {
133
168
  onProgress(`⏭ ${item.slug} - unchanged`, "info");
134
169
  return { slug: item.slug, status: "unchanged" };
135
170
  }
@@ -138,7 +173,8 @@ async function processItem(
138
173
 
139
174
  if (dryRun) {
140
175
  onProgress(
141
- `🔍 ${item.slug} - would ${status} (voice=${voice}, lang=${language}) [dry run]`,
176
+ `🔍 ${item.slug} - would ${status} (voice=${voice}, lang=${language}` +
177
+ `${align ? "" : ", no alignment"}) [dry run]`,
142
178
  "info"
143
179
  );
144
180
  return { slug: item.slug, status };
@@ -155,52 +191,73 @@ async function processItem(
155
191
  outputFormat: format,
156
192
  });
157
193
  const synthUuid = synthesis.projectUuid;
158
- await client.pollUntilComplete(synthUuid, {
194
+ const synthesisStatus = await client.pollUntilComplete(synthUuid, {
159
195
  onProgress: (s) => onProgress(` synthesis: ${s.status}`, "info"),
160
196
  });
161
197
  const synthesisPublishableKey = await client.createPublishableKey(synthUuid);
162
198
 
163
- // 2. Alignment (explicit, client-supplied transcript) ---------------------
164
- onProgress(`🔗 ${item.slug} - aligning...`, "info");
199
+ // 2. Alignment, unless this post asked to go without ---------------------
165
200
  const audioStreamUrl = client.streamUrl(synthUuid, "synthesis");
166
- const { bytes: audioBytes, contentType } = await client.downloadBytes(
167
- withPublishableKey(audioStreamUrl, synthesisPublishableKey)
168
- );
169
- const transcriptBytes = new TextEncoder().encode(speechDoc.normalisedSpeechtext);
170
- const alignmentLocale = toAlignmentLocale(language);
171
-
172
- const presign = await client.presignAlignment({
173
- audioName: `synthesis.${format}`,
174
- audioType: contentType,
175
- audioSize: audioBytes.byteLength,
176
- transcriptSize: transcriptBytes.byteLength,
177
- language: alignmentLocale,
178
- });
179
201
 
180
- await client.uploadToPresigned(presign.audio.uploadUrl, audioBytes, contentType);
181
- await client.uploadToPresigned(presign.transcript.uploadUrl, transcriptBytes, "text/plain");
182
-
183
- await client.submitAlignment({
184
- projectUuid: presign.projectUuid,
185
- audioFileKey: presign.audio.key,
186
- transcriptFileKey: presign.transcript.key,
187
- audioFileSizeBytes: audioBytes.byteLength,
188
- transcriptFileSizeBytes: transcriptBytes.byteLength,
189
- language: alignmentLocale,
190
- projectName: `astro-${item.slug}`,
191
- });
192
- const alignUuid = presign.projectUuid;
193
- await client.pollUntilComplete(alignUuid, {
194
- onProgress: (s) => onProgress(` alignment: ${s.status}`, "info"),
195
- });
196
- const alignmentPublishableKey = await client.createPublishableKey(alignUuid);
202
+ let alignUuid: string | undefined;
203
+ let alignmentPublishableKey: string | undefined;
204
+ let words: AlignedWord[] | undefined;
205
+ let effectiveDuration = 0;
197
206
 
198
- // 3. Fetch timings + persist ---------------------------------------------
199
- const { words, duration } = await client.fetchAlignmentWords(
200
- withPublishableKey(client.streamUrl(alignUuid, "alignment"), alignmentPublishableKey)
201
- );
202
- // The alignment stream may omit total duration; fall back to the last word's end.
203
- const effectiveDuration = duration || (words.length ? words[words.length - 1].end : 0);
207
+ if (align) {
208
+ onProgress(`🔗 ${item.slug} - aligning...`, "info");
209
+ const { bytes: audioBytes, contentType } = await client.downloadBytes(
210
+ withPublishableKey(audioStreamUrl, synthesisPublishableKey)
211
+ );
212
+ const transcriptBytes = new TextEncoder().encode(speechDoc.normalisedSpeechtext);
213
+ const alignmentLocale = toAlignmentLocale(language);
214
+ if (!alignmentLocale) {
215
+ // resolveParams rejects this earlier; reaching here means the two disagree.
216
+ return {
217
+ slug: item.slug,
218
+ status: "error",
219
+ error: `no alignment locale for language "${language}"`,
220
+ };
221
+ }
222
+
223
+ const presign = await client.presignAlignment({
224
+ audioName: `synthesis.${format}`,
225
+ audioType: contentType,
226
+ audioSize: audioBytes.byteLength,
227
+ transcriptSize: transcriptBytes.byteLength,
228
+ language: alignmentLocale,
229
+ });
230
+
231
+ await client.uploadToPresigned(presign.audio.uploadUrl, audioBytes, contentType);
232
+ await client.uploadToPresigned(presign.transcript.uploadUrl, transcriptBytes, "text/plain");
233
+
234
+ await client.submitAlignment({
235
+ projectUuid: presign.projectUuid,
236
+ audioFileKey: presign.audio.key,
237
+ transcriptFileKey: presign.transcript.key,
238
+ audioFileSizeBytes: audioBytes.byteLength,
239
+ transcriptFileSizeBytes: transcriptBytes.byteLength,
240
+ language: alignmentLocale,
241
+ projectName: `astro-${item.slug}`,
242
+ });
243
+ alignUuid = presign.projectUuid;
244
+ await client.pollUntilComplete(alignUuid, {
245
+ onProgress: (st) => onProgress(` alignment: ${st.status}`, "info"),
246
+ });
247
+ alignmentPublishableKey = await client.createPublishableKey(alignUuid);
248
+
249
+ // 3. Fetch timings ------------------------------------------------------
250
+ const aligned = await client.fetchAlignmentWords(
251
+ withPublishableKey(client.streamUrl(alignUuid, "alignment"), alignmentPublishableKey)
252
+ );
253
+ words = aligned.words;
254
+ // The alignment stream may omit total duration; fall back to the last word's end.
255
+ effectiveDuration = aligned.duration || (words.length ? words[words.length - 1].end : 0);
256
+ } else {
257
+ onProgress(`🔇 ${item.slug} - narration only (no word timings)`, "info");
258
+ // Without alignment the only duration available is what synthesis reported.
259
+ effectiveDuration = synthesisStatus.durationSeconds ?? 0;
260
+ }
204
261
 
205
262
  const now = new Date().toISOString();
206
263
  const artifact: AudioArtifact = {
@@ -211,6 +268,9 @@ async function processItem(
211
268
  synthesisProjectUuid: synthUuid,
212
269
  synthesisPublishableKey,
213
270
  audioUrl: audioStreamUrl,
271
+ // Recorded so a later sync can tell "deliberately unaligned" from "alignment
272
+ // never finished", instead of re-synthesising this post on every run.
273
+ aligned: align,
214
274
  alignmentProjectUuid: alignUuid,
215
275
  alignmentPublishableKey,
216
276
  words,
@@ -221,7 +281,11 @@ async function processItem(
221
281
  };
222
282
  setAudioEntry(audioMap, item.slug, artifact);
223
283
 
224
- onProgress(`✅ ${item.slug} - ${status} complete (${words.length} words)`, "success");
284
+ onProgress(
285
+ `✅ ${item.slug} - ${status} complete` +
286
+ (words ? ` (${words.length} words)` : " (narration only)"),
287
+ "success"
288
+ );
225
289
  return { slug: item.slug, status, projectUuid: synthUuid };
226
290
  } catch (error) {
227
291
  const message = error instanceof Error ? error.message : String(error);
@@ -69,11 +69,25 @@ export interface AudioArtifact {
69
69
  synthesisPublishableKey: string;
70
70
  /** Stable audio stream URL (without the publishable key) */
71
71
  audioUrl: string;
72
- /** Alignment project (source of the embedded timings) */
73
- alignmentProjectUuid: string;
74
- alignmentPublishableKey: string;
75
- /** Word timings, indexed positionally by the rehype plugin's data-i */
76
- words: AlignedWord[];
72
+ /**
73
+ * Whether this artifact was force-aligned.
74
+ *
75
+ * Recorded explicitly because absence cannot express intent: without it, an entry
76
+ * synthesised deliberately without alignment is indistinguishable from one whose
77
+ * alignment failed halfway, and `isUpToDate` would re-synthesise it on every sync --
78
+ * paying for the audio again, silently, forever.
79
+ *
80
+ * Absent on artifacts written before v2.1.0, which were always aligned.
81
+ */
82
+ aligned?: boolean;
83
+ /** Alignment project (source of the embedded timings). Absent when not aligned. */
84
+ alignmentProjectUuid?: string;
85
+ alignmentPublishableKey?: string;
86
+ /**
87
+ * Word timings, indexed positionally by the rehype plugin's data-i.
88
+ * Absent when the artifact was synthesised without alignment.
89
+ */
90
+ words?: AlignedWord[];
77
91
  /** Total audio duration in seconds */
78
92
  duration: number;
79
93
  /** Spoken form of each math expression, keyed by `${'d'|'i'}:${latex}`. */