Added Pitch settings to RVC

This commit is contained in:
erew123 authored and GitHub committed 2024-09-22 12:50:13 +01:00
1 parent 16a78a90ef
commit d66e461f8a
1 file changed
+61 -16
@@ -20,7 +20,9 @@ class AllTalkTtsProvider {
at_narrator_text_not_inside: this.settings.at_narrator_text_not_inside || 'narrator', 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', narrator_voice_gen: this.settings.narrator_voice_gen || 'Please set a voice',
rvc_character_voice: this.settings.rvc_character_voice || 'Disabled', 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_voice: this.settings.rvc_narrator_voice || 'Disabled',
rvc_narrator_pitch: this.settings.rvc_narrator_pitch || '0',
finetuned_model: this.settings.finetuned_model || 'false' finetuned_model: this.settings.finetuned_model || 'false'
}; };
// Separate property for dynamically updated settings from the server // Separate property for dynamically updated settings from the server
@@ -60,7 +62,7 @@ class AllTalkTtsProvider {
}; };
get settingsHtml() { get settingsHtml() {
let html = `<div class="at-settings-separator">AllTalk Settings</div>`; let html = `<div class="at-settings-separator">AllTalk V2 Settings</div>`;
html += `<div class="at-settings-row"> html += `<div class="at-settings-row">
@@ -116,29 +118,50 @@ class AllTalkTtsProvider {
</div> </div>
</div>`; </div>`;
html += `<div class="at-settings-row"> html += `<div class="at-settings-row">
<div class="at-settings-option"> <div class="at-settings-option">
<label for="rvc_character_voice">RVC Character</label> <label for="rvc_character_voice">RVC Character</label>
<select id="rvc_character_voice">`; <select id="rvc_character_voice">`;
if (this.rvcVoices) { if (this.rvcVoices) {
for (let rvccharvoice of this.rvcVoices) { for (let rvccharvoice of this.rvcVoices) {
html += `<option value="${rvccharvoice.voice_id}">${rvccharvoice.name}</option>`; html += `<option value="${rvccharvoice.voice_id}">${rvccharvoice.name}</option>`;
} }
} }
html += `</select> html += `</select>
</div> </div>
<div class="at-settings-option"> <div class="at-settings-option">
<label for="rvc_narrator_voice">RVC Narrator</label> <label for="rvc_narrator_voice">RVC Narrator</label>
<select id="rvc_narrator_voice">`; <select id="rvc_narrator_voice">`;
if (this.rvcVoices) { if (this.rvcVoices) {
for (let rvcnarrvoice of this.rvcVoices) { for (let rvcnarrvoice of this.rvcVoices) {
html += `<option value="${rvcnarrvoice.voice_id}">${rvcnarrvoice.name}</option>`; html += `<option value="${rvcnarrvoice.voice_id}">${rvcnarrvoice.name}</option>`;
} }
} }
html += `</select> html += `</select>
</div> </div>
</div>`; </div>`;
// Add the RVC pitch control row
html += `<div class="at-settings-row">
<div class="at-settings-option">
<label for="rvc_character_pitch">RVC Character Pitch</label>
<select id="rvc_character_pitch">`;
for (let i = -24; i <= 24; i++) {
const selected = i === 0 ? 'selected="selected"' : '';
html += `<option value="${i}" ${selected}>${i}</option>`;
}
html += `</select>
</div>
<div class="at-settings-option">
<label for="rvc_narrator_pitch">RVC Narrator Pitch</label>
<select id="rvc_narrator_pitch">`;
for (let i = -24; i <= 24; i++) {
const selected = i === 0 ? 'selected="selected"' : '';
html += `<option value="${i}" ${selected}>${i}</option>`;
}
html += `</select>
</div>
</div>`;
html += `<div class="at-model-endpoint-row"> html += `<div class="at-model-endpoint-row">
<div class="at-model-option"> <div class="at-model-option">
@@ -149,7 +172,7 @@ html += `</select>
</div> </div>
<div class="at-endpoint-option"> <div class="at-endpoint-option">
<label for="at_server">AllTalk Endpoint (Press Enter to save):</label> <label for="at_server">AllTalk Endpoint:</label>
<input id="at_server" type="text" class="text_pole" maxlength="80" value="${this.settings.provider_endpoint}"/> <input id="at_server" type="text" class="text_pole" maxlength="80" value="${this.settings.provider_endpoint}"/>
</div> </div>
</div>`; </div>`;
@@ -175,7 +198,7 @@ html += `</select>
html += `<div class="at-website-row"> html += `<div class="at-website-row">
<div class="at-website-option"> <div class="at-website-option">
<span>AllTalk <a target="_blank" href="${this.settings.provider_endpoint}">Config & Docs</a>.</span> <span>AllTalk V2<a target="_blank" href="${this.settings.provider_endpoint}">Config & Docs</a>.</span>
</div> </div>
<div class="at-website-option"> <div class="at-website-option">
@@ -224,6 +247,8 @@ html += `</select>
$('#narrator_voice').val(this.settings.narrator_voice_gen); $('#narrator_voice').val(this.settings.narrator_voice_gen);
$('#rvc_character_voice').val(this.settings.rvc_character_voice); $('#rvc_character_voice').val(this.settings.rvc_character_voice);
$('#rvc_narrator_voice').val(this.settings.rvc_narrator_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'); console.debug('AllTalkTTS: Settings loaded');
try { try {
@@ -590,6 +615,22 @@ html += `</select>
}); });
} }
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) => { const debouncedModelSelectChange = (event) => {
clearTimeout(debounceTimeout); clearTimeout(debounceTimeout);
debounceTimeout = setTimeout(() => { debounceTimeout = setTimeout(() => {
@@ -790,6 +831,8 @@ html += `</select>
this.settings.at_narrator_text_not_inside = $('#at_narrator_text_not_inside').val(); 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_character_voice = $('#rvc_character_voice').val();
this.settings.rvc_narrator_voice = $('#rvc_narrator_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(); this.settings.narrator_voice_gen = $('#narrator_voice').val();
// Save the updated settings // Save the updated settings
saveTtsProviderSettings(); saveTtsProviderSettings();
@@ -913,9 +956,11 @@ html += `</select>
'text_filtering': "standard", 'text_filtering': "standard",
'character_voice_gen': voiceId, 'character_voice_gen': voiceId,
'rvccharacter_voice_gen': this.settings.rvccharacter_voice_gen || "Disabled", 'rvccharacter_voice_gen': this.settings.rvccharacter_voice_gen || "Disabled",
'rvccharacter_pitch': this.settings.rvc_character_pitch || "0",
'narrator_enabled': this.settings.narrator_enabled, 'narrator_enabled': this.settings.narrator_enabled,
'narrator_voice_gen': this.settings.narrator_voice_gen, 'narrator_voice_gen': this.settings.narrator_voice_gen,
'rvcnarrator_voice_gen': this.settings.rvcnarrator_voice_gen || "Disabled", '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, 'text_not_inside': this.settings.at_narrator_text_not_inside,
'language': this.settings.language, 'language': this.settings.language,
'output_file_name': "st_output", 'output_file_name': "st_output",