From 119011731471244c54f1bf632e19e149a978a86b Mon Sep 17 00:00:00 2001 From: Alexei Bezborodov Date: Wed, 3 Jan 2024 16:25:32 +0300 Subject: [PATCH] txt2mp3 parametrs --- Script/txt3mp3_by_yatts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Script/txt3mp3_by_yatts b/Script/txt3mp3_by_yatts index fcf3289..a9634e3 100755 --- a/Script/txt3mp3_by_yatts +++ b/Script/txt3mp3_by_yatts @@ -1,5 +1,11 @@ #!/bin/bash # Озвучивание русского текста из файла +# Параметры +emotion='neutral' #'Default is neutral. Also supported are good (friendly) and evil (angry)' +speaker='ermil' # (Optional): Speaker voice. Default is zahar. Supported female voices are jane, oksana, alyss, omazh and male voices are zahar and ermil. +#["oksana","jane","omazh","zahar","ermil","silaerkan","erkanyavas","alyss", "nick","alena","filipp"] +speed='1.0' + input_file_name="$1" source_text=$(cat "${input_file_name}") @@ -23,7 +29,7 @@ file_index=0 for ((i=1;i<=${#source_text};i++)); do cur_char=${source_text:$i-1:1} cur_text="${cur_text}${cur_char}" - if [ "$cur_char" = "$space_char" ] && [ ${#cur_text} -ge $split_size ]; then + if [ "$cur_char" = "$space_char" ] && [ ${#cur_text} -ge $split_size ] || [ $i = ${#source_text} ]; then let file_index+=1 echo "Часть номер $file_index" @@ -35,11 +41,11 @@ for ((i=1;i<=${#source_text};i++)); do # Максимальная длина текста = 1590 - 75 = 1515 символов text_count=$(echo "$cur_text" | wc -m) [ $text_count -ge 1515 ] && { echo "Превышено максимальное колличество символов - 1515"; exit; } - + audio_file_name="${input_file_name}_${file_index}.mp3" echo -en "\nЗагрузка аудио в файл '$audio_file_name'...\n" #touch "$audio_file_name" - wget -q -O "$audio_file_name" "http://tts.voicetech.yandex.net/tts?format=mp3&quality=hi&lang=ru_RU&text=${cur_text}" || { echo "Ошибка при загрузке аудио."; exit; } + wget -q -O "$audio_file_name" "http://tts.voicetech.yandex.net/tts?format=mp3&quality=hi&lang=ru_RU&speed=$speed&speaker=$speaker&emotion=$emotion&text=${cur_text}" || { echo "Ошибка при загрузке аудио."; exit; } echo "Файл '$audio_file_name' загружен." IFS="" audio_file_names_array+=($audio_file_name)