Skip to content

Commit

Permalink
Work on tts
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolajolsson committed Apr 12, 2024
1 parent be01dac commit c0ed5ac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/libse/TextToSpeech/PiperModels.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;

namespace Nikse.SubtitleEdit.Core.TextToSpeech
Expand Down
6 changes: 6 additions & 0 deletions src/ui/Forms/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19032,6 +19032,12 @@ internal void MainKeyDown(object sender, KeyEventArgs e)

TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(25), () =>
{
if (string.IsNullOrEmpty(_videoFileName) || _videoInfo == null)
{
MessageBox.Show(LanguageSettings.Current.General.NoVideoLoaded);
return;
}

if (RequireFfmpegOk())
{
using (var form = new TextToSpeech(_subtitle, GetCurrentSubtitleFormat(), _videoFileName, _videoInfo))
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Forms/Tts/TextToSpeech.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private List<string> FixParagraphAudioSpeed()
var next = _subtitle.GetParagraphOrDefault(index + 1);
var pFileName = Path.Combine(_waveFolder, index + ".wav");

//TODO: analyse audio and remove silence at start and end (ffmpeg -af silenceremove=1:0:-50dB:1:1:-50dB)
//TODO: analyse audio and remove silence at start and end (ffmpeg -af silenceremove=1:0:-5dB:1:1:-5dB)
var outputFileName1 = Path.Combine(_waveFolder, index + "_u.wav");
var trimProcess = VideoPreviewGenerator.TrimSilenceStartAndEnd(pFileName, outputFileName1);
trimProcess.Start();
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Logic/VideoPreviewGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ public static Process TrimSilenceStartAndEnd(string inputFileName, string output
StartInfo =
{
FileName = GetFfmpegLocation(),
Arguments = $"-i \"{inputFileName}\" -af silenceremove=start_periods=1:start_silence=0.01,areverse,silenceremove=start_periods=1:start_silence=0.01,areverse \"{outputFileName}\"",
Arguments = $"-i \"{inputFileName}\" -af \"areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0.1:start_threshold=0.01,areverse,atrim=start=0,silenceremove=start_periods=1:start_silence=0.1:start_threshold=0.01\" \"{outputFileName}\"",
UseShellExecute = false,
CreateNoWindow = true
}
Expand Down

0 comments on commit c0ed5ac

Please sign in to comment.