This commit is contained in:
nikolaj.olsson 2024-10-23 13:18:43 +02:00
commit 95c12f5e03
32 changed files with 585 additions and 246 deletions

View File

@ -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)

View File

@ -2435,6 +2435,7 @@
<Word from="spasli" to="spasili" />
<Word from="spavaćeš" to="spavat ćeš" />
<Word from="spavaćete" to="spavat ćete" />
<Word from="Spavaću" to="Spavat ću" />
<Word from="speluje" to="sriče" />
<Word from="speluju" to="sriču" />
<Word from="spelujte" to="sričite" />
@ -4007,6 +4008,8 @@
<LinePart from="bez svesti" to="bez svijesti" />
<LinePart from="Bez obzira što" to="Bez obzira na to što" />
<LinePart from="bez obzira što" to="bez obzira na to što" />
<LinePart from="Biću dobro" to="Bit ću dobro" />
<LinePart from="Biće u redu" to="Bit će u redu" />
<LinePart from="biću iskren" to="bit ću iskren" />
<LinePart from="Biće mi" to="Bit će mi" />
<LinePart from="Biće on" to="Bit će on" />
@ -5575,6 +5578,7 @@
<RegEx find="oslj?ep" replaceWith="oslijep" />
<RegEx find="sj?etić" replaceWith="sjetit ć" />
<RegEx find="osb" replaceWith="osob" />
<RegEx find="oskb" replaceWith="osob" />
<RegEx find="ot[čć]i" replaceWith="odči" />
<RegEx find="otse" replaceWith="odsje" />
<RegEx find="otstak" replaceWith="otak" />
@ -5825,6 +5829,7 @@
<RegEx find="vsj" replaceWith="vaj" />
<RegEx find="vsn" replaceWith="van" />
<RegEx find="([zZ])amenit" replaceWith="$1amijenit" />
<RegEx find="zamjs" replaceWith="zmajs" />
<RegEx find="zankin" replaceWith="zank" />
<RegEx find="zanš" replaceWith="znaš" />
<RegEx find="zaklać" replaceWith="zaklat ć" />
@ -5843,9 +5848,7 @@
<RegEx find="(?&lt;![Oo]bra|o)zova([lton])" replaceWith="zira$1" />
<RegEx find="zpr" replaceWith="spr" />
<RegEx find="zref" replaceWith="zrel" />
<RegEx find="zsk" replaceWith="zak" />
<RegEx find="zsn" replaceWith="zan" />
<RegEx find="zsp" replaceWith="zap" />
<RegEx find="zs([kgnp])" replaceWith="za$1" />
<RegEx find="zqp" replaceWith="zap" />
<RegEx find="zuslov" replaceWith="zuvjet" />
<RegEx find="zvešć" replaceWith="zvest ć" />

View File

@ -3188,6 +3188,8 @@ Continue?</RestoreDefaultSettingsMsg>
<AutoContinue>Auto-continue</AutoContinue>
<Regenerate>Regenerate</Regenerate>
<Speed>Speed</Speed>
<Stability>Stability</Stability>
<Similarity>Similarity</Similarity>
</TextToSpeech>
<TimedTextSmpteTiming>
<Title>SMPTE timing</Title>

View File

@ -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
{

View File

@ -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
{
/// <summary>
/// DeepLX translator - see https://github.com/OwO-Network/DeepLX
/// </summary>
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<TranslationPair> GetSupportedSourceLanguages()
{
return new DeepLTranslate().GetSupportedSourceLanguages();
}
public List<TranslationPair> GetSupportedTargetLanguages()
{
return new DeepLTranslate().GetSupportedTargetLanguages();
}
public Task<string> Translate(string text, string sourceLanguageCode, string targetLanguageCode, CancellationToken cancellationToken)
{
var postContent = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("text", text),
new KeyValuePair<string, string>("target_lang", targetLanguageCode),
new KeyValuePair<string, string>("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<string>();
var parser = new JsonParser();
var x = (Dictionary<string, object>)parser.Parse(resultContent);
foreach (var k in x.Keys)
{
if (x[k] is List<object> mainList)
{
foreach (var mainListItem in mainList)
{
if (mainListItem is Dictionary<string, object> 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));
}
}
}

View File

@ -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)
{

View File

@ -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

View File

@ -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);

View File

@ -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));

View File

@ -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;

View File

@ -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)));
}
}

View File

@ -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)

View File

@ -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

View File

@ -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}";

View File

@ -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<string> lines, string fileName)

