refactor: scope voice clone

This commit is contained in:
mARTin-B78 2026-09-04 12:55:50 +02:00
parent 998a65f2ba
commit d219aec676
5 changed files with 39 additions and 9 deletions

View File

@ -8,6 +8,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi
## [Unreleased] ## [Unreleased]
### Changed ### Changed
- **Voice-clone namespace migration.** Clone audio loading/upload, microphone monitoring, design presets, and voice-design
actions now use a private scope with explicit compatibility exports and a `window.TTVC.voiceClone` API.
- **TTS preview namespace migration.** Backend voice selection, Fish emotion tags, preview synthesis, stream fallback, - **TTS preview namespace migration.** Backend voice selection, Fish emotion tags, preview synthesis, stream fallback,
and performance-history helpers now use a private scope with explicit compatibility exports and a `window.TTVC.tts` API. and performance-history helpers now use a private scope with explicit compatibility exports and a `window.TTVC.tts` API.
- **Settings namespace migration.** Settings state, backend catalogs, help rendering, and provider configuration now use - **Settings namespace migration.** Settings state, backend catalogs, help rendering, and provider configuration now use

View File

@ -1 +1 @@
1.24.75 1.24.76

View File

@ -65,6 +65,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed)
- ✅ Character library persistence and rendering use a private scope with explicit identity/image compatibility exports. - ✅ Character library persistence and rendering use a private scope with explicit identity/image compatibility exports.
- ✅ Settings state and backend configuration use a private scope with live compatibility accessors and a namespace API. - ✅ Settings state and backend configuration use a private scope with live compatibility accessors and a namespace API.
- ✅ TTS preview and performance-history helpers use a private scope with explicit preview/history compatibility exports. - ✅ TTS preview and performance-history helpers use a private scope with explicit preview/history compatibility exports.
- ✅ Voice-clone audio, recording, and design controls use a private scope with explicit compatibility exports.
- ✅ `static/css/resource-diagnostics.css` — isolated Performance/resource diagnostic panel styles. - ✅ `static/css/resource-diagnostics.css` — isolated Performance/resource diagnostic panel styles.
- ✅ `static/css/background-jobs.css` — isolated background-job history and retry-panel styles. - ✅ `static/css/background-jobs.css` — isolated background-job history and retry-panel styles.
- ✅ `static/css/voice-design.css` — isolated Voice Design form, samples, and preview-match styles. - ✅ `static/css/voice-design.css` — isolated Voice Design form, samples, and preview-match styles.

View File

