35 lines
1.4 KiB
JavaScript
35 lines
1.4 KiB
JavaScript
/*
|
|||
|
|
* sidecar-langs.js — the ONE table of what the mlx-audio sidecar calls a language.
|
||
|
|
*
|
||
|
|
* Two models, two conventions: Kokoro wants a single letter ('e', 'p'), Qwen3
|
||
|
|
* wants a full word ('spanish'). Both tts-service.js (which speaks) and main.js
|
||
|
|
* (which now WARMS the exact voices in use at launch) need the same answer, and
|
||
|
|
* a copy in each drifted once already — which is how the warmup came to load a
|
||
|
|
* 1.7 GB model nobody had chosen while the 82 MB one every pinned language
|
||
|
|
* actually used sat cold until the first sentence of the service.
|
||
|
|
*/
|
||
|
|
(function (root, factory) {
|
||
|
|
if (typeof module === 'object' && module.exports) module.exports = factory();
|
||
|
|
else root.SidecarLangs = factory();
|
||
|
|
}(typeof self !== 'undefined' ? self : this, function () {
|
||
|
|
'use strict';
|
||
|
|
|
||
|
|
const KOKORO_MODEL = 'prince-canuma/Kokoro-82M';
|
||
|
|
const QWEN_MODEL = 'mlx-community/Qwen3-TTS-12Hz-1.7B-CustomVoice-8bit';
|
||
|
|
|
||
|
|
const KOKORO_LANG = {
|
||
|
|
eng_Latn: 'a', spa_Latn: 'e', spa_ES: 'e', spa_MX: 'e',
|
||
|
|
por_Latn: 'p', por_PT: 'p', fra_Latn: 'f', ita_Latn: 'i',
|
||
|
|
hin_Deva: 'h', jpn_Jpan: 'j', zho_Hans: 'z'
|
||
|
|
};
|
||
|
|
|
||
|
|
const LOCAL_LANG = {
|
||
|
|
spa_Latn: 'spanish', por_Latn: 'portuguese', zho_Hans: 'chinese',
|
||
|
|
kor_Hang: 'korean', fra_Latn: 'french', eng_Latn: 'english',
|
||
|
|
deu_Latn: 'german', ita_Latn: 'italian', rus_Cyrl: 'russian',
|
||
|
|
por_PT: 'portuguese', spa_ES: 'spanish', spa_MX: 'spanish'
|
||
|
|
};
|
||
|
|
|
||
|
|
return { KOKORO_MODEL, QWEN_MODEL, KOKORO_LANG, LOCAL_LANG };
|
||
|
|
}));
|