View File

@ -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)));
}
}

View File

@ -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}");
}

View File

@ -610,6 +610,7 @@ namespace Nikse.SubtitleEdit.Forms
listView1.Select();
AcceptButton = buttonNextFinish;
textBoxListViewText.AcceptsReturn = true;
}
private void FixLargeFonts()

View File

@ -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);
}

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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<string>
{
Configuration.Settings.Tools.AutoTranslateDeepLXUrl,
});
return;
}
if (engineType == typeof(NoLanguageLeftBehindServe))
{
FillUrls(new List<string>
@ -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;

View File

@ -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;
}
}

View File

@ -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<PiperModel>();
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);
}

View File

@ -3,7 +3,7 @@
<General>
<Title>Subtitle Edit</Title>
<Version>4.0.8</Version>
<TranslatedBy>Tradotto da NAMP e bovirus - Data traduzione: 09.09.2024</TranslatedBy>
<TranslatedBy>Tradotto da NAMP e bovirus - Data traduzione: 23.10.2024</TranslatedBy>
<CultureName>it-IT</CultureName>
<HelpFile />
<Ok>OK</Ok>
@ -3188,6 +3188,8 @@ Vuoi continuare?</RestoreDefaultSettingsMsg>
<AutoContinue>Continua automaticamente</AutoContinue>
<Regenerate>Rigenera</Regenerate>
<Speed>Velocità</Speed>
<Stability>Stabilità</Stability>
<Similarity>Somiglianza</Similarity>
</TextToSpeech>
<TimedTextSmpteTiming>
<Title>Tempistica SMPTE</Title>

View File

