Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/islands/media/TextToSpeech.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button } from '@/components/ui/Button';
import { Alert } from '@/components/ui/Alert';
import { splitIntoChunks } from '@/tools/media/tts.lib';
import { floatToWav } from '@/tools/media/tts-audio.lib';
import { NEURAL_VOICES } from '@/tools/media/neural-tts.engine';
import { NEURAL_VOICES } from '@/tools/media/neural-tts.voices';
import { downloadService } from '@/services/download';
import type { Lang } from '@/i18n/config';

Expand Down
21 changes: 6 additions & 15 deletions src/tools/media/neural-tts.engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,13 @@
* through the same-origin /hf proxy, matching the Whisper setup.
*/
import { concatWithSilence, floatToPcm16, splitForPause } from './tts-audio.lib';
import type { NeuralVoice } from './neural-tts.voices';

export interface NeuralVoice { id: string; label: string; model: string; }

// MMS-TTS is multilingual with one small model per language and needs no speaker
// embedding. A curated set that has ONNX ports on the Hugging Face hub.
export const NEURAL_VOICES: NeuralVoice[] = [
{ id: 'eng', label: 'English', model: 'Xenova/mms-tts-eng' },
{ id: 'ind', label: 'Bahasa Indonesia', model: 'Xenova/mms-tts-ind' },
{ id: 'spa', label: 'Español', model: 'Xenova/mms-tts-spa' },
{ id: 'fra', label: 'Français', model: 'Xenova/mms-tts-fra' },
{ id: 'deu', label: 'Deutsch', model: 'Xenova/mms-tts-deu' },
{ id: 'por', label: 'Português', model: 'Xenova/mms-tts-por' },
{ id: 'rus', label: 'Русский', model: 'Xenova/mms-tts-rus' },
{ id: 'ara', label: 'العربية', model: 'Xenova/mms-tts-ara' },
{ id: 'hin', label: 'हिन्दी', model: 'Xenova/mms-tts-hin' },
];
// Re-exported for compatibility; the catalogue lives in a lightweight module so
// the TextToSpeech island can import the voice list without pulling this heavy
// engine into its chunk (see neural-tts.voices.ts).
export { NEURAL_VOICES } from './neural-tts.voices';
export type { NeuralVoice } from './neural-tts.voices';

/* eslint-disable @typescript-eslint/no-explicit-any */
let cached: { model: string; synth: any } | null = null;
Expand Down
25 changes: 25 additions & 0 deletions src/tools/media/neural-tts.voices.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Voice catalogue for neural TTS, split out from `neural-tts.engine.ts` so the
* TextToSpeech island can list voices without statically importing the engine
* (which is heavy and must stay dynamically imported / code-split — a static +
* dynamic import of the engine made Rollup keep it in the island chunk).
*/
export interface NeuralVoice {
id: string;
label: string;
model: string;
}

// MMS-TTS is multilingual with one small model per language and needs no speaker
// embedding. A curated set that has ONNX ports on the Hugging Face hub.
export const NEURAL_VOICES: NeuralVoice[] = [
{ id: 'eng', label: 'English', model: 'Xenova/mms-tts-eng' },
{ id: 'ind', label: 'Bahasa Indonesia', model: 'Xenova/mms-tts-ind' },
{ id: 'spa', label: 'Español', model: 'Xenova/mms-tts-spa' },
{ id: 'fra', label: 'Français', model: 'Xenova/mms-tts-fra' },
{ id: 'deu', label: 'Deutsch', model: 'Xenova/mms-tts-deu' },
{ id: 'por', label: 'Português', model: 'Xenova/mms-tts-por' },
{ id: 'rus', label: 'Русский', model: 'Xenova/mms-tts-rus' },
{ id: 'ara', label: 'العربية', model: 'Xenova/mms-tts-ara' },
{ id: 'hin', label: 'हिन्दी', model: 'Xenova/mms-tts-hin' },
];
Loading