mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
accessibility/picospeaker: Added (CLI frontend to svox).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
00decef7a9
commit
599e1f6f57
7 changed files with 399 additions and 0 deletions
124
accessibility/picospeaker/36273f9d_and_d6a7a01.diff
Normal file
124
accessibility/picospeaker/36273f9d_and_d6a7a01.diff
Normal file
|
@ -0,0 +1,124 @@
|
|||
diff --git a/README b/README
|
||||
index c540542..87bb3d8 100644
|
||||
--- a/README
|
||||
+++ b/README
|
||||
@@ -1,5 +1,5 @@
|
||||
PicoSpeaker
|
||||
-Written by Kyle
|
||||
+Orginally Written by Kyle and forked by shilber01 to work with SNIPS (snips.ai)
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
diff --git a/pico.patch b/pico.patch
|
||||
new file mode 100644
|
||||
index 0000000..0e2680a
|
||||
--- /dev/null
|
||||
+++ b/pico.patch
|
||||
@@ -0,0 +1,19 @@
|
||||
+--- picospeaker.bak 2018-08-27 22:03:05.000000000 +0200
|
||||
++++ picospeaker 2018-08-27 23:49:35.289440981 +0200
|
||||
+@@ -59,8 +59,16 @@
|
||||
+ exit(0)
|
||||
+ elif ( argv[opt] == '-l' ) or ( argv[opt] == '--language' ):
|
||||
+ languages = ('en-US', 'en-GB', 'de-DE', 'es-ES', 'fr-FR', 'it-IT')
|
||||
++ lang_map = {
|
||||
++ 'en': 'en-US',
|
||||
++ 'de': 'de-DE',
|
||||
++ 'es': 'es-ES',
|
||||
++ 'fr': 'fr-FR',
|
||||
++ 'it': 'it-IT'}
|
||||
+ if ( argv[opt+1] in languages ):
|
||||
+ settings['language'] = argv[opt+1]
|
||||
++ elif ( argv[opt+1] in lang_map.keys() ):
|
||||
++ settings['language'] = lang_map[argv[opt+1]]
|
||||
+ else:
|
||||
+ stderr.write('Language ' + argv[opt+1] + ' is currently not available.\n')
|
||||
+ stderr.write('Available languages are ' + ', '.join(languages[:-1]) + ' and ' + languages[-1] + '.\n')
|
||||
\ No newline at end of file
|
||||
diff --git a/picospeaker b/picospeaker
|
||||
index 6b49d34..b9f91c3 100755
|
||||
--- a/picospeaker
|
||||
+++ b/picospeaker
|
||||
@@ -14,8 +14,8 @@ from time import sleep
|
||||
|
||||
# help and version tuples
|
||||
version = (
|
||||
- 'PicoSpeaker 0.6.2',
|
||||
- 'Written by Kyle',
|
||||
+ 'PicoSpeaker 0.6.2-1',
|
||||
+ 'Written by Kyle,forked by shilbert01',
|
||||
'This program is free and unencumbered software released into the public domain.',
|
||||
'See the included UNLICENSE file for details.')
|
||||
help = (
|
||||
@@ -59,8 +59,16 @@ def parse ():
|
||||
exit(0)
|
||||
elif ( argv[opt] == '-l' ) or ( argv[opt] == '--language' ):
|
||||
languages = ('en-US', 'en-GB', 'de-DE', 'es-ES', 'fr-FR', 'it-IT')
|
||||
+ lang_map = {
|
||||
+ 'en': 'en-US',
|
||||
+ 'de': 'de-DE',
|
||||
+ 'es': 'es-ES',
|
||||
+ 'fr': 'fr-FR',
|
||||
+ 'it': 'it-IT'}
|
||||
if ( argv[opt+1] in languages ):
|
||||
settings['language'] = argv[opt+1]
|
||||
+ elif ( argv[opt+1] in lang_map.keys() ):
|
||||
+ settings['language'] = lang_map[argv[opt+1]]
|
||||
else:
|
||||
stderr.write('Language ' + argv[opt+1] + ' is currently not available.\n')
|
||||
stderr.write('Available languages are ' + ', '.join(languages[:-1]) + ' and ' + languages[-1] + '.\n')
|
||||
@@ -117,7 +125,7 @@ def parse ():
|
||||
continue
|
||||
else:
|
||||
# First, die with an error if compression and/or type are set but no output file is specified
|
||||
- if ( ( settings.has_key('compression') ) or ( settings.has_key('filetype') ) ) and not ( settings.has_key('output') ):
|
||||
+ if ( ( 'compression' in settings ) or ( 'filetype' in settings ) ) and ( 'output' not in settings ):
|
||||
stderr.write('You must specify the output file.\n')
|
||||
exit(1)
|
||||
# Now the text can be added to the settings object and the loop can be broken
|
||||
@@ -128,7 +136,7 @@ def parse ():
|
||||
def tts():
|
||||
'convert text to speech data and store it in a temporary file using the pico2wave utility from SVox Pico'
|
||||
command = ['pico2wave', '-w', temp]
|
||||
- if ( settings.has_key('language') ): command += ['-l', settings['language']]
|
||||
+ if ( 'language' in settings ): command += ['-l', settings['language']]
|
||||
command += ['--', settings['text']]
|
||||
try:
|
||||
call(command)
|
||||
@@ -139,16 +147,16 @@ def tts():
|
||||
def speaker():
|
||||
'speaks the text, or saves it if an output file was specified on the command line'
|
||||
command = ['play', '-q']
|
||||
- if ( settings.has_key('volume') ): command += ['-v', settings['volume']]
|
||||
+ if ( 'volume' in settings ): command += ['-v', settings['volume']]
|
||||
command.append(temp)
|
||||
- if ( settings.has_key('output') ):
|
||||
+ if ( 'output' in settings ):
|
||||
command[0] = 'sox'
|
||||
del command[1]
|
||||
- if ( settings.has_key('filetype') ): command += ['-t', settings['filetype']]
|
||||
- if ( settings.has_key('compression') ): command += ['-C', settings['compression']]
|
||||
+ if ( 'filetype' in settings ): command += ['-t', settings['filetype']]
|
||||
+ if ( 'compression' in settings ): command += ['-C', settings['compression']]
|
||||
command.append(settings['output'])
|
||||
- if ( settings.has_key('pitch') ): command += ['gain', '-0.15', 'pitch', str(float(settings['pitch'])*100)]
|
||||
- if ( settings.has_key('rate') ): command += ['gain', '-0.1', 'tempo', '-s', str(1+float(settings['rate'])/100)]
|
||||
+ if ( 'pitch' in settings ): command += ['gain', '-0.15', 'pitch', str(float(settings['pitch'])*100)]
|
||||
+ if ( 'rate' in settings ): command += ['gain', '-0.1', 'tempo', '-s', str(1+float(settings['rate'])/100)]
|
||||
speak = Popen(command)
|
||||
sleep(0.1) # the temp file should be open by now
|
||||
# The temp file can be removed as soon as it is opened in case PicoSpeaker is killed while speaking
|
||||
@@ -157,11 +165,11 @@ def speaker():
|
||||
|
||||
try:
|
||||
settings = parse()
|
||||
- if ( not settings.has_key('text') ):
|
||||
+ if ( 'text' not in settings ):
|
||||
settings['text'] = stdin.read()
|
||||
tts()
|
||||
speaker()
|
||||
except KeyboardInterrupt:
|
||||
stderr.write('Keyboard interrupt received. Cleaning up.\n')
|
||||
- try: remove(temp)
|
||||
+ try: remove(temp) # The temp file may not have been removed yet
|
||||
except OSError: pass # The file doesn't exist and therefore doesn't need to be removed
|
6
accessibility/picospeaker/README
Normal file
6
accessibility/picospeaker/README
Normal file
|
@ -0,0 +1,6 @@
|
|||
picospeaker (CLI frontend to svox)
|
||||
|
||||
PicoSpeaker is a program written in Python that speaks text on its
|
||||
command line or standard input using SVox Pico and Sox. Speech rate,
|
||||
pitch, volume and language can be specified, and output can be saved
|
||||
to any file format supported by Sox.
|
95
accessibility/picospeaker/picospeaker.1
Normal file
95
accessibility/picospeaker/picospeaker.1
Normal file
|
@ -0,0 +1,95 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.
|
||||
.nr rst2man-indent-level 0
|
||||
.
|
||||
.de1 rstReportMargin
|
||||
\\$1 \\n[an-margin]
|
||||
level \\n[rst2man-indent-level]
|
||||
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
-
|
||||
\\n[rst2man-indent0]
|
||||
\\n[rst2man-indent1]
|
||||
\\n[rst2man-indent2]
|
||||
..
|
||||
.de1 INDENT
|
||||
.\" .rstReportMargin pre:
|
||||
. RS \\$1
|
||||
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
. nr rst2man-indent-level +1
|
||||
.\" .rstReportMargin post:
|
||||
..
|
||||
.de UNINDENT
|
||||
. RE
|
||||
.\" indent \\n[an-margin]
|
||||
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.nr rst2man-indent-level -1
|
||||
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
..
|
||||
.TH "PICOSPEAKER" 1 "2022-01-21" "0.6.2" "SlackBuilds.org"
|
||||
.SH NAME
|
||||
picospeaker \- command-line interface to svox
|
||||
.\" RST source for picospeaker(1) man page. Convert with:
|
||||
.
|
||||
.\" rst2man.py picospeaker.rst > picospeaker.1
|
||||
.
|
||||
.\" rst2man.py comes from the SBo development/docutils package.
|
||||
.
|
||||
.SH SYNOPSIS
|
||||
.sp
|
||||
picospeaker [\fI\-options\fP] <\fItext\fP>
|
||||
.SH DESCRIPTION
|
||||
.sp
|
||||
PicoSpeaker is a program written in Python that speaks text on its
|
||||
command line or standard input using SVox Pico (\fBpico2wave\fP(1)) and
|
||||
\fBsox\fP(1). Speech rate, pitch, volume and language can be specified,
|
||||
and output can be saved to any file format supported by \fBsox\fP, or
|
||||
sent directly to the audio device.
|
||||
.SH OPTIONS
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \fB\-l\fP, \fB\-\-language\fP \fIlanguage\fP
|
||||
Language to speak (default is \fIen\-US\fP). Available languages are
|
||||
\fIen\-US\fP, \fIen\-GB\fP, \fIde\-DE\fP, \fIes\-ES\fP, \fIfr\-FR\fP and \fIit\-IT\fP\&. These may
|
||||
be abbreviated to the two\-letter code (e.g. \fIen\fP).
|
||||
.TP
|
||||
.B \fB\-v\fP, \fB\-\-volume\fP \fInumber\fP
|
||||
Output volume (default is 1.0).
|
||||
.TP
|
||||
.B \fB\-r\fP, \fB\-\-rate\fP \fInumber\fP
|
||||
Rate of speech from \-90 to 9900 (default is 0). This is a percentage, offset by 100 (so \-90 is 10% original speed, 100 is 2x).
|
||||
.TP
|
||||
.B \fB\-p\fP, \fB\-\-pitch\fP \fInumber\fP
|
||||
Voice pitch (semitones) from \-79 to 39 (default is 0).
|
||||
.TP
|
||||
.B \fB\-o\fP, \fB\-\-output\fP \fIfile\fP
|
||||
Output to the specified file (default is sound card output).
|
||||
.TP
|
||||
.B \fB\-c\fP, \fB\-\-compress\fP, \fB\-q\fP, \fB\-\-quality\fP \fInumber\fP
|
||||
Compression/quality level of output file, depends on file type. This option causes an error if no output file is specified.
|
||||
.TP
|
||||
.B \fB\-t\fP, \fB\-\-type\fP \fItype\fP
|
||||
Save output file as \fItype\fP\&. Only needed if saving with a nonstandard extension. This option causes an error if no output file is specified.
|
||||
.TP
|
||||
.B \fB\-V\fP, \fB\-\-version\fP
|
||||
Print version information.
|
||||
.TP
|
||||
.B \fB\-h\fP, \fB\-\-help\fP, \fB\-u\fP, \fB\-\-usage\fP
|
||||
Print built\-in help message.
|
||||
.UNINDENT
|
||||
.SH COPYRIGHT
|
||||
.sp
|
||||
\fBpicospeaker\fP is free and unencumbered software released into the public domain.
|
||||
See the file /usr/doc/picospeaker\-0.6.2/UNLICENSE for details.
|
||||
.SH AUTHORS
|
||||
.sp
|
||||
\fBpicospeaker\fP was written by written by Kyle and forked by shilbert01.
|
||||
.sp
|
||||
This man page written for the SlackBuilds.org project
|
||||
by B. Watson, and is licensed under the WTFPL.
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fBpico2wave\fP(1), \fBsox\fP(1)
|
||||
.\" Generated by docutils manpage writer.
|
||||
.
|
61
accessibility/picospeaker/picospeaker.SlackBuild
Normal file
61
accessibility/picospeaker/picospeaker.SlackBuild
Normal file
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Slackware build script for picospeaker
|
||||
|
||||
# Written by B. Watson (yalhcru@gmail.com)
|
||||
|
||||
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
||||
|
||||
cd $(dirname $0) ; CWD=$(pwd)
|
||||
|
||||
PRGNAM=picospeaker
|
||||
VERSION=${VERSION:-0.6.2}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
ARCH=noarch
|
||||
|
||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf $PRGNAM-$VERSION
|
||||
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
||||
cd $PRGNAM-$VERSION
|
||||
chown -R root:root .
|
||||
chmod 644 *
|
||||
chmod 755 . $PRGNAM
|
||||
|
||||
# python3 support and short language names (de => de_DE).
|
||||
patch -p1 < $CWD/36273f9d_and_d6a7a01.diff
|
||||
|
||||
# actually use python3. doesn't really matter, but someday python2 might
|
||||
# really go away...
|
||||
sed -i '1s,python,python3,' $PRGNAM
|
||||
|
||||
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
|
||||
mkdir -p $PKG/usr/{bin,man/man1} $PKGDOC
|
||||
cp -a $PRGNAM $PKG/usr/bin
|
||||
gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
|
||||
|
||||
mkdir -p $PKGDOC
|
||||
fmt -s README > $PKGDOC/README # line breaks, please.
|
||||
cp -a UNLICENSE $PKGDOC
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|
10
accessibility/picospeaker/picospeaker.info
Normal file
10
accessibility/picospeaker/picospeaker.info
Normal file
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="picospeaker"
|
||||
VERSION="0.6.2"
|
||||
HOMEPAGE="https://github.com/shilbert01/picospeaker/"
|
||||
DOWNLOAD="https://github.com/shilbert01/picospeaker/archive/v0.6.2/picospeaker-0.6.2.tar.gz"
|
||||
MD5SUM="888f1df39733a5d22733473fb783d34a"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES="svox"
|
||||
MAINTAINER="B. Watson"
|
||||
EMAIL="yalhcru@gmail.com"
|
84
accessibility/picospeaker/picospeaker.rst
Normal file
84
accessibility/picospeaker/picospeaker.rst
Normal file
|
@ -0,0 +1,84 @@
|
|||
.. RST source for picospeaker(1) man page. Convert with:
|
||||
.. rst2man.py picospeaker.rst > picospeaker.1
|
||||
.. rst2man.py comes from the SBo development/docutils package.
|
||||
|
||||
.. |version| replace:: 0.6.2
|
||||
.. |date| date::
|
||||
|
||||
===========
|
||||
picospeaker
|
||||
===========
|
||||
|
||||
-----------------------------------
|
||||
command-line interface to Svox Pico
|
||||
-----------------------------------
|
||||
|
||||
:Manual section: 1
|
||||
:Manual group: SlackBuilds.org
|
||||
:Date: |date|
|
||||
:Version: |version|
|
||||
|
||||
SYNOPSIS
|
||||
========
|
||||
|
||||
picospeaker [*-options*] <*text*>
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
||||
PicoSpeaker is a program written in Python that speaks text on its
|
||||
command line or standard input using SVox Pico (**pico2wave**\(1)) and
|
||||
**sox**\(1). Speech rate, pitch, volume and language can be specified,
|
||||
and output can be saved to any file format supported by **sox**, or
|
||||
sent directly to the audio device.
|
||||
|
||||
OPTIONS
|
||||
=======
|
||||
|
||||
**-l**, **--language** *language*
|
||||
Language to speak (default is *en-US*). Available languages are
|
||||
*en-US*, *en-GB*, *de-DE*, *es-ES*, *fr-FR* and *it-IT*. These may
|
||||
be abbreviated to the two-letter code (e.g. *en*).
|
||||
|
||||
**-v**, **--volume** *number*
|
||||
Output volume (default is 1.0).
|
||||
|
||||
**-r**, **--rate** *number*
|
||||
Rate of speech from -90 to 9900 (default is 0). This is a percentage, offset by 100 (so -90 is 10% original speed, 100 is 2x).
|
||||
|
||||
**-p**, **--pitch** *number*
|
||||
Voice pitch (semitones) from -79 to 39 (default is 0).
|
||||
|
||||
**-o**, **--output** *file*
|
||||
Output to the specified file (default is sound card output).
|
||||
|
||||
**-c**, **--compress**, **-q**, **--quality** *number*
|
||||
Compression/quality level of output file, depends on file type. This option causes an error if no output file is specified.
|
||||
|
||||
**-t**, **--type** *type*
|
||||
Save output file as *type*. Only needed if saving with a nonstandard extension. This option causes an error if no output file is specified.
|
||||
|
||||
**-V**, **--version**
|
||||
Print version information.
|
||||
|
||||
**-h**, **--help**, **-u**, **--usage**
|
||||
Print built-in help message.
|
||||
|
||||
COPYRIGHT
|
||||
=========
|
||||
|
||||
**picospeaker** is free and unencumbered software released into the public domain.
|
||||
See the file /usr/doc/picospeaker-|version|/UNLICENSE for details.
|
||||
|
||||
AUTHORS
|
||||
=======
|
||||
|
||||
**picospeaker** was written by written by Kyle and forked by shilbert01.
|
||||
|
||||
This man page written for the SlackBuilds.org project
|
||||
by B. Watson, and is licensed under the WTFPL.
|
||||
|
||||
SEE ALSO
|
||||
========
|
||||
|
||||
**pico2wave**\(1), **sox**\(1)
|
19
accessibility/picospeaker/slack-desc
Normal file
19
accessibility/picospeaker/slack-desc
Normal file
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description.
|
||||
# Line up the first '|' above the ':' following the base package name, and
|
||||
# the '|' on the right side marks the last column you can put a character in.
|
||||
# You must make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
picospeaker: picospeaker (CLI frontend to svox)
|
||||
picospeaker:
|
||||
picospeaker: PicoSpeaker is a program written in Python that speaks text on its
|
||||
picospeaker: command line or standard input using SVox Pico and Sox. Speech rate,
|
||||
picospeaker: pitch, volume and language can be specified, and output can be saved
|
||||
picospeaker: to any file format supported by Sox.
|
||||
picospeaker:
|
||||
picospeaker:
|
||||
picospeaker:
|
||||
picospeaker:
|
||||
picospeaker:
|
Loading…
Reference in a new issue