diff options
Diffstat (limited to 'tools/speech.sh')
-rwxr-xr-x | tools/speech.sh | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/tools/speech.sh b/tools/speech.sh index bf0a7f0..1b62fbe 100755 --- a/tools/speech.sh +++ b/tools/speech.sh @@ -15,7 +15,11 @@ done # Check for required environment variable if [[ -z "${LLM_API_KEY}" ]]; then echo "The environment variable LLM_API_KEY is not set." - echo "You can use the following command: 'export \$(xargs < ${SCRIPTPATH}/../.env)'" + echo "Try to load ${SCRIPTPATH}/../.env file" + export $(xargs <${SCRIPTPATH}/../.env) +fi +if [[ -z "${LLM_API_KEY}" ]]; then + echo "Failed to load ${SCRIPTPATH}/../.env file" exit 1 fi @@ -41,12 +45,12 @@ _choice_voice() { } # @cmd -# @flag -p --play Play the generated speech -# @option -l --lang![en|fr] Set the language -# @option -v --voice![`_choice_voice`] Set the voice -# @option -s --speed=1.0 Set the speed -# @option -f --filename=speech.wav Set the output filename -# @arg text! Set the text +# @flag -p --play Play the generated speech +# @option -l --lang![en|fr] Set the language +# @option -v --voice![`_choice_voice`] Set the voice +# @option -s --speed=1.0 Set the speed +# @option -f --filename=speech.wav Set the output filename +# @arg text! Set the text synthesize() { http_status_code=$(curl -s "${tts_host}/v1/audio/speech" -o "${argc_filename}" -w "%{http_code}" \ @@ -75,15 +79,15 @@ _choice_lang() { } # @cmd -# @option -s --source![`_choice_source`] Set the voice -# @option -f --filename=record.wav Set the output filename +# @option -s --source![`_choice_source`] Set the voice +# @option -f --filename=record.wav Set the output filename record() { parec -d "${argc_source}" --file-format=wav "${argc_filename}" } # @cmd -# @option -l --lang![`_choice_lang`] Set the language -# @option -f --filename! Set the output filename +# @option -l --lang![`_choice_lang`] Set the language +# @option -f --filename! Set the output filename transcript() { # Transcribe the specified file echo "Transcribing file ${argc_filename}, be patient" |