diff --git a/system/SillyTavern Extension/For AllTalk V2/alltalk.js b/system/SillyTavern Extension/For AllTalk V2/alltalk.js index a31f257..51694f6 100644 --- a/system/SillyTavern Extension/For AllTalk V2/alltalk.js +++ b/system/SillyTavern Extension/For AllTalk V2/alltalk.js @@ -20,7 +20,9 @@ class AllTalkTtsProvider { at_narrator_text_not_inside: this.settings.at_narrator_text_not_inside || 'narrator', narrator_voice_gen: this.settings.narrator_voice_gen || 'Please set a voice', rvc_character_voice: this.settings.rvc_character_voice || 'Disabled', + rvc_character_pitch: this.settings.rvc_character_pitch || '0', rvc_narrator_voice: this.settings.rvc_narrator_voice || 'Disabled', + rvc_narrator_pitch: this.settings.rvc_narrator_pitch || '0', finetuned_model: this.settings.finetuned_model || 'false' }; // Separate property for dynamically updated settings from the server @@ -60,7 +62,7 @@ class AllTalkTtsProvider { }; get settingsHtml() { - let html = `
AllTalk Settings
`; + let html = `
AllTalk V2 Settings
`; html += `
@@ -116,29 +118,50 @@ class AllTalkTtsProvider {
`; - html += `
+ html += `
+ if (this.rvcVoices) { + for (let rvccharvoice of this.rvcVoices) { + html += ``; + } + } + html += `
+ if (this.rvcVoices) { + for (let rvcnarrvoice of this.rvcVoices) { + html += ``; + } + } + html += `
`; + // Add the RVC pitch control row + html += `
+
+ + +
+
+ + +
+
`; html += `
@@ -149,7 +172,7 @@ html += `
- +
`; @@ -175,7 +198,7 @@ html += ` html += `
- AllTalk Config & Docs. + AllTalk V2Config & Docs.
@@ -201,7 +224,7 @@ html += ` async loadSettings(settings) { updateStatus('Offline'); - + if (Object.keys(settings).length === 0) { console.info('Using default AllTalk TTS Provider settings'); } else { @@ -214,7 +237,7 @@ html += ` } } } - + // Update UI elements to reflect the loaded settings $('#at_server').val(this.settings.provider_endpoint); $('#language_options').val(this.settings.language); @@ -224,7 +247,9 @@ html += ` $('#narrator_voice').val(this.settings.narrator_voice_gen); $('#rvc_character_voice').val(this.settings.rvc_character_voice); $('#rvc_narrator_voice').val(this.settings.rvc_narrator_voice); - + $('#rvc_character_pitch').val(this.settings.rvc_character_pitch); + $('#rvc_narrator_pitch').val(this.settings.rvc_narrator_pitch); + console.debug('AllTalkTTS: Settings loaded'); try { // Check if TTS provider is ready @@ -242,7 +267,7 @@ html += ` updateStatus('Offline'); } } - + applySettingsToHTML() { const narratorVoiceSelect = document.getElementById('narrator_voice'); @@ -381,9 +406,9 @@ html += ` throw error; } } - - - + + + //##########################################// // Get Current AT Server Config & Update ST // //##########################################// @@ -396,7 +421,7 @@ html += ` } const currentSettings = await response.json(); currentSettings.models_available.sort((a, b) => a.name.localeCompare(b.name)); - + this.settings.enginesAvailable = currentSettings.engines_available; this.settings.currentEngineLoaded = currentSettings.current_engine_loaded; this.settings.modelsAvailable = currentSettings.models_available; @@ -406,9 +431,9 @@ html += ` this.settings.deepspeed_enabled = currentSettings.deepspeed_enabled; this.settings.lowvram_capable = currentSettings.lowvram_capable; this.settings.lowvram_enabled = currentSettings.lowvram_enabled; - + await this.fetchRvcVoiceObjects(); // Fetch RVC voices - + this.updateModelDropdown(); this.updateCheckboxes(); this.updateRvcVoiceDropdowns(); // Update the RVC voice dropdowns @@ -416,7 +441,7 @@ html += ` console.error(`Error updating settings from server: ${error}`); } } - + updateRvcVoiceDropdowns() { const rvcCharacterVoiceSelect = document.getElementById('rvc_character_voice'); const rvcNarratorVoiceSelect = document.getElementById('rvc_narrator_voice'); @@ -581,7 +606,7 @@ html += ` this.onSettingsChange(); // Save the settings after change }); } - + const rvcNarratorVoiceSelect = document.getElementById('rvc_narrator_voice'); if (rvcNarratorVoiceSelect) { rvcNarratorVoiceSelect.addEventListener('change', (event) => { @@ -590,6 +615,22 @@ html += ` }); } + const rvcCharacterPitchSelect = document.getElementById('rvc_character_pitch'); + if (rvcCharacterPitchSelect) { + rvcCharacterPitchSelect.addEventListener('change', (event) => { + this.settings.rvc_character_pitch = event.target.value; + this.onSettingsChange(); // Save the settings after change + }); + } + + const rvcNarratorPitchSelect = document.getElementById('rvc_narrator_pitch'); + if (rvcNarratorPitchSelect) { + rvcNarratorPitchSelect.addEventListener('change', (event) => { + this.settings.rvc_narrator_pitch = event.target.value; + this.onSettingsChange(); // Save the settings after change + }); + } + const debouncedModelSelectChange = (event) => { clearTimeout(debounceTimeout); debounceTimeout = setTimeout(() => { @@ -694,21 +735,21 @@ html += ` const ttsPassAsterisksCheckbox = document.getElementById('tts_pass_asterisks'); const ttsNarrateQuotedCheckbox = document.getElementById('tts_narrate_quoted'); const ttsNarrateDialoguesCheckbox = document.getElementById('tts_narrate_dialogues'); - + if (atNarratorSelect && textNotInsideSelect && narratorVoiceSelect) { atNarratorSelect.addEventListener('change', (event) => { const narratorOption = event.target.value; this.settings.narrator_enabled = narratorOption; - + // Check if narrator is disabled const isNarratorDisabled = narratorOption === 'false'; textNotInsideSelect.disabled = isNarratorDisabled; narratorVoiceSelect.disabled = isNarratorDisabled; - + console.log(`Narrator option: ${narratorOption}`); console.log(`textNotInsideSelect disabled: ${textNotInsideSelect.disabled}`); console.log(`narratorVoiceSelect disabled: ${narratorVoiceSelect.disabled}`); - + if (narratorOption === 'true') { ttsPassAsterisksCheckbox.checked = false; $('#tts_pass_asterisks').click(); @@ -728,11 +769,11 @@ html += ` $('#tts_pass_asterisks').click(); $('#tts_pass_asterisks').trigger('change'); } - + this.onSettingsChange(); }); } - + // Event Listener for AT Generation Method Dropdown const atGenerationMethodSelect = document.getElementById('at_generation_method'); @@ -790,6 +831,8 @@ html += ` this.settings.at_narrator_text_not_inside = $('#at_narrator_text_not_inside').val(); this.settings.rvc_character_voice = $('#rvc_character_voice').val(); this.settings.rvc_narrator_voice = $('#rvc_narrator_voice').val(); + this.settings.rvc_character_pitch = $('#rvc_character_pitch').val(); + this.settings.rvc_narrator_pitch = $('#rvc_narrator_pitch').val(); this.settings.narrator_voice_gen = $('#narrator_voice').val(); // Save the updated settings saveTtsProviderSettings(); @@ -913,9 +956,11 @@ html += ` 'text_filtering': "standard", 'character_voice_gen': voiceId, 'rvccharacter_voice_gen': this.settings.rvccharacter_voice_gen || "Disabled", + 'rvccharacter_pitch': this.settings.rvc_character_pitch || "0", 'narrator_enabled': this.settings.narrator_enabled, 'narrator_voice_gen': this.settings.narrator_voice_gen, 'rvcnarrator_voice_gen': this.settings.rvcnarrator_voice_gen || "Disabled", + 'rvcnarrator_pitch': this.settings.rvc_narrator_pitch || "0", 'text_not_inside': this.settings.at_narrator_text_not_inside, 'language': this.settings.language, 'output_file_name': "st_output",