You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I learned to play a game called "beat the computer". The computer plays a character and I try to say the character before the computer does. I narrow the time down to about 250ms between the computer plays the characters and I speaks the character .
However, It is not possible to set the time to 250ms with the original render.pl because the soundfiles from AWS include a silence. I have solved it by cutting the end of the soundfiles in render.pl like this:
unlink "$output_directory/sentence-lower-volume-$speed.mp3" if (-f "$output_directory/sentence-lower-volume-$speed.mp3");
print "---- move($output_directory/sentence-lower-volume-$speed-resampled.mp3, $cached_filename)\n";
#move("$output_directory/sentence-lower-volume-$speed-resampled.mp3", $cached_filename);
my $temp_filename = "$output_directory/sentence-lower-volume-$speed-resampled-temp.mp3";
move("$output_directory/sentence-lower-volume-$speed-resampled.mp3", $temp_filename);
#STARTS HERE
#Get the total length of the soundfiles with ffprobe
my $ffprobe_cmd = "ffprobe -i $temp_filename -show_entries format=duration -v quiet -of csv=\"p=0\"";
my $duration = `$ffprobe_cmd`;
# Trim the last 350ms off the end of the file with ffmpeg
my $trim_cmd = "ffmpeg -i $temp_filename -ss 0 -t " . ($duration - 0.35) . " -c copy $cached_filename";
system($trim_cmd) == 0 or die "ERROR: $trim_cmd failed, $!\n";
#ENDS HERE
unlink $temp_filename; # Radera temporärfilen
unlink "$output_directory/sentence-${speed}0000.mp3";
}
# generate repeat section if it is different than the sentence
if (!$no_repeat_morse && $word_limit == -1 && ($repeat_part ne $sentence_part || ($character_multiplier ne "1" && $standard_speed_repeat != 0))
&& (!-f $cached_repeat_filename)) {
open(my $fh_repeat, '>', "$output_directory/sentence-repeat.txt");
print $fh_repeat "$repeat_part\n";
close $fh_repeat;
my $ebookCmdBase_for_repeat = $ebookCmdBase;
if($character_multiplier ne "1" && $standard_speed_repeat != 0) {
$ebookCmdBase_for_repeat =~ s/-m \d+//;
This it not a good solution because I set a fixed time of 350ms to cut and I noticed the the silence length after the soundfiles differ depending on what WPM is used. I am not a programmer, but could it be fixed in a better way? That would be very nice! :)
The text was updated successfully, but these errors were encountered:
heppstar
changed the title
Cutting out silence from the soundfiles after each character to make "--sm, --silencemorse" work for lower the 0.1-1s
Cutting out silence from the soundfiles after each character to make "--sm, --silencemorse" work for 0.1-1s
Feb 11, 2024
Hi,
I learned to play a game called "beat the computer". The computer plays a character and I try to say the character before the computer does. I narrow the time down to about 250ms between the computer plays the characters and I speaks the character .
However, It is not possible to set the time to 250ms with the original render.pl because the soundfiles from AWS include a silence. I have solved it by cutting the end of the soundfiles in render.pl like this:
This it not a good solution because I set a fixed time of 350ms to cut and I noticed the the silence length after the soundfiles differ depending on what WPM is used. I am not a programmer, but could it be fixed in a better way? That would be very nice! :)
The text was updated successfully, but these errors were encountered: