Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Oct 20, 2023
1 parent df950a3 commit 2cf5649
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions components/app/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ GIT

GIT
remote: https://github.com/somleng/tts_voices.git
revision: e719a88769a77d08a85dc3aa99ef04ba4630ad18
revision: 65a7b3024a27fb4c56dc03a86eb286fa1d83c24f
specs:
tts_voices (0.1.0)
aws-sdk-polly
Expand All @@ -72,7 +72,7 @@ GEM
adhearsion-loquacious (1.9.3)
ast (2.4.2)
aws-eventstream (1.2.0)
aws-partitions (1.835.0)
aws-partitions (1.838.0)
aws-sdk-core (3.185.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
Expand Down
5 changes: 3 additions & 2 deletions components/freeswitch/bin/aws_polly
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
text="$1"
file="$2"
voice_id="$3"
cache_file="$4"
engine="$4"
cache_file="$5"

# Output the text to a file before executing polly
# https://github.com/somleng/somleng-switch/pull/238
echo "$text" > "$file.txt"
aws polly synthesize-speech --sample-rate "8000" --output-format mp3 --voice-id "$voice_id" --text "file://$file.txt" "$file.mp3"
aws polly synthesize-speech --sample-rate "8000" --output-format mp3 --voice-id "$voice_id" --engine "$engine" --text "file://$file.txt" "$file.mp3"

ffmpeg -i "$file.mp3" "$cache_file"
ln -s "$cache_file" "$file"
Expand Down
8 changes: 6 additions & 2 deletions components/freeswitch/bin/cloud_tts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ voice="$3"
cache_file="$4"

if [[ "$voice" =~ ^Polly\..+ ]]; then
# extract Polly.from voice and execute aws_polly
aws_polly "$text" "$file" "${voice#"Polly."}" "$cache_file"
# extract 'Polly.' from voice
voice_id_with_engine="${voice#"Polly."}"
# extract '-Neural' from voice
voice_id="${voice_id_with_engine%"-Neural"}"
[[ $voice_id_with_engine = $voice_id ]] && engine="standard" || engine="neural"
aws_polly "$text" "$file" "$voice_id" "$engine" "$cache_file"
fi

0 comments on commit 2cf5649

Please sign in to comment.