@ -18,6 +18,7 @@
<Preview>Voorbeeld</Preview>
<ShowPreview>Voorbeeld weergeven</ShowPreview>
<HidePreview>Voorbeeld verbergen</HidePreview>
<SubtitleFile>Ondertitelbestand</SubtitleFile>
<SubtitleFiles>Ondertitelbestanden</SubtitleFiles>
<AllFiles>Alle bestanden</AllFiles>
<VideoFiles>Videobestanden</VideoFiles>
@ -197,9 +198,6 @@ Is er voldoende beschikbare ruimte op de harde schijf?</WaveFileMalformed>
<Engine>Engine</Engine>
<VoskWebsite>Website van Vosk</VoskWebsite>
<WhisperWebsite>Website van Whisper</WhisperWebsite>
<WhisperNotFound>Whisper niet gevonden.
Meer informatie online weergeven?</WhisperNotFound>
<Model>Model</Model>
<Models>Modellen</Models>
<LanguagesAndModels>Talen en modellen</LanguagesAndModels>
@ -216,12 +214,14 @@ Meer informatie online weergeven?</WhisperNotFound>
<BatchMode>Batchmodus</BatchMode>
<KeepPartialTranscription>Gedeeltelijke transcriptie behouden</KeepPartialTranscription>
<TranslateToEnglish>Vertaal naar Engels</TranslateToEnglish>
<MaxCharsPerSubtitle>Max. tekens per ondertitelregel</MaxCharsPerSubtitle>
<RemoveTemporaryFiles>Tijdelijke bestanden verwijderen</RemoveTemporaryFiles>
<SetCppConstMeFolder>Map CPP/Const-me-modellen instellen...</SetCppConstMeFolder>
<OnlyRunPostProcessing>Alleen nabewerking uitvoeren/tijden aanpassen</OnlyRunPostProcessing>
<DownloadFasterWhisperCuda>cuBLAS en cuDNN voor Faster-Whisper downloaden</DownloadFasterWhisperCuda>
<NoTextFound>Geen tekst gevonden!</NoTextFound>
<FixCasing>Hoofdlettergebruik corrigeren</FixCasing>
<AddPeriods>Punten toevoegen</AddPeriods>
<FixShortDuration>Korte duurtijden corrigeren</FixShortDuration>
</AudioToText>
<AssaAttachments>
<Title>Advanced Sub Station Alpha-bijlagen</Title>
@ -731,6 +731,8 @@ We maken dan handig gebruik van het ritme van het beeld zelf.</CreateSimpleChain
<ChooseColor>Kleur kiezen:</ChooseColor>
<TotalSeconds>Totaalaantal seconden:</TotalSeconds>
<EndDelayInSeconds>Eindvertraging in seconden:</EndDelayInSeconds>
<WordEffect>Woordeffect</WordEffect>
<CharacterEffect>Tekeneffect</CharacterEffect>
</EffectKaraoke>
<EffectTypewriter>
<Title>Typemachine-effect</Title>
@ -1011,21 +1013,28 @@ We maken dan handig gebruik van het ritme van het beeld zelf.</CreateSimpleChain
<Audio>Audio</Audio>
<Stereo>Stereo</Stereo>
<Preset>Preset</Preset>
<PixelFormat>Pixelindeling</PixelFormat>
<Crf>CRF</Crf>
<TuneFor>Optimaliseren voor</TuneFor>
<AlignRight>Rechts uitlijnen</AlignRight>
<GetStartPosition>Beginpositie gebruiken</GetStartPosition>
<GetEndPosition>Eindpositie gebruiken</GetEndPosition>
<UseSource>Bron gebruiken</UseSource>
<UseSourceResolution>Bronresolutie gebruiken</UseSourceResolution>
<OutputSettings>Uitvoerbestand/-map...</OutputSettings>
</GenerateVideoWithBurnedInSubs>
<GenerateVideoWithEmbeddedSubs>
<Title>Ondertitels toevoegen aan/verwijderen uit videobestand</Title>
<InputVideoFile>Invoer-videobestand</InputVideoFile>
<SubtitlesX>Ondertitels ({0})</SubtitlesX>
<SetLanguage>Taal instellen...</SetLanguage>
<LanguageAndTitle>Taal/titel</LanguageAndTitle>
<ToggleForced>Geforceerd aan/uit</ToggleForced>
<ToggleDefault>Standaard aan/uit</ToggleDefault>
<Default>Standaard</Default>
<XGeneratedWithEmbeddedSubs>'{0}' gegenereerd met ingesloten ondertitels</XGeneratedWithEmbeddedSubs>
<DeleteInputVideo>Invoervideobestand na genereren verwijderen</DeleteInputVideo>
<OutputFileNameSettings>Instellingen voor uitvoerbestandsnaam...</OutputFileNameSettings>
</GenerateVideoWithEmbeddedSubs>
<GetDictionaries>
<Title>Woordenboek nodig?</Title>
@ -1052,14 +1061,7 @@ We maken dan handig gebruik van het ritme van het beeld zelf.</CreateSimpleChain
<To>Naar:</To>
<Translate>Vertalen</Translate>
<PleaseWait>Dit kan enige tijd duren. Een ogenblik geduld.</PleaseWait>
<PoweredByGoogleTranslate>Mogelijk gemaakt door Google Vertalen</PoweredByGoogleTranslate>
<PoweredByMicrosoftTranslate>Mogelijk gemaakt door Microsoft Translator</PoweredByMicrosoftTranslate>
<PoweredByX>Mogelijk gemaakt door {0}</PoweredByX>
<MsClientSecretNeeded>Voor toegang tot Microsoft Translator is een Cognitive Services Translator Text-sleutel van Microsoft vereist.
Open Instellingen -&gt; Voorkeuren -&gt; Extra voor meer informatie.</MsClientSecretNeeded>
<GoogleNoApiKeyWarning>Google Vertalen zonder API-sleutel... (traag en beperkt)</GoogleNoApiKeyWarning>
<Service>Dienst:</Service>
<LineMergeHandling>Regels samenvoegen:</LineMergeHandling>
<ProcessorMergeNext>Maximaal twee regels samenvoegen</ProcessorMergeNext>
<ProcessorSentence>Zinnen samenvoegen</ProcessorSentence>
@ -1079,6 +1081,13 @@ Open Instellingen -&gt; Voorkeuren -&gt; Extra voor meer informatie.</MsCl
<XRequiresAnApiKey>Voor {0} is een API-sleutel vereist.</XRequiresAnApiKey>
<ReadMore>Meer informatie weergeven?</ReadMore>
<Formality>Aanspreekvorm</Formality>
<TranslateCurrentLine>Alleen huidige titel vertalen</TranslateCurrentLine>
<ReTranslateCurrentLine>Huidige titel opnieuw vertalen</ReTranslateCurrentLine>
<MergeSplitStrategy>Splitsen/samenvoegen</MergeSplitStrategy>
<Delay>Vertraging tussen serververzoeken</Delay>
<MaxBytes>Maximumaantal bytes per serververzoek</MaxBytes>
<PromptX>Vragen om {0}</PromptX>
<TranslateLinesSeparately>Elke regel afzonderlijk vertalen</TranslateLinesSeparately>
</GoogleTranslate>
<GoogleOrMicrosoftTranslate>
<Title>Vertalen met Google of Microsoft</Title>
@ -1437,12 +1446,14 @@ Open Instellingen -&gt; Voorkeuren -&gt; Extra voor meer informatie.</MsCl
<GenerateBlankVideo>Lege video genereren...</GenerateBlankVideo>
<GenerateVideoWithBurnedInSub>Video met ingebrande ondertiteling genereren...</GenerateVideoWithBurnedInSub>
<GenerateVideoWithEmbeddedSubs>Ondertitels toevoegen aan/verwijderen uit videobestand...</GenerateVideoWithEmbeddedSubs>
<GenerateTransparentVideoWithSubs>Transparante video met ondertitels genereren...</GenerateTransparentVideoWithSubs>
<VideoAudioToTextX>Audio naar tekst ({0})...</VideoAudioToTextX>
<ImportChaptersFromVideo>Hoofdstukken uit video importeren</ImportChaptersFromVideo>
<GenerateImportShotChanges>Beeldwissels detecteren/importeren...</GenerateImportShotChanges>
<RemoveOrExportShotChanges>Beeldwissels verwijderen/exporteren...</RemoveOrExportShotChanges>
<WaveformBatchGenerate>Golfvormen genereren</WaveformBatchGenerate>
<ShowHideWaveformAndSpectrogram>Golfvorm en spectrogram weergeven/verbergen</ShowHideWaveformAndSpectrogram>
<TextToSpeechAndAddToVideo>Tekst naar spraak en aan video toevoegen...</TextToSpeechAndAddToVideo>
<UnDockVideoControls>Videovenster ontkoppelen</UnDockVideoControls>
<ReDockVideoControls>Videovenster koppelen</ReDockVideoControls>
</Video>
@ -1600,6 +1611,7 @@ Open Instellingen -&gt; Voorkeuren -&gt; Extra voor meer informatie.</MsCl
<GoToSourceView>Naar bronweergave</GoToSourceView>
<GoToListView>Naar lijstweergave</GoToListView>
<ExtractAudio>Audio extraheren...</ExtractAudio>
<MediaInfo>Media-informatie</MediaInfo>
</ContextMenu>
</Menu>
<Controls>
@ -1636,6 +1648,7 @@ Open Instellingen -&gt; Voorkeuren -&gt; Extra voor meer informatie.</MsCl
<StillTypingAutoContinueStopped>Er wordt nog getypt... automatisch doorgaan gestopt</StillTypingAutoContinueStopped>
<InsertNewSubtitleAtVideoPosition>&amp;Nieuwe ondertitel invoegen</InsertNewSubtitleAtVideoPosition>
<InsertNewSubtitleAtVideoPositionNoTextBoxFocus>Nieuwe ondertitel invoegen (tekstvak niet activeren)</InsertNewSubtitleAtVideoPositionNoTextBoxFocus>
<InsertNewSubtitleAtVideoPositionMax>Nieuwe ondertitel invoegen (indien mogelijk)</InsertNewSubtitleAtVideoPositionMax>
<Auto>Automatisch</Auto>
<PlayFromJustBeforeText>Vanaf vlak voor deze &amp;titel afspelen</PlayFromJustBeforeText>
<PlayFromBeginning>Vanaf begin van video afspelen</PlayFromBeginning>
@ -2122,6 +2135,10 @@ Indien u dit bestand met Subtitle Edit hebt bewerkt, kunt u een vorige versie vi
<EvenLines>Even regelnummers</EvenLines>
<DurationLessThan>Tijdsduur korter dan</DurationLessThan>
<DurationGreaterThan>Tijdsduur langer dan</DurationGreaterThan>
<CpsLessThan>CPS lager dan</CpsLessThan>
<CpsGreaterThan>CPS hoger dan</CpsGreaterThan>
<LengthLessThan>Lengte korter dan</LengthLessThan>
<LengthGreaterThan>Lengte langer dan</LengthGreaterThan>
<ExactlyOneLine>Precies één regel</ExactlyOneLine>
<ExactlyTwoLines>Precies twee regels</ExactlyTwoLines>
<MoreThanTwoLines>Meer dan twee regels</MoreThanTwoLines>
@ -2527,6 +2544,8 @@ hetzelfde ondertitelbestand bewerken (samenwerken)</Information>
<CpsLineLengthStyleCalcNoSpace>Alle tekens behalve spaties meetellen</CpsLineLengthStyleCalcNoSpace>
<CpsLineLengthStyleCalcCjk>CJK 1, Latin 0,5</CpsLineLengthStyleCalcCjk>
<CpsLineLengthStyleCalcCjkNoSpace>CJK 1, Latin 0,5, spatie 0</CpsLineLengthStyleCalcCjkNoSpace>
<CpsLineLengthStyleCalcIncludeCompositionCharacters>Inclusief compositietekens</CpsLineLengthStyleCalcIncludeCompositionCharacters>
<CpsLineLengthStyleCalcIncludeCompositionCharactersNotSpace>Inclusief compositietekens, zonder spaties</CpsLineLengthStyleCalcIncludeCompositionCharactersNotSpace>
<CpsLineLengthStyleCalcNoSpaceOrPunctuation>Geen spaties of interpunctie ()[]-:;,.!?</CpsLineLengthStyleCalcNoSpaceOrPunctuation>
<CpsLineLengthStyleCalcNoSpaceOrPunctuationCpsOnly>Geen spaties of interpunctie, alleen voor CPS</CpsLineLengthStyleCalcNoSpaceOrPunctuationCpsOnly>
<MusicSymbol>Vervangend muzieksymbool</MusicSymbol>
@ -2673,6 +2692,8 @@ hetzelfde ondertitelbestand bewerken (samenwerken)</Information>
<WaveformGoToPreviousShotChange>Naar vorige beeldwissel</WaveformGoToPreviousShotChange>
<WaveformGoToNextShotChange>Naar volgende beeldwissel</WaveformGoToNextShotChange>
<WaveformToggleShotChange>Beeldwissel toevoegen/verwijderen</WaveformToggleShotChange>
<WaveformAllShotChangesOneFrameForward>Alle beeldwissels één frame vooruit verplaatsen</WaveformAllShotChangesOneFrameForward>
<WaveformAllShotChangesOneFrameBack>Alle beeldwissels één frame achteruit verplaatsen</WaveformAllShotChangesOneFrameBack>
<WaveformRemoveOrExportShotChanges>Beeldwissels verwijderen/exporteren</WaveformRemoveOrExportShotChanges>
<WaveformGuessStart>Begin automatisch aanpassen aan de hand van volumewijziging/beeldwissel</WaveformGuessStart>
<GoBack1Frame>Eén frame terug</GoBack1Frame>
@ -3122,6 +3143,9 @@ Probeer het later opnieuw.</XDownloadFailed>
<Angle>Hoek</Angle>
<BoxPerLine>Vak voor elke regel (gebruik omtrekkleur)</BoxPerLine>
<BoxMultiLine>Eén vak (gebruik schaduwkleur)</BoxMultiLine>
<BoxPerLineShort>Vak voor elke regel</BoxPerLineShort>
<BoxMultiLineShort>Eén vak</BoxMultiLineShort>
<BoxType>Vaktype</BoxType>
<DuplicateStyleNames>Dubbele stijlnamen: {0}</DuplicateStyleNames>
</SubStationAlphaStyles>
<SubStationAlphaStylesCategoriesManager>
@ -3148,6 +3172,25 @@ Probeer het later opnieuw.</XDownloadFailed>
<Info>Eén sync-punt past positie aan, twee of meer sync-punten passen positie én snelheid aan</Info>
<ApplySync>Toepassen</ApplySync>
</PointSync>
<TextToSpeech>
<Title>Tekst naar spraak</Title>
<Voice>Stem</Voice>
<TestVoice>Stem testen</TestVoice>
<DefaultVoice>Standaardstem</DefaultVoice>
<AddAudioToVideo>Audio aan video toevoegen (nieuw bestand)</AddAudioToVideo>
<GenerateSpeech>Spraak genereren</GenerateSpeech>
<ActorInfo>Rechtsklik om acteur aan stem toe te wijzen</ActorInfo>
<AdjustingSpeedXOfY>Snelheid aanpassen: {0} / {1}...</AdjustingSpeedXOfY>
<MergingAudioTrackXOfY>Audiospoor samenvoegen: {0} / {1}...</MergingAudioTrackXOfY>
<GeneratingSpeechFromTextXOfY>Spraak genereren: {0} / {1}...</GeneratingSpeechFromTextXOfY>
<ReviewAudioClips>Audiofragmenten controleren</ReviewAudioClips>
<CustomAudioEncoding>Aangepaste audiocodering</CustomAudioEncoding>
<ReviewInfo>Audiofragmenten controleren en bewerken/verwijderen</ReviewInfo>
<Play>Afspelen</Play>
<AutoContinue>Automatisch doorgaan</AutoContinue>
<Regenerate>Opnieuw genereren</Regenerate>
<Speed>Snelheid</Speed>
</TextToSpeech>
<TimedTextSmpteTiming>
<Title>SMPTE-timing</Title>
<UseSmpteTiming>SMPTE-timing voor huidige ondertitel gebruiken?</UseSmpteTiming>
@ -3317,6 +3360,13 @@ Wilt u deze wijzigingen behouden?</KeepChangesMessage>
<InspectItems>Items inspecteren</InspectItems>
<AddBetterMatch>Betere overeenkomst toevoegen</AddBetterMatch>
<Add>Toevoegen</Add>
<AddBetterMultiMatch>Betere multi-overeenkomst toevoegen</AddBetterMultiMatch>
<AddOrUpdateMatch>Overeenkomst toevoegen of wijzigen</AddOrUpdateMatch>
<SelectPrevousMatch>Vorige overeenkomst selecteren</SelectPrevousMatch>
<SelectNextMatch>Volgende overeenkomst selecteren</SelectNextMatch>
<JumpPreviousMissingMatch>Naar vorige ontbrekende overeenkomst</JumpPreviousMissingMatch>
<JumpNextMissingMatch>Naar volgende ontbrekende overeenkomst</JumpNextMissingMatch>
<FocusTextbox>Tekstvak activeren</FocusTextbox>
</VobSubOcrCharacterInspect>
<VobSubOcrNewFolder>
<Title>Nieuwe map</Title>
@ -3369,6 +3419,7 @@ Wilt u deze wijzigingen behouden?</KeepChangesMessage>
<SplitAtCursor>Splitsen op cursor</SplitAtCursor>
<MergeWithPrevious>Met vorige samenvoegen</MergeWithPrevious>
<MergeWithNext>Met volgende samenvoegen</MergeWithNext>
<RunWhisperSelectedParagraph>Whisper uitvoeren op geselecteerde titel...</RunWhisperSelectedParagraph>
<ExtendToPrevious>Tot vorige verlengen</ExtendToPrevious>
<ExtendToNext>Tot volgende verlengen</ExtendToNext>
<PlaySelection>Selectie afspelen</PlaySelection>
@ -3381,6 +3432,7 @@ Wilt u deze wijzigingen behouden?</KeepChangesMessage>
<GuessTimeCodes>Tijdcodes schatten...</GuessTimeCodes>
<SeekSilence>Stilte zoeken...</SeekSilence>
<InsertSubtitleHere>Ondertitel hier invoegen</InsertSubtitleHere>
<InsertSubtitleFileHere>Ondertitelbestand hier invoegen...</InsertSubtitleFileHere>
<CharsSecX>CPS: {0:0.00}</CharsSecX>
<WordsMinX>WPM: {0:0.00}</WordsMinX>
</Waveform>
@ -3408,6 +3460,7 @@ Wilt u deze wijzigingen behouden?</KeepChangesMessage>
<WebVttProperties>
<UseXTimeStamp>Waarde van X-TIMESTAMP-MAP-header gebruiken</UseXTimeStamp>
<MergeLines>Titels met dezelfde tekst samenvoegen bij inladen</MergeLines>
<MergeStyleTags>Stijltags samenvoegen</MergeStyleTags>
</WebVttProperties>
<WebVttStyleManager>
<Title>WebVTT-stijlen</Title>
@ -3416,5 +3469,10 @@ Wilt u deze wijzigingen behouden?</KeepChangesMessage>
<Title>Whisper (geavanceerd) extra opdrachtregelargumenten</Title>
<CommandLineArguments>Extra opdrachtregelargumenten voor Whisper:</CommandLineArguments>
<Info>Let op: de opdrachtregelargumenten kunnen per Whisper-implementatie verschillen!</Info>
<Standard>Standaard</Standard>
<StandardAsia>Standaard (Azië)</StandardAsia>
<HighlightCurrentWord>Huidig woord markeren</HighlightCurrentWord>
<SingleWords>Afzonderlijke woorden</SingleWords>
<Sentence>Zinnen</Sentence>
</WhisperAdvanced>
</Language>

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -50,7 +50,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
text = text.Replace(" ", " ");
text = text.Replace("<i> ", " <i>");
text = text.Replace(" </i>", "</i> ");
text = text.Replace("</i> <i>", " ");
text = text.Replace("</i> <i>", " ");
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;