@ -10,7 +10,7 @@
<meta name="format-detection" content="telephone=no"> <meta name="format-detection" content="telephone=no">
<meta name="color-scheme" content="light dark"> <meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#2563EB"> <meta name="theme-color" content="#2563EB">
<meta name="app-version" content="1.24.75"> <meta name="app-version" content="1.24.76">
<link rel="manifest" href="/manifest.webmanifest"> <link rel="manifest" href="/manifest.webmanifest">
<link rel="icon" href="/static/icon.svg" type="image/svg+xml"> <link rel="icon" href="/static/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/icon.svg"> <link rel="apple-touch-icon" href="/static/icon.svg">
@ -27,12 +27,12 @@
<!-- ── Core styles (local — no CDN dependency for first paint) ────────── --> <!-- ── Core styles (local — no CDN dependency for first paint) ────────── -->
<link rel="stylesheet" href="/static/vendor/mdi/materialdesignicons.min.css"> <link rel="stylesheet" href="/static/vendor/mdi/materialdesignicons.min.css">
<link rel="stylesheet" href="/static/style.css?v=1.24.75"> <link rel="stylesheet" href="/static/style.css?v=1.24.76">
<link rel="stylesheet" href="/static/css/resource-diagnostics.css?v=1.24.75"> <link rel="stylesheet" href="/static/css/resource-diagnostics.css?v=1.24.76">
<link rel="stylesheet" href="/static/css/background-jobs.css?v=1.24.75"> <link rel="stylesheet" href="/static/css/background-jobs.css?v=1.24.76">
<link rel="stylesheet" href="/static/css/voice-design.css?v=1.24.75"> <link rel="stylesheet" href="/static/css/voice-design.css?v=1.24.76">
<link rel="stylesheet" href="/static/css/rehearser.css?v=1.24.75"> <link rel="stylesheet" href="/static/css/rehearser.css?v=1.24.76">
<link rel="stylesheet" href="/static/css/audiobook.css?v=1.24.75"> <link rel="stylesheet" href="/static/css/audiobook.css?v=1.24.76">
<!-- ── Flag icons — non-blocking (loaded async, icons appear after JS) ── --> <!-- ── Flag icons — non-blocking (loaded async, icons appear after JS) ── -->
@ -397,7 +397,7 @@ window.toggleNavTree = function(treeId, chevronId) {
</script> </script>
<!-- loader.js: fetches sections → loads JS modules → removes skeleton --> <!-- loader.js: fetches sections → loads JS modules → removes skeleton -->
<script src="/static/loader.js?v=1.24.75"></script> <script src="/static/loader.js?v=1.24.76"></script>
</body> </body>
</html> </html>

View File

@ -1,5 +1,7 @@
// ── Clone: recommended sample sentences ────────────────────────────────── // ── Clone: recommended sample sentences ──────────────────────────────────
(function (root) {
const CLONE_SAMPLE_TEXTS = { const CLONE_SAMPLE_TEXTS = {
EN: 'Hello! My name is Sam, and this is my voice. I can speak softly or with great strength. The crisp winter air, warm firelight, and the gentle sound of rain — these are the things I love. Can you hear how clearly I speak?', EN: 'Hello! My name is Sam, and this is my voice. I can speak softly or with great strength. The crisp winter air, warm firelight, and the gentle sound of rain — these are the things I love. Can you hear how clearly I speak?',
DE: 'Hallo! Ich heiße Alex und das ist meine Stimme. Ich kann leise flüstern oder mit voller Kraft sprechen. Klare Winterluft, warmes Kerzenlicht und der Klang des Regens am Fenster — das liebe ich. Hörst du, wie deutlich ich spreche?', DE: 'Hallo! Ich heiße Alex und das ist meine Stimme. Ich kann leise flüstern oder mit voller Kraft sprechen. Klare Winterluft, warmes Kerzenlicht und der Klang des Regens am Fenster — das liebe ich. Hörst du, wie deutlich ich spreche?',
@ -1045,3 +1047,28 @@ $('transcribe-btn').addEventListener('click', async () => {
tabs.forEach(t => t.addEventListener('click', () => show(t.dataset.src))); tabs.forEach(t => t.addEventListener('click', () => show(t.dataset.src)));
show(localStorage.getItem(KEY) || 'mic'); show(localStorage.getItem(KEY) || 'mic');
})(); })();
// Preserve existing clone handlers while keeping recording, upload, and voice
// design implementation details inside a single module scope.
Object.assign(root, {
CLONE_SAMPLE_TEXTS, CLONE_SAMPLE_NAMES, cloneSampleForLang,
ws, wsRegions, currentFileId, trimmedFileId, designedFileId, editingVoiceId, editingVoicePath,
initWaveSurfer, updateRegion, updateDurationLabel, loadAudioId, dropZone, fileInput,
uploadFile, loadLibraryVoiceAudio, RAW_MIC_CONSTRAINTS, visibleMicrophoneCount,
microphoneErrorMessage, requestMicrophoneStream, _cloneMonState, _cloneRenderMeter,
_cloneStartMeter, _cloneStartMonitor, _cloneStopMonitor, mediaRec, recChunks, recTimer, recSecs,
DESIGN_LANG_CODE, DESIGN_GENDER_WORD, DESIGN_PRESET_KEY, DESIGN_PRESET_SEEDED_KEY,
DEFAULT_DESIGN_PRESETS, QWEN_DESIGN_SAMPLES, currentDesignSource, loadDesignPresets,
saveDesignPresets, syncDesignPresetsToServer, seedDesignPresets, refreshDesignPresetSelect,
applyDesignPreset, renderDesignPresetLibrary, renderQwenSampleCards, applyQwenSample,
isDialogueDesign, voiceDesignPayload, _dVoiceIdManual, designSafeName, voiceIdSafePart,
suggestedStyleVoiceId, _updateDVoiceId, runVoiceDesign,
});
root.TTVC = root.TTVC || {};
root.TTVC.voiceClone = root.TTVC.voiceClone || {};
Object.assign(root.TTVC.voiceClone, {
samples: { forLanguage: cloneSampleForLang },
audio: { init: initWaveSurfer, load: loadAudioId, upload: uploadFile },
design: { run: runVoiceDesign, buildPayload: voiceDesignPayload },
});
})(window);