From c558f9dd6e303f4cca7b955de5fa4932ffe5f952 Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 19 Dec 2025 04:09:56 +0200 Subject: [PATCH 1/2] romanian tts with polly std/carmen voice. --- README.md | 4 +++- render.pl | 14 +++++++++++--- text2speech.py | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e4fafe6..b6ca221 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,12 @@ you may define AWS_KEY_ID and AWS_SECRET_ACCESS_KEY as environmental variables. perl render.pl -i file [-o directory] [-c directory] [-s speeds] [-p pitch] [-pr] [-m max processes] [-z 1] [-rr 1] [--test] [-l word limit] [--norepeat] [--nospoken] [--nocourtesytone] [-e NEURAL | STANDARD] - [--sm] [--ss] [--sv] [-x] [--lang ENGLISH | SWEDISH] + [--sm] [--ss] [--sv] [-x] [--lang ENGLISH | SWEDISH | ROMANIAN] Uses AWS Polly and requires valid credentials in the aws.properties file.

+For `-l ROMANIAN`, remember to use `-e STANDARD`. Neural languages do not sound as rough as standard ones. + #### OPTIONS: ##### Required: diff --git a/render.pl b/render.pl index 2b65df7..8cfa02c 100755 --- a/render.pl +++ b/render.pl @@ -12,6 +12,7 @@ use Getopt::Long; use Digest::SHA qw(sha256_hex sha256_base64); use POSIX; +use Encode qw(encode_utf8); my @speeds; sub print_usage; @@ -62,7 +63,8 @@ # set default value for speeds here as it is too complex to do it inside the GetOptions call above my $speedSize = @speeds; -@speeds = ($speedSize > 0) ? @speeds : ("15", "17", "20", "22", "25", "28", "30", "35", "40", "45", "50"); + @speeds = ($speedSize > 0) ? @speeds : ("15", "17", "20", "22", "25", "28", "30", "32", "35", "40", "45", "50"); +#@speeds = ($speedSize > 0) ? @speeds : ("15", "20"); if (! -d "$output_directory") { mkdir "$output_directory"; @@ -83,6 +85,10 @@ $lower_lang_chars_regex = "a-züäöß"; $upper_lang_chars_regex = "A-ZÜÄÖß"; } +if($lang eq "ROMANIAN") { + $lower_lang_chars_regex = "a-zâăîșț"; + $upper_lang_chars_regex = "A-ZÂĂÎȘȚ"; +} binmode(STDOUT, ":encoding(UTF-8)"); @@ -408,7 +414,8 @@ sub split_on_spoken_directive { $cached_filename = "${lang}-standard-"; } - $cached_filename .= $text_to_speech_engine . "-" . sha256_hex($sentence) . ".mp3"; + use Encode qw(encode_utf8); + $cached_filename .= $text_to_speech_engine . "-" . sha256_hex(encode_utf8($sentence)) . ".mp3"; $cached_filename = $cache_directory . $cached_filename; return $cached_filename; @@ -581,7 +588,8 @@ sub split_on_spoken_directive { sub get_cached_filename { my ($ebookCmdBase, $morse_text) = @_; - my $cached_file_hash = sha256_base64($ebookCmdBase . $morse_text); + use Encode qw(encode_utf8); + my $cached_file_hash = sha256_base64(encode_utf8($ebookCmdBase . $morse_text)); $cached_file_hash =~ s/\///g; my $cached_file = $cached_file_hash . ".mp3"; diff --git a/text2speech.py b/text2speech.py index 85f082a..44eb6c0 100755 --- a/text2speech.py +++ b/text2speech.py @@ -117,6 +117,9 @@ def render(cache_filename, voice_id, text_type, text): if language == "GERMAN": voice_id = "Vicki" + if language == "ROMANIAN": + voice_id = "Carmen" + print("Using Voice: " + voice_id) cache_filename = cache_directory + language + "-standard-" + base_filename render(cache_filename, voice_id=voice_id, text_type=None, text=sentence) From 5d76094cbf55f73120ce8412f3f3e66efe11dc18 Mon Sep 17 00:00:00 2001 From: Richard Date: Fri, 19 Dec 2025 04:11:27 +0200 Subject: [PATCH 2/2] romanian tts with polly std/carmen voice. --- render.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/render.pl b/render.pl index 8cfa02c..8a91f68 100755 --- a/render.pl +++ b/render.pl @@ -63,8 +63,7 @@ # set default value for speeds here as it is too complex to do it inside the GetOptions call above my $speedSize = @speeds; - @speeds = ($speedSize > 0) ? @speeds : ("15", "17", "20", "22", "25", "28", "30", "32", "35", "40", "45", "50"); -#@speeds = ($speedSize > 0) ? @speeds : ("15", "20"); +@speeds = ($speedSize > 0) ? @speeds : ("15", "17", "20", "22", "25", "28", "30", "35", "40", "45", "50"); if (! -d "$output_directory") { mkdir "$output_directory";