diff --git a/Changelog.txt b/Changelog.txt index 47ccf4112..b2639bf8c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -4,6 +4,7 @@ 4.0.9 (xth December 2024) BETA * NEW: * Add "Move all shot changes" shortcuts - thx acetilo + * Add DeepLX translate - thx rifatozkancomtr * IMPROVED: * Update Portuguese translation - thx hugok79 * Update Bulgarian translation - thx Калин @@ -33,6 +34,7 @@ * Fix wrong dialog info text in FCE * Fix for divide by zero in TTS * Fix bug in "Change casing" - thx Hlsgs + * Fix enter in textbox in FCE - thx p1nkyy/Roger 4.0.8 (6th September 2024) diff --git a/Dictionaries/hrv_OCRFixReplaceList.xml b/Dictionaries/hrv_OCRFixReplaceList.xml index 5807bed34..16411bfae 100644 --- a/Dictionaries/hrv_OCRFixReplaceList.xml +++ b/Dictionaries/hrv_OCRFixReplaceList.xml @@ -2435,6 +2435,7 @@ + @@ -4007,6 +4008,8 @@ + + @@ -5575,6 +5578,7 @@ + @@ -5825,6 +5829,7 @@ + @@ -5843,9 +5848,7 @@ - - - + diff --git a/LanguageBaseEnglish.xml b/LanguageBaseEnglish.xml index b7a0591e3..ac88c29c2 100644 --- a/LanguageBaseEnglish.xml +++ b/LanguageBaseEnglish.xml @@ -3188,6 +3188,8 @@ Continue? Auto-continue Regenerate Speed + Stability + Similarity SMPTE timing diff --git a/src/libse/AudioToText/WhisperPurfviewFasterWhisperModel.cs b/src/libse/AudioToText/WhisperPurfviewFasterWhisperModel.cs index 684e6f12c..fc25160e6 100644 --- a/src/libse/AudioToText/WhisperPurfviewFasterWhisperModel.cs +++ b/src/libse/AudioToText/WhisperPurfviewFasterWhisperModel.cs @@ -1,7 +1,6 @@ using Nikse.SubtitleEdit.Core.Common; using System.Collections.Generic; using System.IO; -using static System.Net.WebRequestMethods; namespace Nikse.SubtitleEdit.Core.AudioToText { diff --git a/src/libse/AutoTranslate/DeepLXTranslate.cs b/src/libse/AutoTranslate/DeepLXTranslate.cs new file mode 100644 index 000000000..5daba0ecb --- /dev/null +++ b/src/libse/AutoTranslate/DeepLXTranslate.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Core.Translate; + +namespace Nikse.SubtitleEdit.Core.AutoTranslate +{ + /// + /// DeepLX translator - see https://github.com/OwO-Network/DeepLX + /// + public class DeepLXTranslate : IAutoTranslator + { + private string _apiUrl; + private HttpClient _client; + + public static string StaticName { get; set; } = "DeepLX translate"; + public override string ToString() => StaticName; + public string Name => StaticName; + public string Url => "https://github.com/OwO-Network/DeepLX"; + public string Error { get; set; } + public int MaxCharacters => 1500; + + public void Initialize() + { + if (string.IsNullOrEmpty(Configuration.Settings.Tools.AutoTranslateDeepLXUrl)) + { + Configuration.Settings.Tools.AutoTranslateDeepLXUrl = "http://localhost:1188"; + } + _apiUrl = Configuration.Settings.Tools.AutoTranslateDeepLXUrl; + + _client = new HttpClient(); + _client.BaseAddress = new Uri(_apiUrl.Trim().TrimEnd('/')); + } + + public List GetSupportedSourceLanguages() + { + return new DeepLTranslate().GetSupportedSourceLanguages(); + } + + public List GetSupportedTargetLanguages() + { + return new DeepLTranslate().GetSupportedTargetLanguages(); + } + + public Task Translate(string text, string sourceLanguageCode, string targetLanguageCode, CancellationToken cancellationToken) + { + var postContent = new FormUrlEncodedContent(new[] + { + new KeyValuePair("text", text), + new KeyValuePair("target_lang", targetLanguageCode), + new KeyValuePair("source_lang", sourceLanguageCode), + }); + var result = _client.PostAsync("/v2/translate", postContent, cancellationToken).Result; + var resultContent = result.Content.ReadAsStringAsync().Result; + + if (!result.IsSuccessStatusCode) + { + SeLogger.Error("DeepLTranslate error: " + resultContent); + } + + if (result.StatusCode == HttpStatusCode.Forbidden) + { + Error = resultContent; + throw new Exception("Forbidden! " + Environment.NewLine + Environment.NewLine + resultContent); + } + + var resultList = new List(); + var parser = new JsonParser(); + var x = (Dictionary)parser.Parse(resultContent); + foreach (var k in x.Keys) + { + if (x[k] is List mainList) + { + foreach (var mainListItem in mainList) + { + if (mainListItem is Dictionary innerDic) + { + foreach (var transItem in innerDic.Keys) + { + if (transItem == "text") + { + var s = innerDic[transItem].ToString(); + resultList.Add(s); + } + } + } + } + } + } + + return Task.FromResult(string.Join(Environment.NewLine, resultList)); + } + } +} diff --git a/src/libse/Common/TimeCode.cs b/src/libse/Common/TimeCode.cs index c520a893d..cce2fdcab 100644 --- a/src/libse/Common/TimeCode.cs +++ b/src/libse/Common/TimeCode.cs @@ -354,7 +354,7 @@ namespace Nikse.SubtitleEdit.Core.Common public TimeCode AlignToFrame() { var ts = TimeSpan.FromMilliseconds(Math.Round(TotalMilliseconds, MidpointRounding.AwayFromZero)); - var frames = Math.Round(ts.Milliseconds / (TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate)); + var frames = SubtitleFormat.MillisecondsToFrames(ts.Milliseconds); TimeSpan ts2; if (frames >= Configuration.Settings.General.CurrentFrameRate - 0.001) { diff --git a/src/libse/ContainerFormats/Matroska/MatroskaFile.cs b/src/libse/ContainerFormats/Matroska/MatroskaFile.cs index 40941ac9f..c040f4761 100644 --- a/src/libse/ContainerFormats/Matroska/MatroskaFile.cs +++ b/src/libse/ContainerFormats/Matroska/MatroskaFile.cs @@ -520,10 +520,10 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.Matroska } } - private string GetChapterName(Element ChapterDisplay) + private string GetChapterName(Element chapterDisplay) { Element element; - while (_stream.Position < ChapterDisplay.EndPosition && (element = ReadElement()) != null) + while (_stream.Position < chapterDisplay.EndPosition && (element = ReadElement()) != null) { if (element.Id == ElementId.ChapString) { @@ -671,11 +671,7 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.Matroska return _subtitleRip; } - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } + public void Dispose() => Dispose(true); private void Dispose(bool disposing) { @@ -686,7 +682,6 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.Matroska } } - private void ReadSegmentInfoAndTracks() { // go to segment diff --git a/src/libse/Forms/TimeCodesBeautifier.cs b/src/libse/Forms/TimeCodesBeautifier.cs index 8eb8d03de..a8411ebfa 100644 --- a/src/libse/Forms/TimeCodesBeautifier.cs +++ b/src/libse/Forms/TimeCodesBeautifier.cs @@ -111,7 +111,7 @@ namespace Nikse.SubtitleEdit.Core.Forms } } - private bool FixConnectedSubtitles(Paragraph leftParagraph = null, Paragraph rightParagraph = null) + private bool FixConnectedSubtitles(Paragraph leftParagraph = null, Paragraph rightParagraph = null, bool checkConnected = true) { if (leftParagraph == null || rightParagraph == null) { @@ -140,7 +140,7 @@ namespace Nikse.SubtitleEdit.Core.Forms var subtitlesAreConnected = distance < Configuration.Settings.BeautifyTimeCodes.Profile.ConnectedSubtitlesTreatConnected; - if (subtitlesAreConnected) + if (subtitlesAreConnected || !checkConnected) { var newLeftOutCueFrame = MillisecondsToFrames(leftParagraph.EndTime.TotalMilliseconds); var newRightInCueFrame = MillisecondsToFrames(rightParagraph.StartTime.TotalMilliseconds); @@ -539,6 +539,17 @@ namespace Nikse.SubtitleEdit.Core.Forms bestRightInCueFrame = newRightInCueFrame; } + // Re-check if, with the new cues, the subtitles are actually connected + var newDistance = FramesToMilliseconds(bestRightInCueFrame) - FramesToMilliseconds(bestLeftOutCueFrame); + if (newDistance < Configuration.Settings.BeautifyTimeCodes.Profile.ConnectedSubtitlesTreatConnected) + { + // Yes, so handle using the designated function, ignoring its check connected check + // (because otherwise it would have handled it before going into the FixChainableSubtitles function) + FixConnectedSubtitles(leftParagraph, rightParagraph, checkConnected: false); + + return true; + } + // Check cases var isLeftOutCueOnShotChange = IsCueOnShotChange(bestLeftOutCueFrame, false); var isRightInCueOnShotChange = IsCueOnShotChange(bestRightInCueFrame, true); diff --git a/src/libse/Settings/Settings.cs b/src/libse/Settings/Settings.cs index 6a5d8f58d..d43ccf660 100644 --- a/src/libse/Settings/Settings.cs +++ b/src/libse/Settings/Settings.cs @@ -2359,6 +2359,18 @@ namespace Nikse.SubtitleEdit.Core.Settings settings.Tools.TextToSpeechElevenLabsLanguage = subNode.InnerText; } + subNode = node.SelectSingleNode("TextToSpeechElevenLabsStability"); + if (subNode != null) + { + settings.Tools.TextToSpeechElevenLabsStability = Convert.ToDouble(subNode.InnerText, CultureInfo.InvariantCulture); + } + + subNode = node.SelectSingleNode("TextToSpeechElevenLabsSimilarity"); + if (subNode != null) + { + settings.Tools.TextToSpeechElevenLabsSimilarity = Convert.ToDouble(subNode.InnerText, CultureInfo.InvariantCulture); + } + subNode = node.SelectSingleNode("TextToSpeechAzureApiKey"); if (subNode != null) { @@ -9034,6 +9046,8 @@ namespace Nikse.SubtitleEdit.Core.Settings xmlWriter.WriteElementString("TextToSpeechElevenLabsApiKey", settings.Tools.TextToSpeechElevenLabsApiKey); xmlWriter.WriteElementString("TextToSpeechElevenLabsModel", settings.Tools.TextToSpeechElevenLabsModel); xmlWriter.WriteElementString("TextToSpeechElevenLabsLanguage", settings.Tools.TextToSpeechElevenLabsLanguage); + xmlWriter.WriteElementString("TextToSpeechElevenLabsStability", settings.Tools.TextToSpeechElevenLabsStability.ToString(CultureInfo.InvariantCulture)); + xmlWriter.WriteElementString("TextToSpeechElevenLabsSimilarity", settings.Tools.TextToSpeechElevenLabsSimilarity.ToString(CultureInfo.InvariantCulture)); xmlWriter.WriteElementString("TextToSpeechAzureApiKey", settings.Tools.TextToSpeechAzureApiKey); xmlWriter.WriteElementString("TextToSpeechAzureRegion", settings.Tools.TextToSpeechAzureRegion); xmlWriter.WriteElementString("TextToSpeechPreview", settings.Tools.TextToSpeechPreview.ToString(CultureInfo.InvariantCulture)); diff --git a/src/libse/Settings/ToolsSettings.cs b/src/libse/Settings/ToolsSettings.cs index fe180d1d2..b0412dab0 100644 --- a/src/libse/Settings/ToolsSettings.cs +++ b/src/libse/Settings/ToolsSettings.cs @@ -58,6 +58,7 @@ namespace Nikse.SubtitleEdit.Core.Settings public string AutoTranslateSeamlessM4TUrl { get; set; } public string AutoTranslateDeepLApiKey { get; set; } public string AutoTranslateDeepLUrl { get; set; } + public string AutoTranslateDeepLXUrl { get; set; } public string AutoTranslatePapagoApiKeyId { get; set; } public string AutoTranslatePapagoApiKey { get; set; } public string AutoTranslateDeepLFormality { get; set; } @@ -102,6 +103,8 @@ namespace Nikse.SubtitleEdit.Core.Settings public string TextToSpeechAzureRegion { get; set; } public string TextToSpeechElevenLabsModel { get; set; } public string TextToSpeechElevenLabsLanguage { get; set; } + public double TextToSpeechElevenLabsStability { get; set; } + public double TextToSpeechElevenLabsSimilarity { get; set; } public bool TextToSpeechPreview { get; set; } public bool TextToSpeechCustomAudio { get; set; } public bool TextToSpeechCustomAudioStereo { get; set; } @@ -470,6 +473,7 @@ namespace Nikse.SubtitleEdit.Core.Settings AutoTranslateLibreUrl = "http://localhost:5000/"; AutoTranslateSeamlessM4TUrl = "http://localhost:5000/"; AutoTranslateDeepLUrl = "https://api-free.deepl.com/"; + AutoTranslateDeepLUrl = "http://localhost:1188"; ChatGptUrl = "https://api.openai.com/v1/chat/completions"; ChatGptPrompt = "Translate from {0} to {1}, keep punctuation as input, do not censor the translation, give only the output without comments:"; ChatGptModel = ChatGptTranslate.Models[0]; @@ -488,6 +492,8 @@ namespace Nikse.SubtitleEdit.Core.Settings AnthropicPrompt = "Translate from {0} to {1}, keep sentences in {1} as they are, do not censor the translation, give only the output without comments:"; AnthropicApiModel = AnthropicTranslate.Models[0]; TextToSpeechAzureRegion = "westeurope"; + TextToSpeechElevenLabsSimilarity = 0.5; + TextToSpeechElevenLabsStability = 0.5; AutoTranslateMaxBytes = 2000; TextToSpeechAddToVideoFile = true; TranslateAllowSplit = true; diff --git a/src/libse/SubtitleFormats/AQTitle.cs b/src/libse/SubtitleFormats/AQTitle.cs index 039a3f3a1..465cfa8c3 100644 --- a/src/libse/SubtitleFormats/AQTitle.cs +++ b/src/libse/SubtitleFormats/AQTitle.cs @@ -131,11 +131,6 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return frames.ToString(CultureInfo.InvariantCulture); } - private static TimeCode DecodeTimeCode(string timePart) - { - int milliseconds = (int)Math.Round(TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate * int.Parse(timePart)); - return new TimeCode(milliseconds); - } - + private static TimeCode DecodeTimeCode(string timePart) => new TimeCode(FramesToMilliseconds(int.Parse(timePart))); } } diff --git a/src/libse/SubtitleFormats/CaptionAssistant.cs b/src/libse/SubtitleFormats/CaptionAssistant.cs index df3027ff6..dace62199 100644 --- a/src/libse/SubtitleFormats/CaptionAssistant.cs +++ b/src/libse/SubtitleFormats/CaptionAssistant.cs @@ -24,14 +24,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats var minutes = int.Parse(parts[1]); var seconds = int.Parse(parts[2]); var frames = int.Parse(parts[3]); - - int milliseconds = (int)Math.Round(((TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate) * frames)); - if (milliseconds > 999) - { - milliseconds = 999; - } - - return new TimeCode(hour, minutes, seconds, milliseconds); + return new TimeCode(hour, minutes, seconds, FramesToMillisecondsMax999(frames)); } public override string ToText(Subtitle subtitle, string title) diff --git a/src/libse/SubtitleFormats/Cavena890.cs b/src/libse/SubtitleFormats/Cavena890.cs index fb5595d96..bf446c97a 100644 --- a/src/libse/SubtitleFormats/Cavena890.cs +++ b/src/libse/SubtitleFormats/Cavena890.cs @@ -1522,8 +1522,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats private static void WriteTime(Stream fs, TimeCode timeCode) { - double totalMilliseconds = timeCode.TotalMilliseconds; - int frames = (int)Math.Round(totalMilliseconds / (TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate)); + int frames = MillisecondsToFrames(timeCode.TotalMilliseconds); fs.WriteByte((byte)(frames / 256 / 256)); fs.WriteByte((byte)(frames / 256)); fs.WriteByte((byte)(frames % 256)); @@ -1644,8 +1643,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats else { subtitle.Paragraphs.Add(p); - p.StartTime.TotalMilliseconds = (TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate) * startFrame; - p.EndTime.TotalMilliseconds = (TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate) * endFrame; + p.StartTime.TotalMilliseconds = FramesToMilliseconds(startFrame); + p.EndTime.TotalMilliseconds = FramesToMilliseconds(endFrame); p.Text = string.Join(Environment.NewLine, new[] { line1, line2 }.Select(l => l.TrimEnd()).Where(l => !string.IsNullOrWhiteSpace(l))); } if (boxType >= 0xa0 && boxType <= 0xa9 && !string.IsNullOrEmpty(p.Text)) // box diff --git a/src/libse/SubtitleFormats/ElrPrint.cs b/src/libse/SubtitleFormats/ElrPrint.cs index 454b85a97..3d678ccc1 100644 --- a/src/libse/SubtitleFormats/ElrPrint.cs +++ b/src/libse/SubtitleFormats/ElrPrint.cs @@ -48,7 +48,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { string s; var ts = p.Duration.TimeSpan; - var frames = Math.Round(ts.Milliseconds / (TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate)); + var frames = MillisecondsToFrames(ts.Milliseconds); if (frames >= Configuration.Settings.General.CurrentFrameRate - 0.001) { s = $"{ts.Seconds + 1:00}:{0:00}"; diff --git a/src/libse/SubtitleFormats/NciCaption.cs b/src/libse/SubtitleFormats/NciCaption.cs index cde4c17f5..2746f50c9 100644 --- a/src/libse/SubtitleFormats/NciCaption.cs +++ b/src/libse/SubtitleFormats/NciCaption.cs @@ -62,14 +62,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats int minutes = buffer[index + 1]; int seconds = buffer[index + 2]; int frames = buffer[index + 3]; - - int milliseconds = (int)Math.Round(TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate * frames); - if (milliseconds > 999) - { - milliseconds = 999; - } - - return new TimeCode(hour, minutes, seconds, milliseconds); + return new TimeCode(hour, minutes, seconds, FramesToMillisecondsMax999(frames)); } public override void LoadSubtitle(Subtitle subtitle, List lines, string fileName) diff --git a/src/libse/SubtitleFormats/UtxFrames.cs b/src/libse/SubtitleFormats/UtxFrames.cs index 2fdef5c8f..861fe1374 100644 --- a/src/libse/SubtitleFormats/UtxFrames.cs +++ b/src/libse/SubtitleFormats/UtxFrames.cs @@ -72,17 +72,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats subtitle.Renumber(); } - private static string EncodeTimeCode(TimeCode time) - { - long frames = (long)(time.TotalMilliseconds / (TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate)); - return frames.ToString(); - } - - private static TimeCode DecodeTimeCode(string timePart) - { - int milliseconds = (int)Math.Round(TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate * int.Parse(timePart)); - return new TimeCode(milliseconds); - } + private static string EncodeTimeCode(TimeCode time) => MillisecondsToFrames(time.TotalMilliseconds).ToString(); + private static TimeCode DecodeTimeCode(string timePart) => new TimeCode(FramesToMilliseconds(int.Parse(timePart))); } } diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.cs index 38eea6877..b116a5ade 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.cs @@ -560,17 +560,12 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText Configuration.Settings.Tools.WhisperPostProcessingFixShortDuration, Configuration.Settings.Tools.WhisperPostProcessingSplitLines); + UpdateLog(); + SeLogger.WhisperInfo(textBoxLog.Text); if (transcript == null || transcript.Paragraphs.Count == 0) { - UpdateLog(); - SeLogger.WhisperInfo(textBoxLog.Text); IncompleteModelName = comboBoxModels.Text; } - else - { - UpdateLog(); - SeLogger.WhisperInfo(textBoxLog.Text); - } timer1.Stop(); @@ -1054,8 +1049,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText } else { - var rawText = FileUtil.ReadAllLinesShared(srtFileName, Encoding.UTF8); - new WebVTT().LoadSubtitle(sub, rawText, srtFileName); + var rawText = FileUtil.ReadAllLinesShared(vttFileName, Encoding.UTF8); + new WebVTT().LoadSubtitle(sub, rawText, vttFileName); outputText?.Add($"Loading result from {vttFileName}{Environment.NewLine}"); } diff --git a/src/ui/Forms/FixCommonErrors.cs b/src/ui/Forms/FixCommonErrors.cs index 574c77135..f3d5567fd 100644 --- a/src/ui/Forms/FixCommonErrors.cs +++ b/src/ui/Forms/FixCommonErrors.cs @@ -610,6 +610,7 @@ namespace Nikse.SubtitleEdit.Forms listView1.Select(); AcceptButton = buttonNextFinish; + textBoxListViewText.AcceptsReturn = true; } private void FixLargeFonts() diff --git a/src/ui/Forms/ImportUnknownFormat.cs b/src/ui/Forms/ImportUnknownFormat.cs index 7342fbca6..bf18b86ac 100644 --- a/src/ui/Forms/ImportUnknownFormat.cs +++ b/src/ui/Forms/ImportUnknownFormat.cs @@ -10,7 +10,7 @@ namespace Nikse.SubtitleEdit.Forms { public partial class ImportUnknownFormat : Form { - public Subtitle ImportedSubitle { get; private set; } + public Subtitle ImportedSubtitle { get; private set; } private readonly Timer _refreshTimer = new Timer(); public ImportUnknownFormat(string fileName) @@ -47,10 +47,10 @@ namespace Nikse.SubtitleEdit.Forms private void GeneratePreviewReal() { var uknownFormatImporter = new UnknownFormatImporter { UseFrames = radioButtonTimeCodeFrames.Checked }; - ImportedSubitle = uknownFormatImporter.AutoGuessImport(textBoxText.Lines.ToList()); - groupBoxImportResult.Text = string.Format(LanguageSettings.Current.ImportText.PreviewLinesModifiedX, ImportedSubitle.Paragraphs.Count); - SubtitleListview1.Fill(ImportedSubitle); - if (ImportedSubitle.Paragraphs.Count > 0) + ImportedSubtitle = uknownFormatImporter.AutoGuessImport(textBoxText.Lines.ToList()); + groupBoxImportResult.Text = string.Format(LanguageSettings.Current.ImportText.PreviewLinesModifiedX, ImportedSubtitle.Paragraphs.Count); + SubtitleListview1.Fill(ImportedSubtitle); + if (ImportedSubtitle.Paragraphs.Count > 0) { SubtitleListview1.SelectIndexAndEnsureVisible(0); } diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index 778d34b27..d95ee1e6b 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -5394,7 +5394,7 @@ namespace Nikse.SubtitleEdit.Forms return DialogResult.No; } - MessageBox.Show("Ups - save original does not support this format - please go to Github and create an issue!"); + MessageBox.Show("Oops - save original does not support this format - please go to Github and create an issue!"); } string allText = subAlt.ToText(format); @@ -13408,7 +13408,7 @@ namespace Nikse.SubtitleEdit.Forms { var seconds = (int)numericUpDownDuration.Value; var frames = (int)Math.Round((Convert.ToDouble(numericUpDownDuration.Value) % 1.0 * 100.0)); - return seconds * TimeCode.BaseUnit + frames * (TimeCode.BaseUnit / Configuration.Settings.General.CurrentFrameRate); + return seconds * TimeCode.BaseUnit + SubtitleFormat.FramesToMilliseconds(frames); } return ((double)numericUpDownDuration.Value * TimeCode.BaseUnit); @@ -18638,9 +18638,9 @@ namespace Nikse.SubtitleEdit.Forms { if (form.ShowDialog(this) == DialogResult.OK) { - if (form.ImportedSubitle?.Paragraphs.Count > 0) + if (form.ImportedSubtitle?.Paragraphs.Count > 0) { - _subtitle = form.ImportedSubitle; + _subtitle = form.ImportedSubtitle; _fileName = null; SubtitleListview1.Fill(_subtitle, _subtitleOriginal); SetTitle(); diff --git a/src/ui/Forms/Ocr/OCRSpellCheck.Designer.cs b/src/ui/Forms/Ocr/OCRSpellCheck.Designer.cs index 9e3058b51..009a7274f 100644 --- a/src/ui/Forms/Ocr/OCRSpellCheck.Designer.cs +++ b/src/ui/Forms/Ocr/OCRSpellCheck.Designer.cs @@ -206,6 +206,7 @@ // // textBoxWord // + this.textBoxWord.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); this.textBoxWord.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxWord.Location = new System.Drawing.Point(6, 19); this.textBoxWord.Name = "textBoxWord"; @@ -250,9 +251,9 @@ // // buttonChangeAllWholeText // - this.buttonChangeAllWholeText.Location = new System.Drawing.Point(6, 115); + this.buttonChangeAllWholeText.Location = new System.Drawing.Point(6, 117); this.buttonChangeAllWholeText.Name = "buttonChangeAllWholeText"; - this.buttonChangeAllWholeText.Size = new System.Drawing.Size(141, 21); + this.buttonChangeAllWholeText.Size = new System.Drawing.Size(141, 23); this.buttonChangeAllWholeText.TabIndex = 36; this.buttonChangeAllWholeText.Text = "Change all"; this.buttonChangeAllWholeText.UseVisualStyleBackColor = true; @@ -262,7 +263,7 @@ // this.buttonSkipText.Location = new System.Drawing.Point(156, 88); this.buttonSkipText.Name = "buttonSkipText"; - this.buttonSkipText.Size = new System.Drawing.Size(139, 21); + this.buttonSkipText.Size = new System.Drawing.Size(139, 23); this.buttonSkipText.TabIndex = 35; this.buttonSkipText.Text = "Skip text"; this.buttonSkipText.UseVisualStyleBackColor = true; @@ -272,7 +273,7 @@ // this.buttonChangeWholeText.Location = new System.Drawing.Point(6, 88); this.buttonChangeWholeText.Name = "buttonChangeWholeText"; - this.buttonChangeWholeText.Size = new System.Drawing.Size(143, 21); + this.buttonChangeWholeText.Size = new System.Drawing.Size(143, 23); this.buttonChangeWholeText.TabIndex = 34; this.buttonChangeWholeText.Text = "Change"; this.buttonChangeWholeText.UseVisualStyleBackColor = true; @@ -280,6 +281,7 @@ // // textBoxWholeText // + this.textBoxWholeText.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); this.textBoxWholeText.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxWholeText.Location = new System.Drawing.Point(6, 19); this.textBoxWholeText.Multiline = true; @@ -394,14 +396,14 @@ this.buttonEditWord.UseVisualStyleBackColor = true; this.buttonEditWord.Click += new System.EventHandler(this.ButtonEditWordClick); // - // contextMenuStrip2 + // contextMenuStripForm // this.contextMenuStripForm.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.useLargerFontForThisWindowToolStripMenuItem}); this.contextMenuStripForm.Name = "contextMenuStripForm"; - this.contextMenuStripForm.Size = new System.Drawing.Size(237, 48); + this.contextMenuStripForm.Size = new System.Drawing.Size(237, 26); // - // useLargerFontForThisWindowToolStripMenuItem1 + // useLargerFontForThisWindowToolStripMenuItem // this.useLargerFontForThisWindowToolStripMenuItem.Name = "useLargerFontForThisWindowToolStripMenuItem"; this.useLargerFontForThisWindowToolStripMenuItem.Size = new System.Drawing.Size(236, 22); diff --git a/src/ui/Forms/ShotChanges/ImportShotChanges.cs b/src/ui/Forms/ShotChanges/ImportShotChanges.cs index c9b723977..0c93a9954 100644 --- a/src/ui/Forms/ShotChanges/ImportShotChanges.cs +++ b/src/ui/Forms/ShotChanges/ImportShotChanges.cs @@ -94,6 +94,7 @@ namespace Nikse.SubtitleEdit.Forms.ShotChanges "|JSON shot changes file|*.json" + "|" + LanguageSettings.Current.General.AllFiles + "|*.*"; openFileDialog1.FileName = string.Empty; + openFileDialog1.InitialDirectory = Path.GetDirectoryName(_videoFileName); if (openFileDialog1.ShowDialog() == DialogResult.OK) { LoadTextFile(openFileDialog1.FileName); diff --git a/src/ui/Forms/Translate/AutoTranslate.cs b/src/ui/Forms/Translate/AutoTranslate.cs index 1fabea940..b94435fc7 100644 --- a/src/ui/Forms/Translate/AutoTranslate.cs +++ b/src/ui/Forms/Translate/AutoTranslate.cs @@ -133,6 +133,7 @@ namespace Nikse.SubtitleEdit.Forms.Translate new OpenRouterTranslate(), new GeminiTranslate(), new PapagoTranslate(), + new DeepLXTranslate(), new NoLanguageLeftBehindServe(), new NoLanguageLeftBehindApi(), }; @@ -227,6 +228,21 @@ namespace Nikse.SubtitleEdit.Forms.Translate return; } + if (engineType == typeof(DeepLXTranslate)) + { + if (string.IsNullOrEmpty(Configuration.Settings.Tools.AutoTranslateDeepLXUrl)) + { + Configuration.Settings.Tools.AutoTranslateDeepLXUrl = "http://localhost:1188"; + } + + FillUrls(new List + { + Configuration.Settings.Tools.AutoTranslateDeepLXUrl, + }); + + return; + } + if (engineType == typeof(NoLanguageLeftBehindServe)) { FillUrls(new List @@ -1054,6 +1070,19 @@ namespace Nikse.SubtitleEdit.Forms.Translate UiUtil.ShowHelp("#translation"); } } + else if (linesTranslate == 0 && engineType == typeof(DeepLXTranslate) && exception.Message.Contains("No connection could be made because the target machine actively refused it")) + { + MessageBox.Show( + this, "You need a local API to use DeepLX. Run ths docker command: "+ Environment.NewLine + + "docker run -itd -p 1188:1188 ghcr.io/owo-network/deeplx:latest" + Environment.NewLine + + Environment.NewLine + + exception.Message + Environment.NewLine + + Environment.NewLine + + "For more information visit: " + new DeepLXTranslate().Url, + Text, + MessageBoxButtons.OKCancel, + MessageBoxIcon.Error); + } else if (linesTranslate == 0 && (nikseComboBoxUrl.Text.Contains("//192.", StringComparison.OrdinalIgnoreCase) || nikseComboBoxUrl.Text.Contains("//127.", StringComparison.OrdinalIgnoreCase) || @@ -1105,6 +1134,11 @@ namespace Nikse.SubtitleEdit.Forms.Translate Configuration.Settings.Tools.AutoTranslateDeepLApiKey = nikseTextBoxApiKey.Text.Trim(); } + if (engineType == typeof(DeepLXTranslate) && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) + { + Configuration.Settings.Tools.AutoTranslateDeepLXUrl = nikseComboBoxUrl.Text.Trim(); + } + if (engineType == typeof(LibreTranslate) && nikseTextBoxApiKey.Visible && !string.IsNullOrWhiteSpace(nikseTextBoxApiKey.Text)) { Configuration.Settings.Tools.AutoTranslateLibreApiKey = nikseTextBoxApiKey.Text.Trim(); @@ -1380,9 +1414,9 @@ namespace Nikse.SubtitleEdit.Forms.Translate private static void SyncListViews(ListView listViewSelected, SubtitleListView listViewOther) { - if (listViewSelected == null || - listViewOther == null || - listViewSelected.SelectedItems.Count == 0 || + if (listViewSelected == null || + listViewOther == null || + listViewSelected.SelectedItems.Count == 0 || listViewSelected.TopItem == null) { return; diff --git a/src/ui/Forms/Tts/TextToSpeech.Designer.cs b/src/ui/Forms/Tts/TextToSpeech.Designer.cs index 279769640..c81d25f04 100644 --- a/src/ui/Forms/Tts/TextToSpeech.Designer.cs +++ b/src/ui/Forms/Tts/TextToSpeech.Designer.cs @@ -36,29 +36,33 @@ this.labelEngine = new System.Windows.Forms.Label(); this.groupBoxSettings = new System.Windows.Forms.GroupBox(); this.labelLanguage = new System.Windows.Forms.Label(); - this.nikseComboBoxLanguage = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.linkLabelCustomAudio = new System.Windows.Forms.LinkLabel(); this.checkBoxAudioEncoding = new System.Windows.Forms.CheckBox(); this.labelRegion = new System.Windows.Forms.Label(); - this.nikseComboBoxRegion = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.labelVoiceCount = new System.Windows.Forms.Label(); this.checkBoxShowPreview = new System.Windows.Forms.CheckBox(); this.labelApiKey = new System.Windows.Forms.Label(); - this.nikseTextBoxApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox(); - 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.contextMenuStripVoices = new System.Windows.Forms.ContextMenuStrip(this.components); this.refreshVoicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - 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.buttonCancel = new System.Windows.Forms.Button(); + this.nikseUpDownStability = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.nikseUpDownSimilarity = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelSimilarity = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelStability = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.nikseComboBoxLanguage = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.nikseComboBoxRegion = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.nikseTextBoxApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.groupBoxSettings.SuspendLayout(); this.contextMenuStripVoices.SuspendLayout(); this.SuspendLayout(); @@ -121,6 +125,10 @@ // this.groupBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); + this.groupBoxSettings.Controls.Add(this.nikseUpDownStability); + this.groupBoxSettings.Controls.Add(this.nikseUpDownSimilarity); + this.groupBoxSettings.Controls.Add(this.labelSimilarity); + this.groupBoxSettings.Controls.Add(this.labelStability); this.groupBoxSettings.Controls.Add(this.labelLanguage); this.groupBoxSettings.Controls.Add(this.nikseComboBoxLanguage); this.groupBoxSettings.Controls.Add(this.linkLabelCustomAudio); @@ -155,39 +163,14 @@ this.labelLanguage.TabIndex = 36; this.labelLanguage.Text = "Language"; // - // nikseComboBoxLanguage - // - this.nikseComboBoxLanguage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.nikseComboBoxLanguage.BackColor = System.Drawing.SystemColors.Window; - this.nikseComboBoxLanguage.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.nikseComboBoxLanguage.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.nikseComboBoxLanguage.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.nikseComboBoxLanguage.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.nikseComboBoxLanguage.ButtonForeColorDown = System.Drawing.Color.Orange; - this.nikseComboBoxLanguage.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseComboBoxLanguage.DropDownHeight = 400; - this.nikseComboBoxLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.nikseComboBoxLanguage.DropDownWidth = 0; - this.nikseComboBoxLanguage.FormattingEnabled = false; - this.nikseComboBoxLanguage.Location = new System.Drawing.Point(102, 269); - this.nikseComboBoxLanguage.MaxLength = 32767; - this.nikseComboBoxLanguage.Name = "nikseComboBoxLanguage"; - this.nikseComboBoxLanguage.SelectedIndex = -1; - this.nikseComboBoxLanguage.SelectedItem = null; - this.nikseComboBoxLanguage.SelectedText = ""; - this.nikseComboBoxLanguage.Size = new System.Drawing.Size(266, 23); - this.nikseComboBoxLanguage.TabIndex = 35; - this.nikseComboBoxLanguage.UsePopupWindow = false; - // // linkLabelCustomAudio // this.linkLabelCustomAudio.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.linkLabelCustomAudio.AutoSize = true; - this.linkLabelCustomAudio.Location = new System.Drawing.Point(169, 400); + this.linkLabelCustomAudio.Location = new System.Drawing.Point(168, 400); this.linkLabelCustomAudio.Name = "linkLabelCustomAudio"; this.linkLabelCustomAudio.Size = new System.Drawing.Size(45, 13); - this.linkLabelCustomAudio.TabIndex = 34; + this.linkLabelCustomAudio.TabIndex = 43; this.linkLabelCustomAudio.TabStop = true; this.linkLabelCustomAudio.Text = "Settings"; this.linkLabelCustomAudio.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelCustomAudio_LinkClicked); @@ -199,7 +182,7 @@ this.checkBoxAudioEncoding.Location = new System.Drawing.Point(32, 401); this.checkBoxAudioEncoding.Name = "checkBoxAudioEncoding"; this.checkBoxAudioEncoding.Size = new System.Drawing.Size(137, 17); - this.checkBoxAudioEncoding.TabIndex = 33; + this.checkBoxAudioEncoding.TabIndex = 42; this.checkBoxAudioEncoding.Text = "Custom audio encoding"; this.checkBoxAudioEncoding.UseVisualStyleBackColor = true; // @@ -213,38 +196,12 @@ this.labelRegion.TabIndex = 32; this.labelRegion.Text = "Region"; // - // nikseComboBoxRegion - // - this.nikseComboBoxRegion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.nikseComboBoxRegion.BackColor = System.Drawing.SystemColors.Window; - this.nikseComboBoxRegion.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); - this.nikseComboBoxRegion.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); - this.nikseComboBoxRegion.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); - this.nikseComboBoxRegion.ButtonForeColor = System.Drawing.SystemColors.ControlText; - this.nikseComboBoxRegion.ButtonForeColorDown = System.Drawing.Color.Orange; - this.nikseComboBoxRegion.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseComboBoxRegion.DropDownHeight = 400; - this.nikseComboBoxRegion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.nikseComboBoxRegion.DropDownWidth = 0; - this.nikseComboBoxRegion.FormattingEnabled = false; - this.nikseComboBoxRegion.Location = new System.Drawing.Point(102, 240); - this.nikseComboBoxRegion.MaxLength = 32767; - this.nikseComboBoxRegion.Name = "nikseComboBoxRegion"; - this.nikseComboBoxRegion.SelectedIndex = -1; - this.nikseComboBoxRegion.SelectedItem = null; - this.nikseComboBoxRegion.SelectedText = ""; - this.nikseComboBoxRegion.Size = new System.Drawing.Size(266, 23); - this.nikseComboBoxRegion.TabIndex = 31; - this.nikseComboBoxRegion.UsePopupWindow = false; - this.nikseComboBoxRegion.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxRegion_SelectedIndexChanged); - // // labelVoiceCount // this.labelVoiceCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.labelVoiceCount.Location = new System.Drawing.Point(268, 83); + this.labelVoiceCount.Location = new System.Drawing.Point(172, 83); this.labelVoiceCount.Name = "labelVoiceCount"; - this.labelVoiceCount.Size = new System.Drawing.Size(100, 23); + this.labelVoiceCount.Size = new System.Drawing.Size(196, 23); this.labelVoiceCount.TabIndex = 29; this.labelVoiceCount.Text = "255"; this.labelVoiceCount.TextAlign = System.Drawing.ContentAlignment.BottomRight; @@ -258,7 +215,7 @@ this.checkBoxShowPreview.Location = new System.Drawing.Point(17, 352); this.checkBoxShowPreview.Name = "checkBoxShowPreview"; this.checkBoxShowPreview.Size = new System.Drawing.Size(115, 17); - this.checkBoxShowPreview.TabIndex = 25; + this.checkBoxShowPreview.TabIndex = 40; this.checkBoxShowPreview.Text = "Review audio clips"; this.checkBoxShowPreview.UseVisualStyleBackColor = true; // @@ -266,34 +223,12 @@ // this.labelApiKey.AutoSize = true; this.labelApiKey.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelApiKey.Location = new System.Drawing.Point(14, 217); + this.labelApiKey.Location = new System.Drawing.Point(14, 216); this.labelApiKey.Name = "labelApiKey"; this.labelApiKey.Size = new System.Drawing.Size(44, 13); this.labelApiKey.TabIndex = 28; this.labelApiKey.Text = "API key"; // - // nikseTextBoxApiKey - // - this.nikseTextBoxApiKey.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.nikseTextBoxApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseTextBoxApiKey.Location = new System.Drawing.Point(102, 214); - this.nikseTextBoxApiKey.Name = "nikseTextBoxApiKey"; - this.nikseTextBoxApiKey.Size = new System.Drawing.Size(266, 20); - this.nikseTextBoxApiKey.TabIndex = 27; - // - // 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, 172); - this.TextBoxTest.Name = "TextBoxTest"; - this.TextBoxTest.Size = new System.Drawing.Size(351, 20); - this.TextBoxTest.TabIndex = 20; - this.TextBoxTest.Text = "Hello, how are you?"; - this.TextBoxTest.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxTest_KeyDown); - // // buttonTestVoice // this.buttonTestVoice.Location = new System.Drawing.Point(17, 141); @@ -313,7 +248,7 @@ this.checkBoxAddToVideoFile.Location = new System.Drawing.Point(17, 376); this.checkBoxAddToVideoFile.Name = "checkBoxAddToVideoFile"; this.checkBoxAddToVideoFile.Size = new System.Drawing.Size(176, 17); - this.checkBoxAddToVideoFile.TabIndex = 26; + this.checkBoxAddToVideoFile.TabIndex = 41; this.checkBoxAddToVideoFile.Text = "Add audio to video file (new file)"; this.checkBoxAddToVideoFile.UseVisualStyleBackColor = true; // @@ -327,32 +262,6 @@ 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.ContextMenuStrip = this.contextMenuStripVoices; - 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, 110); - 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; - // // contextMenuStripVoices // this.contextMenuStripVoices.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -368,33 +277,6 @@ this.refreshVoicesToolStripMenuItem.Text = "Refresh voices"; this.refreshVoicesToolStripMenuItem.Click += new System.EventHandler(this.refreshVoicesToolStripMenuItem_Click); // - // 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; - // // listViewActors // this.listViewActors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -452,6 +334,226 @@ this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // + // nikseUpDownStability + // + this.nikseUpDownStability.BackColor = System.Drawing.SystemColors.Window; + this.nikseUpDownStability.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseUpDownStability.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseUpDownStability.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseUpDownStability.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseUpDownStability.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseUpDownStability.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseUpDownStability.DecimalPlaces = 0; + this.nikseUpDownStability.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nikseUpDownStability.Location = new System.Drawing.Point(102, 270); + this.nikseUpDownStability.Maximum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.nikseUpDownStability.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.nikseUpDownStability.Name = "nikseUpDownStability"; + this.nikseUpDownStability.Size = new System.Drawing.Size(75, 23); + this.nikseUpDownStability.TabIndex = 34; + this.nikseUpDownStability.TabStop = false; + this.nikseUpDownStability.Text = "nikseUpDownStability"; + this.nikseUpDownStability.ThousandsSeparator = false; + this.nikseUpDownStability.Value = new decimal(new int[] { + 0, + 0, + 0, + 0}); + // + // nikseUpDownSimilarity + // + this.nikseUpDownSimilarity.BackColor = System.Drawing.SystemColors.Window; + this.nikseUpDownSimilarity.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseUpDownSimilarity.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseUpDownSimilarity.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseUpDownSimilarity.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseUpDownSimilarity.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseUpDownSimilarity.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseUpDownSimilarity.DecimalPlaces = 0; + this.nikseUpDownSimilarity.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nikseUpDownSimilarity.Location = new System.Drawing.Point(102, 299); + this.nikseUpDownSimilarity.Maximum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.nikseUpDownSimilarity.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.nikseUpDownSimilarity.Name = "nikseUpDownSimilarity"; + this.nikseUpDownSimilarity.Size = new System.Drawing.Size(75, 23); + this.nikseUpDownSimilarity.TabIndex = 35; + this.nikseUpDownSimilarity.TabStop = false; + this.nikseUpDownSimilarity.Text = "nikseUpDownSimilarity"; + this.nikseUpDownSimilarity.ThousandsSeparator = false; + this.nikseUpDownSimilarity.Value = new decimal(new int[] { + 0, + 0, + 0, + 0}); + // + // labelSimilarity + // + this.labelSimilarity.AutoSize = true; + this.labelSimilarity.Location = new System.Drawing.Point(14, 305); + this.labelSimilarity.Name = "labelSimilarity"; + this.labelSimilarity.Size = new System.Drawing.Size(47, 13); + this.labelSimilarity.TabIndex = 99; + this.labelSimilarity.Text = "Similarity"; + // + // labelStability + // + this.labelStability.AutoSize = true; + this.labelStability.Location = new System.Drawing.Point(15, 274); + this.labelStability.Name = "labelStability"; + this.labelStability.Size = new System.Drawing.Size(43, 13); + this.labelStability.TabIndex = 97; + this.labelStability.Text = "Stability"; + // + // nikseComboBoxLanguage + // + this.nikseComboBoxLanguage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.nikseComboBoxLanguage.BackColor = System.Drawing.SystemColors.Window; + this.nikseComboBoxLanguage.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseComboBoxLanguage.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseComboBoxLanguage.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseComboBoxLanguage.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseComboBoxLanguage.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseComboBoxLanguage.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseComboBoxLanguage.DropDownHeight = 400; + this.nikseComboBoxLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.nikseComboBoxLanguage.DropDownWidth = 0; + this.nikseComboBoxLanguage.FormattingEnabled = false; + this.nikseComboBoxLanguage.Location = new System.Drawing.Point(102, 269); + this.nikseComboBoxLanguage.MaxLength = 32767; + this.nikseComboBoxLanguage.Name = "nikseComboBoxLanguage"; + this.nikseComboBoxLanguage.SelectedIndex = -1; + this.nikseComboBoxLanguage.SelectedItem = null; + this.nikseComboBoxLanguage.SelectedText = ""; + this.nikseComboBoxLanguage.Size = new System.Drawing.Size(266, 23); + this.nikseComboBoxLanguage.TabIndex = 35; + this.nikseComboBoxLanguage.UsePopupWindow = false; + // + // nikseComboBoxRegion + // + this.nikseComboBoxRegion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.nikseComboBoxRegion.BackColor = System.Drawing.SystemColors.Window; + this.nikseComboBoxRegion.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseComboBoxRegion.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseComboBoxRegion.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseComboBoxRegion.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseComboBoxRegion.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseComboBoxRegion.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseComboBoxRegion.DropDownHeight = 400; + this.nikseComboBoxRegion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.nikseComboBoxRegion.DropDownWidth = 0; + this.nikseComboBoxRegion.FormattingEnabled = false; + this.nikseComboBoxRegion.Location = new System.Drawing.Point(102, 240); + this.nikseComboBoxRegion.MaxLength = 32767; + this.nikseComboBoxRegion.Name = "nikseComboBoxRegion"; + this.nikseComboBoxRegion.SelectedIndex = -1; + this.nikseComboBoxRegion.SelectedItem = null; + this.nikseComboBoxRegion.SelectedText = ""; + this.nikseComboBoxRegion.Size = new System.Drawing.Size(266, 23); + this.nikseComboBoxRegion.TabIndex = 31; + this.nikseComboBoxRegion.UsePopupWindow = false; + this.nikseComboBoxRegion.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxRegion_SelectedIndexChanged); + // + // nikseTextBoxApiKey + // + this.nikseTextBoxApiKey.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.nikseTextBoxApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseTextBoxApiKey.Location = new System.Drawing.Point(102, 213); + this.nikseTextBoxApiKey.Name = "nikseTextBoxApiKey"; + this.nikseTextBoxApiKey.Size = new System.Drawing.Size(266, 20); + this.nikseTextBoxApiKey.TabIndex = 27; + // + // 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, 172); + this.TextBoxTest.Name = "TextBoxTest"; + this.TextBoxTest.Size = new System.Drawing.Size(351, 20); + this.TextBoxTest.TabIndex = 20; + this.TextBoxTest.Text = "Hello, how are you?"; + this.TextBoxTest.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxTest_KeyDown); + // + // 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.ContextMenuStrip = this.contextMenuStripVoices; + 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, 110); + 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; + // // TextToSpeech // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -517,5 +619,9 @@ private System.Windows.Forms.LinkLabel linkLabelCustomAudio; private System.Windows.Forms.Label labelLanguage; private Controls.NikseComboBox nikseComboBoxLanguage; + private Controls.NikseUpDown nikseUpDownStability; + private Controls.NikseUpDown nikseUpDownSimilarity; + private Controls.NikseLabel labelSimilarity; + private Controls.NikseLabel labelStability; } } \ No newline at end of file diff --git a/src/ui/Forms/Tts/TextToSpeech.cs b/src/ui/Forms/Tts/TextToSpeech.cs index e107a14ec..ae71818e2 100644 --- a/src/ui/Forms/Tts/TextToSpeech.cs +++ b/src/ui/Forms/Tts/TextToSpeech.cs @@ -125,7 +125,9 @@ namespace Nikse.SubtitleEdit.Forms.Tts checkBoxShowPreview.Text = LanguageSettings.Current.TextToSpeech.ReviewAudioClips; checkBoxAudioEncoding.Text = LanguageSettings.Current.TextToSpeech.CustomAudioEncoding; linkLabelCustomAudio.Text = LanguageSettings.Current.Settings.Title; - linkLabelCustomAudio.Left = checkBoxAudioEncoding.Right + 3; + linkLabelCustomAudio.Left = checkBoxAudioEncoding.Right; + labelStability.Text = LanguageSettings.Current.TextToSpeech.Stability; + labelSimilarity.Text = LanguageSettings.Current.TextToSpeech.Similarity; buttonOK.Text = LanguageSettings.Current.General.Ok; buttonCancel.Text = LanguageSettings.Current.General.Cancel; UiUtil.FixLargeFonts(this, buttonOK); @@ -186,6 +188,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts checkBoxShowPreview.Checked = Configuration.Settings.Tools.TextToSpeechPreview; checkBoxAudioEncoding.Checked = Configuration.Settings.Tools.TextToSpeechCustomAudio; checkBoxAddToVideoFile.Enabled = _videoFileName != null; + nikseUpDownStability.Value = (int)Math.Round(Configuration.Settings.Tools.TextToSpeechElevenLabsStability * 100.0); + nikseUpDownSimilarity.Value = (int)Math.Round(Configuration.Settings.Tools.TextToSpeechElevenLabsSimilarity * 100.0); } private void SetActor(ActorAndVoice actor) @@ -220,6 +224,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts private void ButtonGenerateTtsClick(object sender, EventArgs e) { + SaveConfiguration(); + if (buttonGenerateTTS.Text == LanguageSettings.Current.General.Cancel) { buttonGenerateTTS.Enabled = false; @@ -319,7 +325,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts } catch (Exception exception) { - MessageBox.Show("Ups: " + exception.Message + Environment.NewLine + exception.Message); + MessageBox.Show("Oops: " + exception.Message + Environment.NewLine + exception.Message); SeLogger.Error(exception, $"{Text}: Error running engine {nikseComboBoxEngine.Text} with video {_videoFileName}"); } } @@ -1131,7 +1137,9 @@ namespace Nikse.SubtitleEdit.Forms.Tts } } - var data = "{ \"text\": \"" + Json.EncodeJsonText(text) + $"\", \"model_id\": \"{model}\"{language}, \"voice_settings\": {{ \"stability\": 0.8, \"similarity_boost\": 1.0 }} }}"; + var stability = Math.Round(Configuration.Settings.Tools.TextToSpeechElevenLabsStability, 1).ToString(CultureInfo.InvariantCulture); + var similarity = Math.Round(Configuration.Settings.Tools.TextToSpeechElevenLabsSimilarity, 1).ToString(CultureInfo.InvariantCulture); + var data = "{ \"text\": \"" + Json.EncodeJsonText(text) + $"\", \"model_id\": \"{model}\"{language}, \"voice_settings\": {{ \"stability\": {stability}, \"similarity_boost\": {similarity} }} }}"; var content = new StringContent(data, Encoding.UTF8); content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); var result = httpClient.PostAsync(url, content, CancellationToken.None).Result; @@ -1360,6 +1368,11 @@ namespace Nikse.SubtitleEdit.Forms.Tts labelLanguage.Visible = false; nikseComboBoxLanguage.Visible = false; + labelStability.Visible = false; + labelSimilarity.Visible = false; + nikseUpDownStability.Visible = false; + nikseUpDownSimilarity.Visible = false; + labelRegion.Text = LanguageSettings.Current.General.Region; labelVoice.Text = LanguageSettings.Current.TextToSpeech.Voice; if (SubtitleFormatHasActors() && _actors.Any()) @@ -1485,6 +1498,11 @@ namespace Nikse.SubtitleEdit.Forms.Tts } nikseComboBoxRegion.Visible = true; + + labelStability.Visible = true; + labelSimilarity.Visible = true; + nikseUpDownStability.Visible = true; + nikseUpDownSimilarity.Visible = true; } if (engine.Id == TextToSpeechEngineId.AzureTextToSpeech) @@ -1890,15 +1908,15 @@ namespace Nikse.SubtitleEdit.Forms.Tts Directory.CreateDirectory(ttsPath); } - var elevenLabsPath = Path.Combine(ttsPath, "Piper"); - if (!Directory.Exists(elevenLabsPath)) + var piperPath = Path.Combine(ttsPath, "Piper"); + if (!Directory.Exists(piperPath)) { - Directory.CreateDirectory(elevenLabsPath); + Directory.CreateDirectory(piperPath); } var result = new List(); - var jsonFileName = Path.Combine(elevenLabsPath, "voices.json"); + var jsonFileName = Path.Combine(piperPath, "voices.json"); if (!File.Exists(jsonFileName)) { @@ -1915,7 +1933,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts if (!string.IsNullOrEmpty(fileName)) { var name = entry.FilenameInZip; - var path = Path.Combine(elevenLabsPath, name.Replace('/', Path.DirectorySeparatorChar)); + var path = Path.Combine(piperPath, name.Replace('/', Path.DirectorySeparatorChar)); zip.ExtractFile(entry, path); } } @@ -2214,6 +2232,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts private void buttonTestVoice_Click(object sender, EventArgs e) { + SaveConfiguration(); + try { if (string.IsNullOrWhiteSpace(TextBoxTest.Text)) @@ -2230,7 +2250,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts var ok = GenerateParagraphAudio(sub, false, waveFileNameOnly); if (!ok) { - MessageBox.Show(this, "Ups, voice generation failed!"); + MessageBox.Show(this, "Oops, voice generation failed!"); return; } @@ -2266,6 +2286,12 @@ namespace Nikse.SubtitleEdit.Forms.Tts } } + private void SaveConfiguration() + { + Configuration.Settings.Tools.TextToSpeechElevenLabsStability = (double)nikseUpDownStability.Value / 100.0; + Configuration.Settings.Tools.TextToSpeechElevenLabsSimilarity = (double)nikseUpDownSimilarity.Value / 100.0; + } + private void HandleError(Exception ex) { var engine = _engines.First(p => p.Index == nikseComboBoxEngine.SelectedIndex); @@ -2282,6 +2308,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts { var engine = _engines.First(p => p.Index == nikseComboBoxEngine.SelectedIndex); + SaveConfiguration(); + if (engine.Id == TextToSpeechEngineId.ElevenLabs) { Configuration.Settings.Tools.TextToSpeechElevenLabsApiKey = nikseTextBoxApiKey.Text; @@ -2403,6 +2431,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts } else if (engine.Id == TextToSpeechEngineId.ElevenLabs) { + _elevenLabVoices.Clear(); GetElevenLabVoices(false); nikseComboBoxEngine_SelectedIndexChanged(null, null); } diff --git a/src/ui/Languages/it-IT.xml b/src/ui/Languages/it-IT.xml index 2167d381c..60a3bdd05 100644 --- a/src/ui/Languages/it-IT.xml +++ b/src/ui/Languages/it-IT.xml @@ -3,7 +3,7 @@ Subtitle Edit 4.0.8 - Tradotto da NAMP e bovirus - Data traduzione: 09.09.2024 + Tradotto da NAMP e bovirus - Data traduzione: 23.10.2024 it-IT OK @@ -3188,6 +3188,8 @@ Vuoi continuare? Continua automaticamente Rigenera Velocità + Stabilità + Somiglianza Tempistica SMPTE diff --git a/src/ui/Languages/nl-NL.xml b/src/ui/Languages/nl-NL.xml index 32ab9c898..910c03725 100644 --- a/src/ui/Languages/nl-NL.xml +++ b/src/ui/Languages/nl-NL.xml @@ -18,6 +18,7 @@ Voorbeeld Voorbeeld weergeven Voorbeeld verbergen + Ondertitelbestand Ondertitelbestanden Alle bestanden Videobestanden @@ -197,9 +198,6 @@ Is er voldoende beschikbare ruimte op de harde schijf? Engine Website van Vosk Website van Whisper - Whisper niet gevonden. - -Meer informatie online weergeven? Model Modellen Talen en modellen @@ -216,12 +214,14 @@ Meer informatie online weergeven? Batchmodus Gedeeltelijke transcriptie behouden Vertaal naar Engels - Max. tekens per ondertitelregel Tijdelijke bestanden verwijderen Map CPP/Const-me-modellen instellen... Alleen nabewerking uitvoeren/tijden aanpassen cuBLAS en cuDNN voor Faster-Whisper downloaden Geen tekst gevonden! + Hoofdlettergebruik corrigeren + Punten toevoegen + Korte duurtijden corrigeren Advanced Sub Station Alpha-bijlagen @@ -731,6 +731,8 @@ We maken dan handig gebruik van het ritme van het beeld zelf.Kleur kiezen: Totaalaantal seconden: Eindvertraging in seconden: + Woordeffect + Tekeneffect Typemachine-effect @@ -1011,21 +1013,28 @@ We maken dan handig gebruik van het ritme van het beeld zelf.Audio Stereo Preset + Pixelindeling CRF Optimaliseren voor Rechts uitlijnen Beginpositie gebruiken Eindpositie gebruiken + Bron gebruiken + Bronresolutie gebruiken + Uitvoerbestand/-map... Ondertitels toevoegen aan/verwijderen uit videobestand Invoer-videobestand Ondertitels ({0}) Taal instellen... + Taal/titel Geforceerd aan/uit Standaard aan/uit Standaard '{0}' gegenereerd met ingesloten ondertitels + Invoervideobestand na genereren verwijderen + Instellingen voor uitvoerbestandsnaam... Woordenboek nodig? @@ -1052,14 +1061,7 @@ We maken dan handig gebruik van het ritme van het beeld zelf.Naar: Vertalen Dit kan enige tijd duren. Een ogenblik geduld. - Mogelijk gemaakt door Google Vertalen - Mogelijk gemaakt door Microsoft Translator Mogelijk gemaakt door {0} - Voor toegang tot Microsoft Translator is een Cognitive Services ‘Translator Text’-sleutel van Microsoft vereist. - -Open ‘Instellingen -> Voorkeuren -> Extra’ voor meer informatie. - Google Vertalen zonder API-sleutel... (traag en beperkt) - Dienst: Regels samenvoegen: Maximaal twee regels samenvoegen Zinnen samenvoegen @@ -1079,6 +1081,13 @@ Open ‘Instellingen -> Voorkeuren -> Extra’ voor meer informatie.Voor {0} is een API-sleutel vereist. Meer informatie weergeven? Aanspreekvorm + Alleen huidige titel vertalen + Huidige titel opnieuw vertalen + Splitsen/samenvoegen + Vertraging tussen serververzoeken + Maximumaantal bytes per serververzoek + Vragen om {0} + Elke regel afzonderlijk vertalen Vertalen met Google of Microsoft @@ -1437,12 +1446,14 @@ Open ‘Instellingen -> Voorkeuren -> Extra’ voor meer informatie.Lege video genereren... Video met ingebrande ondertiteling genereren... Ondertitels toevoegen aan/verwijderen uit videobestand... + Transparante video met ondertitels genereren... Audio naar tekst ({0})... Hoofdstukken uit video importeren Beeldwissels detecteren/importeren... Beeldwissels verwijderen/exporteren... Golfvormen genereren Golfvorm en spectrogram weergeven/verbergen + Tekst naar spraak en aan video toevoegen... Videovenster ontkoppelen Videovenster koppelen @@ -1600,6 +1611,7 @@ Open ‘Instellingen -> Voorkeuren -> Extra’ voor meer informatie.Naar bronweergave Naar lijstweergave Audio extraheren... + Media-informatie @@ -1636,6 +1648,7 @@ Open ‘Instellingen -> Voorkeuren -> Extra’ voor meer informatie.Er wordt nog getypt... automatisch doorgaan gestopt &Nieuwe ondertitel invoegen Nieuwe ondertitel invoegen (tekstvak niet activeren) + Nieuwe ondertitel invoegen (indien mogelijk) Automatisch Vanaf vlak voor deze &titel afspelen Vanaf begin van video afspelen @@ -2122,6 +2135,10 @@ Indien u dit bestand met Subtitle Edit hebt bewerkt, kunt u een vorige versie vi Even regelnummers Tijdsduur korter dan Tijdsduur langer dan + CPS lager dan + CPS hoger dan + Lengte korter dan + Lengte langer dan Precies één regel Precies twee regels Meer dan twee regels @@ -2527,6 +2544,8 @@ hetzelfde ondertitelbestand bewerken (samenwerken) Alle tekens behalve spaties meetellen CJK 1, Latin 0,5 CJK 1, Latin 0,5, spatie 0 + Inclusief compositietekens + Inclusief compositietekens, zonder spaties Geen spaties of interpunctie ()[]-:;,.!? Geen spaties of interpunctie, alleen voor CPS Vervangend muzieksymbool @@ -2673,6 +2692,8 @@ hetzelfde ondertitelbestand bewerken (samenwerken) Naar vorige beeldwissel Naar volgende beeldwissel Beeldwissel toevoegen/verwijderen + Alle beeldwissels één frame vooruit verplaatsen + Alle beeldwissels één frame achteruit verplaatsen Beeldwissels verwijderen/exporteren Begin automatisch aanpassen aan de hand van volumewijziging/beeldwissel Eén frame terug @@ -3122,6 +3143,9 @@ Probeer het later opnieuw. Hoek Vak voor elke regel (gebruik omtrekkleur) Eén vak (gebruik schaduwkleur) + Vak voor elke regel + Eén vak + Vaktype Dubbele stijlnamen: {0} @@ -3148,6 +3172,25 @@ Probeer het later opnieuw. Eén sync-punt past positie aan, twee of meer sync-punten passen positie én snelheid aan Toepassen + + Tekst naar spraak + Stem + Stem testen + Standaardstem + Audio aan video toevoegen (nieuw bestand) + Spraak genereren + Rechtsklik om acteur aan stem toe te wijzen + Snelheid aanpassen: {0} / {1}... + Audiospoor samenvoegen: {0} / {1}... + Spraak genereren: {0} / {1}... + Audiofragmenten controleren + Aangepaste audiocodering + Audiofragmenten controleren en bewerken/verwijderen + Afspelen + Automatisch doorgaan + Opnieuw genereren + Snelheid + SMPTE-timing SMPTE-timing voor huidige ondertitel gebruiken? @@ -3317,6 +3360,13 @@ Wilt u deze wijzigingen behouden? Items inspecteren Betere overeenkomst toevoegen Toevoegen + Betere multi-overeenkomst toevoegen + Overeenkomst toevoegen of wijzigen + Vorige overeenkomst selecteren + Volgende overeenkomst selecteren + Naar vorige ontbrekende overeenkomst + Naar volgende ontbrekende overeenkomst + Tekstvak activeren Nieuwe map @@ -3369,6 +3419,7 @@ Wilt u deze wijzigingen behouden? Splitsen op cursor Met vorige samenvoegen Met volgende samenvoegen + Whisper uitvoeren op geselecteerde titel... Tot vorige verlengen Tot volgende verlengen Selectie afspelen @@ -3381,6 +3432,7 @@ Wilt u deze wijzigingen behouden? Tijdcodes schatten... Stilte zoeken... Ondertitel hier invoegen + Ondertitelbestand hier invoegen... CPS: {0:0.00} WPM: {0:0.00} @@ -3408,6 +3460,7 @@ Wilt u deze wijzigingen behouden? Waarde van X-TIMESTAMP-MAP-header gebruiken Titels met dezelfde tekst samenvoegen bij inladen + Stijltags samenvoegen WebVTT-stijlen @@ -3416,5 +3469,10 @@ Wilt u deze wijzigingen behouden? Whisper (geavanceerd) – extra opdrachtregelargumenten Extra opdrachtregelargumenten voor Whisper: Let op: de opdrachtregelargumenten kunnen per Whisper-implementatie verschillen! + Standaard + Standaard (Azië) + Huidig woord markeren + Afzonderlijke woorden + Zinnen \ No newline at end of file diff --git a/src/ui/Logic/Language.cs b/src/ui/Logic/Language.cs index 064db57d3..9935e9979 100644 --- a/src/ui/Logic/Language.cs +++ b/src/ui/Logic/Language.cs @@ -3586,6 +3586,8 @@ can edit in same subtitle file (collaboration)", Play = "Play", Regenerate = "Regenerate", Speed = "Speed", + Stability = "Stability", + Similarity = "Similarity", }; TimedTextSmpteTiming = new LanguageStructure.TimedTextSmpteTiming diff --git a/src/ui/Logic/LanguageDeserializer.cs b/src/ui/Logic/LanguageDeserializer.cs index 5362b4996..2b26435d2 100644 --- a/src/ui/Logic/LanguageDeserializer.cs +++ b/src/ui/Logic/LanguageDeserializer.cs @@ -8746,6 +8746,12 @@ namespace Nikse.SubtitleEdit.Logic case "TextToSpeech/Speed": language.TextToSpeech.Speed = reader.Value; break; + case "TextToSpeech/Stability": + language.TextToSpeech.Stability = reader.Value; + break; + case "TextToSpeech/Similarity": + language.TextToSpeech.Similarity = reader.Value; + break; case "TimedTextSmpteTiming/Title": language.TimedTextSmpteTiming.Title = reader.Value; break; diff --git a/src/ui/Logic/LanguageStructure.cs b/src/ui/Logic/LanguageStructure.cs index 080c9c420..f3982b0cd 100644 --- a/src/ui/Logic/LanguageStructure.cs +++ b/src/ui/Logic/LanguageStructure.cs @@ -3397,6 +3397,8 @@ public string AutoContinue { get; set; } public string Regenerate { get; set; } public string Speed { get; set; } + public string Stability { get; set; } + public string Similarity { get; set; } } public class TimedTextSmpteTiming diff --git a/src/ui/Logic/Ocr/Binary/BinaryOcrDb.cs b/src/ui/Logic/Ocr/Binary/BinaryOcrDb.cs index b3925b861..b55877487 100644 --- a/src/ui/Logic/Ocr/Binary/BinaryOcrDb.cs +++ b/src/ui/Logic/Ocr/Binary/BinaryOcrDb.cs @@ -41,7 +41,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary { if (bob.ExpandCount > 0) { - System.Windows.Forms.MessageBox.Show("Ups, expand image in CompareImages!"); + System.Windows.Forms.MessageBox.Show("Oops, expand image in CompareImages!"); } bob.Save(gz); @@ -50,7 +50,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary { if (bob.ExpandCount == 0) { - System.Windows.Forms.MessageBox.Show("Ups, not expanded image in CompareImagesExpanded!"); + System.Windows.Forms.MessageBox.Show("Oops, not expanded image in CompareImagesExpanded!"); } bob.Save(gz); diff --git a/src/ui/Logic/Ocr/MatchesToItalicStringConverter.cs b/src/ui/Logic/Ocr/MatchesToItalicStringConverter.cs index 88da0d687..6afd4d0d7 100644 --- a/src/ui/Logic/Ocr/MatchesToItalicStringConverter.cs +++ b/src/ui/Logic/Ocr/MatchesToItalicStringConverter.cs @@ -50,7 +50,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr text = text.Replace(" ", " "); text = text.Replace(" ", " "); text = text.Replace(" ", " "); - text = text.Replace(" ", " "); + text = text.Replace(" ", " "); text = text.Replace(" ", " "); return text.Trim(); @@ -67,7 +67,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr } var beforeHasLetter = i > 0 && !Separators.Contains(matches[i - 1].Text); - var afterHasLetter = i < matches.Count -1 && !Separators.Contains(matches[i + 1].Text); + var afterHasLetter = i < matches.Count - 1 && !Separators.Contains(matches[i + 1].Text); if (beforeHasLetter || afterHasLetter) { continue;