-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtts.sh
executable file
·46 lines (40 loc) · 892 Bytes
/
tts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
rm output.wav
# Check if argument is provided
if [ -z "$1" ]
then
echo "No language supplied"
exit 1
fi
# Assign the argument to a variable based on your specifications
echo "LANGUAGE $1"
case $1 in
'de')
LANGUAGE='de-DE'
;;
'en')
LANGUAGE='en-US'
;;
'it')
LANGUAGE='it-IT'
;;
*)
echo "Invalid language"
LANGUAGE='en-US'
#exit;
;;
esac
# Check if file exists
if [ ! -f "textfile.txt" ]; then
echo "File textfile.txt does not exist."
exit 1
fi
# Read the contents of the file into a variable
CONTENTS_OF_TEXTFILE=$(cat textfile.txt)
echo $CONTENTS_OF_TEXTFILE
# Call pico2wave with the appropriate arguments
pico2wave -l $LANGUAGE -w output_slow.wav "${CONTENTS_OF_TEXTFILE}"
# Speed up things
sox output_slow.wav output.wav tempo 1.2
rm output_slow.wav
rm textfile.txt