emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/greader b417250e0d 02/17: First draft of the script tha


From: ELPA Syncer
Subject: [elpa] externals/greader b417250e0d 02/17: First draft of the script that controls piper and aplay.
Date: Wed, 18 Dec 2024 18:59:09 -0500 (EST)

branch: externals/greader
commit b417250e0d3bcbac089afc2b3a8ed69870eebb09
Author: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>
Commit: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>

    First draft of the script that controls piper and aplay.
---
 greader-piper.el | 14 +++++++++++++-
 piper.sh         | 29 +++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/greader-piper.el b/greader-piper.el
index 4bc2279c86..4c436a61b1 100644
--- a/greader-piper.el
+++ b/greader-piper.el
@@ -15,4 +15,16 @@
 ;; along with this program.  If not, see
 ;; <http://www.gnu.org/licenses/>.
 
-;;; commentary
+;;; commentary:
+;; This is the back-end for the piper synthesizer.
+;; It uses a shell script to call piper.
+
+;;; code:
+(defgroup greader-piper
+  nil
+  "piper back-end."
+  :group 'greader)
+
+(defcustom greader-piper-binary-path ""
+  "Path of the piper binary."
+  :type 'string)
diff --git a/piper.sh b/piper.sh
new file mode 100644
index 0000000000..bfa013edf5
--- /dev/null
+++ b/piper.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# 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
+
+# User input control
+if [ -z "$1" ]; 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."
+    exit 2
+fi
+
+if [ ! -f "$MODEL" ]; then
+    echo "Error: Model $MODEL is not present in the current directory."
+    exit 3
+fi
+
+# Text-to-speech flow
+echo "$TEXT" | ./piper --model "$MODEL" --output-$OUTPUT_FORMAT | aplay -r 
"$SAMPLE_RATE" -f "$AUDIO_FORMAT" -t "$OUTPUT_FORMAT" -



reply via email to

[Prev in Thread] Current Thread [Next in Thread]