diff --git a/LanguageBaseEnglish.xml b/LanguageBaseEnglish.xml index b882f8b5f..7543a0b61 100644 --- a/LanguageBaseEnglish.xml +++ b/LanguageBaseEnglish.xml @@ -3158,7 +3158,7 @@ Continue? Text to speech Voice - Text voice + Test voice Default voice Add audio to video file (new file) Generate speech from text diff --git a/src/ui/Forms/Tts/TextToSpeech.Designer.cs b/src/ui/Forms/Tts/TextToSpeech.Designer.cs index 9df625eff..37c85deca 100644 --- a/src/ui/Forms/Tts/TextToSpeech.Designer.cs +++ b/src/ui/Forms/Tts/TextToSpeech.Designer.cs @@ -35,17 +35,17 @@ this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.labelEngine = new System.Windows.Forms.Label(); this.groupBoxMsSettings = new System.Windows.Forms.GroupBox(); + this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox(); this.buttonTestVoice = new System.Windows.Forms.Button(); this.checkBoxAddToVideoFile = new System.Windows.Forms.CheckBox(); this.labelVoice = new System.Windows.Forms.Label(); + this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.listViewActors = new System.Windows.Forms.ListView(); this.columnHeaderActor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderVoice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.contextMenuStripActors = new System.Windows.Forms.ContextMenuStrip(this.components); this.labelActors = new System.Windows.Forms.Label(); - this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox(); - this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.groupBoxMsSettings.SuspendLayout(); this.SuspendLayout(); // @@ -56,7 +56,7 @@ this.buttonOK.Location = new System.Drawing.Point(767, 456); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); - this.buttonOK.TabIndex = 7; + this.buttonOK.TabIndex = 100; this.buttonOK.Text = "&OK"; this.buttonOK.UseVisualStyleBackColor = true; this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); @@ -79,7 +79,7 @@ this.buttonGenerateTTS.Location = new System.Drawing.Point(614, 423); this.buttonGenerateTTS.Name = "buttonGenerateTTS"; this.buttonGenerateTTS.Size = new System.Drawing.Size(228, 23); - this.buttonGenerateTTS.TabIndex = 11; + this.buttonGenerateTTS.TabIndex = 90; this.buttonGenerateTTS.Text = "Generate speech from text"; this.buttonGenerateTTS.UseVisualStyleBackColor = true; this.buttonGenerateTTS.Click += new System.EventHandler(this.ButtonGenerateTtsClick); @@ -117,16 +117,27 @@ this.groupBoxMsSettings.Location = new System.Drawing.Point(15, 12); this.groupBoxMsSettings.Name = "groupBoxMsSettings"; this.groupBoxMsSettings.Size = new System.Drawing.Size(391, 405); - this.groupBoxMsSettings.TabIndex = 15; + this.groupBoxMsSettings.TabIndex = 1; this.groupBoxMsSettings.TabStop = false; this.groupBoxMsSettings.Text = "Settings"; // + // TextBoxTest + // + this.TextBoxTest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextBoxTest.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.TextBoxTest.Location = new System.Drawing.Point(17, 187); + this.TextBoxTest.Name = "TextBoxTest"; + this.TextBoxTest.Size = new System.Drawing.Size(351, 20); + this.TextBoxTest.TabIndex = 20; + this.TextBoxTest.Text = "Hello, how are you?"; + // // buttonTestVoice // this.buttonTestVoice.Location = new System.Drawing.Point(17, 158); this.buttonTestVoice.Name = "buttonTestVoice"; this.buttonTestVoice.Size = new System.Drawing.Size(150, 23); - this.buttonTestVoice.TabIndex = 17; + this.buttonTestVoice.TabIndex = 15; this.buttonTestVoice.Text = "Test voice"; this.buttonTestVoice.UseVisualStyleBackColor = true; this.buttonTestVoice.Click += new System.EventHandler(this.buttonTestVoice_Click); @@ -140,7 +151,7 @@ this.checkBoxAddToVideoFile.Location = new System.Drawing.Point(17, 373); this.checkBoxAddToVideoFile.Name = "checkBoxAddToVideoFile"; this.checkBoxAddToVideoFile.Size = new System.Drawing.Size(176, 17); - this.checkBoxAddToVideoFile.TabIndex = 16; + this.checkBoxAddToVideoFile.TabIndex = 26; this.checkBoxAddToVideoFile.Text = "Add audio to video file (new file)"; this.checkBoxAddToVideoFile.UseVisualStyleBackColor = true; // @@ -154,6 +165,59 @@ this.labelVoice.TabIndex = 16; this.labelVoice.Text = "Voice"; // + // nikseComboBoxVoice + // + this.nikseComboBoxVoice.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.nikseComboBoxVoice.BackColor = System.Drawing.SystemColors.Window; + this.nikseComboBoxVoice.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseComboBoxVoice.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseComboBoxVoice.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseComboBoxVoice.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseComboBoxVoice.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseComboBoxVoice.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseComboBoxVoice.DropDownHeight = 400; + this.nikseComboBoxVoice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.nikseComboBoxVoice.DropDownWidth = 0; + this.nikseComboBoxVoice.FormattingEnabled = false; + this.nikseComboBoxVoice.Location = new System.Drawing.Point(17, 124); + this.nikseComboBoxVoice.MaxLength = 32767; + this.nikseComboBoxVoice.Name = "nikseComboBoxVoice"; + this.nikseComboBoxVoice.SelectedIndex = -1; + this.nikseComboBoxVoice.SelectedItem = null; + this.nikseComboBoxVoice.SelectedText = ""; + this.nikseComboBoxVoice.Size = new System.Drawing.Size(351, 23); + this.nikseComboBoxVoice.TabIndex = 10; + this.nikseComboBoxVoice.UsePopupWindow = false; + // + // nikseComboBoxEngine + // + this.nikseComboBoxEngine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.nikseComboBoxEngine.BackColor = System.Drawing.SystemColors.Window; + this.nikseComboBoxEngine.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseComboBoxEngine.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseComboBoxEngine.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseComboBoxEngine.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseComboBoxEngine.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseComboBoxEngine.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseComboBoxEngine.DropDownHeight = 400; + this.nikseComboBoxEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; + this.nikseComboBoxEngine.DropDownWidth = 391; + this.nikseComboBoxEngine.FormattingEnabled = false; + this.nikseComboBoxEngine.Location = new System.Drawing.Point(17, 40); + this.nikseComboBoxEngine.MaxLength = 32767; + this.nikseComboBoxEngine.Name = "nikseComboBoxEngine"; + this.nikseComboBoxEngine.SelectedIndex = -1; + this.nikseComboBoxEngine.SelectedItem = null; + this.nikseComboBoxEngine.SelectedText = ""; + this.nikseComboBoxEngine.Size = new System.Drawing.Size(351, 23); + this.nikseComboBoxEngine.TabIndex = 5; + this.nikseComboBoxEngine.TabStop = false; + this.nikseComboBoxEngine.Text = "nikseComboBox1"; + this.nikseComboBoxEngine.UsePopupWindow = false; + this.nikseComboBoxEngine.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxEngine_SelectedIndexChanged); + // // listViewActors // this.listViewActors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -169,7 +233,7 @@ this.listViewActors.Location = new System.Drawing.Point(412, 42); this.listViewActors.Name = "listViewActors"; this.listViewActors.Size = new System.Drawing.Size(430, 375); - this.listViewActors.TabIndex = 17; + this.listViewActors.TabIndex = 40; this.listViewActors.UseCompatibleStateImageBehavior = false; this.listViewActors.View = System.Windows.Forms.View.Details; // @@ -198,70 +262,6 @@ this.labelActors.TabIndex = 19; this.labelActors.Text = "Right-click to assign actor to voice"; // - // TextBoxTest - // - this.TextBoxTest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.TextBoxTest.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.TextBoxTest.Location = new System.Drawing.Point(17, 187); - this.TextBoxTest.Name = "TextBoxTest"; - this.TextBoxTest.Size = new System.Drawing.Size(351, 20); - this.TextBoxTest.TabIndex = 18; - this.TextBoxTest.Text = "Hello, how are you?"; - // - // nikseComboBoxVoice - // - this.nikseComboBoxVoice.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.nikseComboBoxVoice.BackColor = System.Drawing.SystemColors.Window; - this.nikseComboBoxVoice.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.nikseComboBoxVoice.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.nikseComboBoxVoice.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.nikseComboBoxVoice.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.nikseComboBoxVoice.ButtonForeColorDown = System.Drawing.Color.Orange; - this.nikseComboBoxVoice.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseComboBoxVoice.DropDownHeight = 400; - this.nikseComboBoxVoice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.nikseComboBoxVoice.DropDownWidth = 0; - this.nikseComboBoxVoice.FormattingEnabled = false; - this.nikseComboBoxVoice.Location = new System.Drawing.Point(17, 124); - this.nikseComboBoxVoice.MaxLength = 32767; - this.nikseComboBoxVoice.Name = "nikseComboBoxVoice"; - this.nikseComboBoxVoice.SelectedIndex = -1; - this.nikseComboBoxVoice.SelectedItem = null; - this.nikseComboBoxVoice.SelectedText = ""; - this.nikseComboBoxVoice.Size = new System.Drawing.Size(351, 23); - this.nikseComboBoxVoice.TabIndex = 15; - this.nikseComboBoxVoice.UsePopupWindow = false; - // - // nikseComboBoxEngine - // - this.nikseComboBoxEngine.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.nikseComboBoxEngine.BackColor = System.Drawing.SystemColors.Window; - this.nikseComboBoxEngine.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.nikseComboBoxEngine.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.nikseComboBoxEngine.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.nikseComboBoxEngine.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.nikseComboBoxEngine.ButtonForeColorDown = System.Drawing.Color.Orange; - this.nikseComboBoxEngine.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseComboBoxEngine.DropDownHeight = 400; - this.nikseComboBoxEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; - this.nikseComboBoxEngine.DropDownWidth = 391; - this.nikseComboBoxEngine.FormattingEnabled = false; - this.nikseComboBoxEngine.Location = new System.Drawing.Point(17, 40); - this.nikseComboBoxEngine.MaxLength = 32767; - this.nikseComboBoxEngine.Name = "nikseComboBoxEngine"; - this.nikseComboBoxEngine.SelectedIndex = -1; - this.nikseComboBoxEngine.SelectedItem = null; - this.nikseComboBoxEngine.SelectedText = ""; - this.nikseComboBoxEngine.Size = new System.Drawing.Size(351, 23); - this.nikseComboBoxEngine.TabIndex = 13; - this.nikseComboBoxEngine.TabStop = false; - this.nikseComboBoxEngine.Text = "nikseComboBox1"; - this.nikseComboBoxEngine.UsePopupWindow = false; - this.nikseComboBoxEngine.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxEngine_SelectedIndexChanged); - // // TextToSpeech // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/src/ui/Forms/Tts/TextToSpeech.cs b/src/ui/Forms/Tts/TextToSpeech.cs index 3e8212eb2..24c1a0e37 100644 --- a/src/ui/Forms/Tts/TextToSpeech.cs +++ b/src/ui/Forms/Tts/TextToSpeech.cs @@ -1,14 +1,16 @@ -using System; +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Core.SubtitleFormats; +using Nikse.SubtitleEdit.Core.TextToSpeech; +using Nikse.SubtitleEdit.Logic; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; +using System.Net.Http; +using System.Threading.Tasks; using System.Windows.Forms; -using Nikse.SubtitleEdit.Core.Common; -using Nikse.SubtitleEdit.Core.SubtitleFormats; -using Nikse.SubtitleEdit.Core.TextToSpeech; -using Nikse.SubtitleEdit.Logic; using MessageBox = Nikse.SubtitleEdit.Forms.SeMsgBox.MessageBox; namespace Nikse.SubtitleEdit.Forms.Tts @@ -48,7 +50,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts public static string IdPiper = "Piper"; public static string IdTortoise = "Tortoise"; - public static string IdMimic3 = "Mimic3"; + public static string IdCoqui = "coqui"; public static string IdSpeechSynthesizer = "SpeechSynthesizer"; } @@ -84,7 +86,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts _engines = new List(); _engines.Add(new TextToSpeechEngine(TextToSpeechEngine.IdPiper, "Piper (fast/good)", _engines.Count)); _engines.Add(new TextToSpeechEngine(TextToSpeechEngine.IdTortoise, "Tortoise TTS (very slow/very good)", _engines.Count)); - _engines.Add(new TextToSpeechEngine(TextToSpeechEngine.IdMimic3, "Mimic3", _engines.Count)); + _engines.Add(new TextToSpeechEngine(TextToSpeechEngine.IdCoqui, "coqui TTS", _engines.Count)); if (Configuration.IsRunningOnWindows) { _engines.Add(new TextToSpeechEngine(TextToSpeechEngine.IdSpeechSynthesizer, "Microsoft SpeechSynthesizer (very fast/robotic)", _engines.Count)); @@ -148,7 +150,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts listViewActors.EndUpdate(); } - private void ButtonGenerateTtsClick(object sender, EventArgs e) + private async void ButtonGenerateTtsClick(object sender, EventArgs e) { if (buttonGenerateTTS.Text == LanguageSettings.Current.General.Cancel) { @@ -163,7 +165,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts _waveFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(_waveFolder); - GenerateParagraphAudio(_subtitle, true, null); + await GenerateParagraphAudio(_subtitle, true, null); if (_abort) { HandleAbort(); @@ -219,25 +221,29 @@ namespace Nikse.SubtitleEdit.Forms.Tts _abort = false; } - private void GenerateParagraphAudio(Subtitle subtitle, bool showProgressBar, string overrideFileName) + private async Task GenerateParagraphAudio(Subtitle subtitle, bool showProgressBar, string overrideFileName) { var engine = _engines.First(p => p.Index == nikseComboBoxEngine.SelectedIndex); if (engine.Id == TextToSpeechEngine.IdSpeechSynthesizer) { GenerateParagraphAudioMs(subtitle, showProgressBar, overrideFileName); + return true; } else if (engine.Id == TextToSpeechEngine.IdPiper) { - GenerateParagraphAudioPiperTts(subtitle, showProgressBar, overrideFileName); + return GenerateParagraphAudioPiperTts(subtitle, showProgressBar, overrideFileName); } else if (engine.Id == TextToSpeechEngine.IdTortoise) { - GenerateParagraphAudioTortoiseTts(subtitle, showProgressBar, overrideFileName); + return GenerateParagraphAudioTortoiseTts(subtitle, showProgressBar, overrideFileName); } - else if (engine.Id == TextToSpeechEngine.IdMimic3) + else if (engine.Id == TextToSpeechEngine.IdCoqui) { - GenerateParagraphAudioMimic3(subtitle, showProgressBar, overrideFileName); + var result = await GenerateParagraphAudioCoqui(subtitle, showProgressBar, overrideFileName); + return result; } + + return false; } private void AddAudioToVideoFile(string audioFileName) @@ -686,9 +692,45 @@ namespace Nikse.SubtitleEdit.Forms.Tts return true; } - private void GenerateParagraphAudioMimic3(Subtitle subtitle, bool showProgressBar, string overrideFileName) + private async Task GenerateParagraphAudioCoqui(Subtitle subtitle, bool showProgressBar, string overrideFileName) { - throw new NotImplementedException(); + var httpClient = new HttpClient(); + httpClient.BaseAddress = new Uri(nikseComboBoxVoice.Text.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? nikseComboBoxVoice.Text : "http://localhost:5002/api/tts"); + + progressBar1.Value = 0; + progressBar1.Maximum = subtitle.Paragraphs.Count; + progressBar1.Visible = showProgressBar; + + for (var index = 0; index < subtitle.Paragraphs.Count; index++) + { + if (showProgressBar) + { + progressBar1.Value = index + 1; + labelProgress.Text = string.Format(LanguageSettings.Current.TextToSpeech.GeneratingSpeechFromTextXOfY, index + 1, subtitle.Paragraphs.Count); + } + + var p = subtitle.Paragraphs[index]; + var outputFileName = Path.Combine(_waveFolder, string.IsNullOrEmpty(overrideFileName) ? index + ".wav" : overrideFileName); + + var result = await httpClient.GetAsync("?text=" + Utilities.UrlEncode(p.Text)); + var bytes = await result.Content.ReadAsByteArrayAsync(); + + if (!result.IsSuccessStatusCode) + { + SeLogger.Error($"coqui TTS failed calling API as base address {httpClient.BaseAddress} : Status code={result.StatusCode}"); + } + + File.WriteAllBytes(outputFileName, bytes); + + progressBar1.Refresh(); + labelProgress.Refresh(); + Application.DoEvents(); + } + + progressBar1.Visible = false; + labelProgress.Text = string.Empty; + + return true; } private void buttonOK_Click(object sender, EventArgs e) @@ -700,6 +742,12 @@ namespace Nikse.SubtitleEdit.Forms.Tts { nikseComboBoxVoice.Items.Clear(); + labelVoice.Text = LanguageSettings.Current.TextToSpeech.Voice; + if (SubtitleFormatHasActors() && _actors.Any()) + { + labelVoice.Text = LanguageSettings.Current.TextToSpeech.DefaultVoice; + } + var engine = _engines.First(p => p.Index == nikseComboBoxEngine.SelectedIndex); if (engine.Id == TextToSpeechEngine.IdSpeechSynthesizer) { @@ -748,6 +796,12 @@ namespace Nikse.SubtitleEdit.Forms.Tts nikseComboBoxVoice.Items.Add("william"); } + if (engine.Id == TextToSpeechEngine.IdCoqui) + { + labelVoice.Text = LanguageSettings.Current.General.WebServiceUrl; + nikseComboBoxVoice.Items.Add("http://localhost:5002/api/tts"); + } + if (nikseComboBoxVoice.Items.Count > 0) { nikseComboBoxVoice.SelectedIndex = 0; @@ -865,7 +919,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts listViewActors.AutoSizeLastColumn(); } - private void buttonTestVoice_Click(object sender, EventArgs e) + private async void buttonTestVoice_Click(object sender, EventArgs e) { try { @@ -880,7 +934,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts var sub = new Subtitle(); sub.Paragraphs.Add(new Paragraph(text, 0, 2500)); var waveFileNameOnly = Guid.NewGuid() + ".wav"; - GenerateParagraphAudio(sub, false, waveFileNameOnly); + await GenerateParagraphAudio(sub, false, waveFileNameOnly); var waveFileName = Path.Combine(_waveFolder, waveFileNameOnly); using (var soundPlayer = new System.Media.SoundPlayer(waveFileName)) { diff --git a/src/ui/Logic/Language.cs b/src/ui/Logic/Language.cs index 86f47a4d0..44da8cc9c 100644 --- a/src/ui/Logic/Language.cs +++ b/src/ui/Logic/Language.cs @@ -3556,7 +3556,7 @@ can edit in same subtitle file (collaboration)", Title = "Text to speech", Voice = "Voice", DefaultVoice = "Default voice", - TestVoice = "Text voice", + TestVoice = "Test voice", ActorInfo = "Right-click to assign actor to voice", AddAudioToVideo = "Add audio to video file (new file)", GenerateSpeech = "Generate speech from text",