From 792ad8c4c1dbd140be15018ce43edabbef6cb515 Mon Sep 17 00:00:00 2001 From: David Wilkie Date: Wed, 18 Oct 2023 19:42:19 +0700 Subject: [PATCH] WIP --- .../freeswitch/bin/export_aws_polly_voices | 28 -------- components/freeswitch/bin/export_tts_voices | 25 ++++++++ .../conf/autoload_configs/polly_voices.xml | 64 ------------------- .../conf/autoload_configs/ssml.conf.xml | 2 +- .../conf/autoload_configs/tts_voices.xml | 1 + 5 files changed, 27 insertions(+), 93 deletions(-) delete mode 100755 components/freeswitch/bin/export_aws_polly_voices create mode 100755 components/freeswitch/bin/export_tts_voices delete mode 100644 components/freeswitch/conf/autoload_configs/polly_voices.xml create mode 100644 components/freeswitch/conf/autoload_configs/tts_voices.xml diff --git a/components/freeswitch/bin/export_aws_polly_voices b/components/freeswitch/bin/export_aws_polly_voices deleted file mode 100755 index 523055201..000000000 --- a/components/freeswitch/bin/export_aws_polly_voices +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -# Modified from: -# https://starkandwayne.com/blog/bash-for-loop-over-json-array-using-jq/ - -output_file="$1" - -export_polly_voices () -{ - local voices_content=() - voices_content+=("") - - for row in $(aws polly describe-voices --query 'Voices' | jq -r '.[] | @base64'); do - _jq() { - echo ${row} | base64 --decode | jq -r ${1} - } - - local name="Polly.$(_jq '.Id')" - local language_code="$(_jq '.LanguageCode')" - local gender="$(_jq '.Gender')" - - voices_content+=("") - done - - printf "%s\n" "${voices_content[@]}" > $output_file -} - -export_polly_voices diff --git a/components/freeswitch/bin/export_tts_voices b/components/freeswitch/bin/export_tts_voices new file mode 100755 index 000000000..6e4fb9e57 --- /dev/null +++ b/components/freeswitch/bin/export_tts_voices @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby + +require "bundler/inline" + +gemfile do + source "https://rubygems.org" + + gem "tts_voices", github: "somleng/tts_voices" + gem "ox" + gem "gyoku" +end + +# +# + +voices = TTSVoices::Voice.basic.each_with_object([]) do |tts_voice, result| + result << { + "@name": tts_voice.identifier, + "@language": tts_voice.language, + "@gender": tts_voice.gender, + "@prefix": "tts://flite|kal|" + } +end + +puts Gyoku.xml(voice: voices) diff --git a/components/freeswitch/conf/autoload_configs/polly_voices.xml b/components/freeswitch/conf/autoload_configs/polly_voices.xml deleted file mode 100644 index 4402ebe40..000000000 --- a/components/freeswitch/conf/autoload_configs/polly_voices.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/freeswitch/conf/autoload_configs/ssml.conf.xml b/components/freeswitch/conf/autoload_configs/ssml.conf.xml index ce2f2e501..7df714ed2 100644 --- a/components/freeswitch/conf/autoload_configs/ssml.conf.xml +++ b/components/freeswitch/conf/autoload_configs/ssml.conf.xml @@ -5,7 +5,7 @@ - + diff --git a/components/freeswitch/conf/autoload_configs/tts_voices.xml b/components/freeswitch/conf/autoload_configs/tts_voices.xml new file mode 100644 index 000000000..bef598bd5 --- /dev/null +++ b/components/freeswitch/conf/autoload_configs/tts_voices.xml @@ -0,0 +1 @@ +