mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Work on tts
This commit is contained in:
parent
1ed5217fda
commit
68b7d3fd14
@ -99,7 +99,7 @@ namespace Nikse.SubtitleEdit.Core.TextToSpeech
|
||||
new PiperModels("huayan", "Chinese", "medium", "https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/zh/zh_CN/huayan/medium/zh_CN-huayan-medium.onnx", "https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/zh/zh_CN/huayan/medium/zh_CN-huayan-medium.onnx.json"),
|
||||
};
|
||||
|
||||
return models;
|
||||
return models.OrderBy(p=>p.ToString()).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -773,23 +773,70 @@ namespace Nikse.SubtitleEdit.Forms.Tts
|
||||
FillActorListView();
|
||||
|
||||
contextMenuStripActors.Items.Clear();
|
||||
for (var index = 0; index < nikseComboBoxVoice.Items.Count; index++)
|
||||
|
||||
if (engine.Id == TextToSpeechEngine.IdPiper)
|
||||
{
|
||||
var item = nikseComboBoxVoice.Items[index];
|
||||
|
||||
var tsi = new ToolStripMenuItem();
|
||||
tsi.Tag = new ActorAndVoice { Voice = item.ToString(), VoiceIndex = index };
|
||||
tsi.Text = item.ToString();
|
||||
tsi.Click += (x, args) =>
|
||||
var voices = PiperModels.GetVoices();
|
||||
foreach (var voiceLanguage in voices
|
||||
.GroupBy(p => p.Language)
|
||||
.OrderBy(p => p.Key))
|
||||
{
|
||||
var a = (ActorAndVoice)(x as ToolStripItem).Tag;
|
||||
SetActor(a);
|
||||
};
|
||||
contextMenuStripActors.Items.Add(tsi);
|
||||
if (voiceLanguage.Count() == 1)
|
||||
{
|
||||
var voice = voiceLanguage.First();
|
||||
var tsi = new ToolStripMenuItem();
|
||||
tsi.Tag = new ActorAndVoice { Voice = voice.Voice, VoiceIndex = voices.IndexOf(voice) };
|
||||
tsi.Text = voice.ToString();
|
||||
tsi.Click += (x, args) =>
|
||||
{
|
||||
var a = (ActorAndVoice)(x as ToolStripItem).Tag;
|
||||
SetActor(a);
|
||||
};
|
||||
contextMenuStripActors.Items.Add(tsi);
|
||||
}
|
||||
else
|
||||
{
|
||||
var parent = new ToolStripMenuItem();
|
||||
parent.Text = voiceLanguage.Key;
|
||||
contextMenuStripActors.Items.Add(parent);
|
||||
|
||||
labelActors.Visible = true;
|
||||
listViewActors.Visible = true;
|
||||
foreach (var voice in voiceLanguage.OrderBy(p => p.Voice).ToList())
|
||||
{
|
||||
var tsi = new ToolStripMenuItem();
|
||||
tsi.Tag = new ActorAndVoice { Voice = voice.Voice, VoiceIndex = voices.IndexOf(voice) };
|
||||
tsi.Text = voice.Voice + " (" + voice.Quality + ")";
|
||||
tsi.Click += (x, args) =>
|
||||
{
|
||||
var a = (ActorAndVoice)(x as ToolStripItem).Tag;
|
||||
SetActor(a);
|
||||
};
|
||||
parent.DropDownItems.Add(tsi);
|
||||
}
|
||||
|
||||
DarkTheme.SetDarkTheme(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var index = 0; index < nikseComboBoxVoice.Items.Count; index++)
|
||||
{
|
||||
var item = nikseComboBoxVoice.Items[index];
|
||||
|
||||
var tsi = new ToolStripMenuItem();
|
||||
tsi.Tag = new ActorAndVoice { Voice = item.ToString(), VoiceIndex = index };
|
||||
tsi.Text = item.ToString();
|
||||
tsi.Click += (x, args) =>
|
||||
{
|
||||
var a = (ActorAndVoice)(x as ToolStripItem).Tag;
|
||||
SetActor(a);
|
||||
};
|
||||
contextMenuStripActors.Items.Add(tsi);
|
||||
}
|
||||
}
|
||||
|
||||
labelActors.Visible = true;
|
||||
listViewActors.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user