[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/greader eb01e0b902 13/17: - Piper shell script updated
From: |
ELPA Syncer |
Subject: |
[elpa] externals/greader eb01e0b902 13/17: - Piper shell script updated and improved, (thanks to @ra1nb0w). |
Date: |
Wed, 18 Dec 2024 18:59:11 -0500 (EST) |
branch: externals/greader
commit eb01e0b90238a35491e72aedbfce068921e811a4
Author: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>
Commit: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>
- Piper shell script updated and improved, (thanks to @ra1nb0w).
- greader-piper.el: pacified with the compiler.
---
greader-piper.el | 7 ++++---
greader.el | 2 +-
piper.sh | 46 ++++++++++++++++++++++++++++++++--------------
3 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/greader-piper.el b/greader-piper.el
index d879708633..ba2ed2bf6b 100644
--- a/greader-piper.el
+++ b/greader-piper.el
@@ -20,7 +20,8 @@
;; It uses a shell script to call piper.
;;; code:
-(require 'package)
+(require 'find-func)
+
(defgroup greader-piper
nil
"piper back-end."
@@ -51,12 +52,12 @@ Error."
(setq answer (call-process "curl" nil "*piper-script download*"
nil greader-piper-script-url))
(unless (file-exists-p greader-piper-script-path)
- (Error "Error while downloading %s\nPlease try later or
+ (error "Error while downloading %s\nPlease try later or
open an issue" greader-piper-script-url)))
nil))))
;;;###autoload
-(defun greader-piper (command &optional arg)
+(defun greader-piper (command &optional _arg)
"Entry point for greader-piper."
(pcase command
('executable
diff --git a/greader.el b/greader.el
index 89b6f978c7..596d7ab440 100644
--- a/greader.el
+++ b/greader.el
@@ -45,7 +45,7 @@
(require 'seq)
(require 'view)
(defvar-local greader-timer-flag nil)
-
+(require 'find-func)
(defvar greader-auto-tired-timer nil)
(defvar greader-auto-tired-end-timer)
(defvar greader-last-point nil)
diff --git a/piper.sh b/piper.sh
index bfa013edf5..50b58cf9e6 100644
--- a/piper.sh
+++ b/piper.sh
@@ -1,29 +1,47 @@
-#!/bin/bash
+#!/bin/sh
-# Piper parameters configuration
-MODEL="en_US-lessac-medium.onnx" # Text-to-speech model
-OUTPUT_FORMAT="raw" # Output format (e.g. raw, wav)
-SAMPLE_RATE=22050 # Sampling rate
-AUDIO_FORMAT="S16_LE" # Audio format for aplay
+# ** Piper parameters configuration **
+# Piper binary
+# Piper binary should be in your PATH.
+PIPER_BIN="piper"
+# Text-to-speech model; must be the full path
+MODEL="en_US-lessac-medium.onnx"
+# Output format (e.g. raw, wav)
+OUTPUT_FORMAT="raw"
+# Sampling rate
+SAMPLE_RATE=22050
+# Audio format for aplay
+AUDIO_FORMAT="S16_LE"
+# software used to play the audio generated by piper
+AUDIO_PLAYER_BIN="aplay"
+# options for the audio player software
+AUDIO_PLAYER_OPTS="-r ${SAMPLE_RATE} -f ${AUDIO_FORMAT} -t ${OUTPUT_FORMAT} -"
+
+TTS="${1}"
# User input control
-if [ -z "$1" ]; then
+if test "${TTS}" = ""; then
echo "Usage: $0 \"Text to synthesize\""
exit 1
fi
-TEXT="$1"
-
# Check existence of model and Piper
-if [ ! -f "./piper" ]; then
- echo "Error: The Piper executable file is not present in the current
directory."
+if ! command -v "${PIPER_BIN}" > /dev/null 2>&1; then
+ echo "Error: The Piper executable file is not present."
exit 2
fi
-if [ ! -f "$MODEL" ]; then
- echo "Error: Model $MODEL is not present in the current directory."
+if ! test -f "${MODEL}"; then
+ echo "Error: Model ${MODEL} is not present in the current directory."
exit 3
fi
+if ! command -v "${AUDIO_PLAYER_BIN}" > /dev/null 2>&1; then
+ echo "Error: The audio player executable file is not present."
+ exit 4
+fi
+
# Text-to-speech flow
-echo "$TEXT" | ./piper --model "$MODEL" --output-$OUTPUT_FORMAT | aplay -r
"$SAMPLE_RATE" -f "$AUDIO_FORMAT" -t "$OUTPUT_FORMAT" -
+echo "${TTS}" | \
+ "${PIPER_BIN}" --model "${MODEL}" --output-${OUTPUT_FORMAT} | \
+ "${AUDIO_PLAYER_BIN}" ${AUDIO_PLAYER_OPTS}
- [elpa] externals/greader b3233f4483 12/17: More fixes 4., (continued)
- [elpa] externals/greader b3233f4483 12/17: More fixes 4., ELPA Syncer, 2024/12/18
- [elpa] externals/greader 0f0362c507 08/17: Variable `greader-piper-script-path' fixed., ELPA Syncer, 2024/12/18
- [elpa] externals/greader e0abb03f47 04/17: Merge branch 'master' into 2-support-for-the-piper-synthesizer, ELPA Syncer, 2024/12/18
- [elpa] externals/greader 230b753158 05/17: ; ; greader-build-args function fixed, now should work even if the back-end does'nt provide features., ELPA Syncer, 2024/12/18
- [elpa] externals/greader f77876a34c 09/17: More fixes., ELPA Syncer, 2024/12/18
- [elpa] externals/greader f3cb6848e6 10/17: More fixes 2., ELPA Syncer, 2024/12/18
- [elpa] externals/greader 3090adb51b 03/17: First draft of `greader-piper' back-end., ELPA Syncer, 2024/12/18
- [elpa] externals/greader c654d388ca 11/17: More fixes 3., ELPA Syncer, 2024/12/18
- [elpa] externals/greader 3379adb8b8 16/17: Warnings pacified., ELPA Syncer, 2024/12/18
- [elpa] externals/greader 4de4d2d403 14/17: Document better `greader-backends' variable., ELPA Syncer, 2024/12/18
- [elpa] externals/greader eb01e0b902 13/17: - Piper shell script updated and improved, (thanks to @ra1nb0w).,
ELPA Syncer <=
- [elpa] externals/greader a24a0a5efe 17/17: Greader version 0.12.0, ELPA Syncer, 2024/12/18
- [elpa] externals/greader a214cc2412 15/17: Documentation of `greader-piper' updated., ELPA Syncer, 2024/12/18
- [elpa] externals/greader 341ef2fba5 01/17: Copyright notice added., ELPA Syncer, 2024/12/18
- [elpa] externals/greader eb3f98d7f5 07/17: New variable `greader-process-directory'., ELPA Syncer, 2024/12/18