Skip to content

Commit 03559e1

Browse files
committed
0.20180630
Init version
0 parents  commit 03559e1

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 zvezdochiot
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
RHVoiceBookReader
2+
0.20180630
3+
4+
# RHVoiceBookReader
5+
6+
SH script book reader of RHVoice speech synthesizer.
7+
8+
Example:
9+
10+
```bash
11+
$ bash rhvoiceplay.sh book.txt
12+
```
13+
14+
---
15+
2018
16+
zvezdochiot
17+

rhvoiceplay.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/sh
2+
3+
fhlp="false"
4+
tspeaker="aleksandr"
5+
tln=0
6+
while getopts ":l:s:h" opt
7+
do
8+
case $opt in
9+
l) tln="$OPTARG"
10+
;;
11+
s) tspeaker="$OPTARG"
12+
;;
13+
h) fhlp="true"
14+
;;
15+
*) echo "Unknown option -$OPTARG"
16+
exit 1
17+
;;
18+
esac
19+
done
20+
shift "$(($OPTIND - 1))"
21+
text="$1"
22+
if [ "x$text" = "x" -o "x$fhlp" = "xtrue" ]
23+
then
24+
echo "Usage:"
25+
echo "$0 [options] book.txt"
26+
echo "Options:"
27+
echo " -l N line begin [N=0-100] (default = 0)"
28+
echo " -s str RHVoice speaker (default = aleksandr)"
29+
echo " -h help"
30+
exit 0
31+
fi
32+
33+
if [ ! "$(command -v RHVoice)" -a ! "$(command -v RHVoice-client)" ]
34+
then
35+
echo "WARNING! RHVoice not found"
36+
exit 1
37+
fi
38+
39+
text="$1"
40+
textsize=$(zcat "$text" | sed -e 's/[\.\?\!\…]/&\n/g' | sed -e '/^$/d' | wc -l)
41+
echo "$text: $textsize"
42+
tln=$(($tln*$textsize/100))
43+
i=$tln
44+
if [ "$(command -v RHVoice)" ]
45+
then
46+
zcat "$text" | sed -e 's/[\.\?\!\…]/&\n/g' | sed -e '/^$/d' | sed -e "1,${tln}d" | while read tline; do p=$((10000*$i/$textsize)); p1=$(($p/100)); p2=$(($p-$p1*100)); printf "%02d.%02d: " $p1 $p2; echo "$tline"; echo "$tline" | RHVoice | aplay - 2>/dev/null; (( i++ )); done
47+
else
48+
zcat "$text" | sed -e 's/[\.\?\!\…]/&\n/g' | sed -e '/^$/d' | sed -e "1,${tln}d" | while read tline; do p=$((10000*$i/$textsize)); p1=$(($p/100)); p2=$(($p-$p1*100)); printf "%02d.%02d: " $p1 $p2; echo "$tline"; echo "$tline" | RHVoice-client -s "$tspeaker" | aplay - 2>/dev/null; (( i++ )); done
49+
fi

0 commit comments

Comments
 (0)