Skip to contentSkip to conversation

picotts: new package

PATCH New Iñigo Huguet 2 participants 4 messages Oct 23, 2018 – Nov 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 picotts: new package

PicoTTS, from SVOX, is the speech synthesizer included in Android AOSP. It's lighweight (actually it compiles really fast), very suitable for embedded devices, it sounds good and quite natural, and have good support of all this languages: English, Spanish, German, French and Italian.

Languages support is probably the main improvements over the existing speech synthesizer packages, such as flite.

Tested in desktop PC with Ubuntu and embedded device with Allwinner A20 processor (ARMv7).

The program only can output the synthesized sound to a wav file, and you have to specify the language as an argument if it's not en_US. I've added to the package to scripts that are installed to /usr/bin to help with that:
- picotts: create the output wav file in /tmp, play it with aplay and delete it
- picotts-lc: detect the current system language and call picotts script

---
 package/Config.in            |  1 +
 package/picotts/Config.in    |  8 ++++++
 package/picotts/picotts      | 40 ++++++++++++++++++++++++++
 package/picotts/picotts-lc   | 54 ++++++++++++++++++++++++++++++++++++
 package/picotts/picotts.hash |  1 +
 package/picotts/picotts.mk   | 34 +++++++++++++++++++++++
 6 files changed, 138 insertions(+)
 create mode 100755 package/picotts/Config.in
 create mode 100755 package/picotts/picotts
 create mode 100755 package/picotts/picotts-lc
 create mode 100644 package/picotts/picotts.hash
 create mode 100755 package/picotts/picotts.mk
package/Config.in +1 -0
index 6d2a73ff1b..97aef82b0b 100644
@@ -44,6 +44,7 @@ menu "Audio and video applications"
 	source "package/omxplayer/Config.in"
 	source "package/on2-8170-libs/Config.in"
 	source "package/opus-tools/Config.in"
+	source "package/picotts/Config.in"
 	source "package/pulseaudio/Config.in"
 	source "package/sox/Config.in"
 	source "package/squeezelite/Config.in"
package/picotts/Config.in new file +8 -0
new file mode 100755
index 0000000000..7ee5505fa0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PICOTTS
+	bool "picotts"
+	select BR2_PACKAGE_POPT
+	help
+	  PicoTTS: text-to-speech voice synthesizer from Android AOSP.
+	  It is lightweight and sounds quite good and natural.
+	  PicoTTS supports languages: English (British and American),
+	  Spanish, German, French and Italian.
package/picotts/picotts new file +40 -0
new file mode 100755
index 0000000000..331aa97080
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# help msg
+if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+	echo "Usage: picotts <lang> <msg>"
+	echo "Langs: en-US, en-GB, es-ES, de-DE, fr-FR, it-IT"
+	exit 0
+fi
+
+# errors
+if [ $# -lt 2 ]; then
+	echo "picotts: not enough arguments were given" >&2
+	exit 1
+fi
+
+case "$1" in
+	en-US|en-GB|es-ES|de-DE|fr-FR|it-IT)
+		;;
+	*)
+		echo "picotts: unsupported language: $1" >&2
+		exit 1
+		;;
+esac
+
+# create temp file
+tmpfile=$(mktemp -tp /tmp picoSndXXXXXX)
+tmpfilewav="$tmpfile.wav"
+mv "$tmpfile" "$tmpfilewav"
+
+# extract language argument
+lang_pico=$1
+shift
+
+# play message
+pico2wave -l $lang_pico -w "$tmpfilewav" "$*"
+aplay -q "$tmpfilewav"
+
+# delete temp file
+rm "$tmpfilewav"
+ 
package/picotts/picotts-lc new file +54 -0

54 lines not on this page · raw message

package/picotts/picotts.hash new file +1 -0
new file mode 100644
index 0000000000..967544767c
@@ -0,0 +1 @@
+sha256 1cc989efd85ea90ca228bbb694c4b842a909a232e2c8b9a307d241b3ddec246c  picotts-2f86050dc5da9ab68fc61510b594d8e6975c4d2d.tar.gz
package/picotts/picotts.mk new file +34 -0
new file mode 100755
index 0000000000..02ccb4d13f
@@ -0,0 +1,34 @@
+################################################################################
+#
+# picotts
+#
+################################################################################
+
+# pkg info
+PICOTTS_VERSION = 2f86050dc5da9ab68fc61510b594d8e6975c4d2d
+PICOTTS_SITE = $(call github,naggety,picotts,$(PICOTTS_VERSION))
+PICOTTS_LICENSE = Apache-2.0
+
+# dependencies
+PICOTTS_DEPENDENCIES = popt
+
+# extract
+define PICOTTS_EXTRACT_CMDS
+	tar xf $(PICOTTS_DL_DIR)/picotts-$(PICOTTS_VERSION).tar.gz -C $(@D) picotts-$(PICOTTS_VERSION)/pico --strip-components=2
+endef
+
+# generate build files (autotools)
+PICOTTS_PRE_CONFIGURE_HOOKS += PICOTTS_EXEC_AUTOGEN
+define PICOTTS_EXEC_AUTOGEN
+	cd $(@D) && ./autogen.sh
+endef
+
+# install additional files
+PICOTTS_POST_INSTALL_TARGET_HOOKS += PICOTTS_INSTALL_ADDITIONAL_FILES
+define PICOTTS_INSTALL_ADDITIONAL_FILES
+	$(INSTALL) -D -m 0755 $(TOPDIR)/$(PICOTTS_PKGDIR)/picotts $(TARGET_DIR)/usr/bin/picotts
+	$(INSTALL) -D -m 0755 $(TOPDIR)/$(PICOTTS_PKGDIR)/picotts-lc $(TARGET_DIR)/usr/bin/picotts-lc
+endef
+
+# build
+$(eval $(autotools-package))
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 picotts: new package

Hello,

Thanks for this contribution, seems like a useful package to have! See my review below.

Quoted 4 lines · I?igo Huguet

PicoTTS, from SVOX, is the speech synthesizer included in Android AOSP. It's lighweight (actually it compiles really fast), very suitable for embedded devices, it sounds good and quite natural, and have good support of all this languages: English, Spanish,

this languages -> these languages

Quoted 3 lines

German, French and Italian.

Languages support is probably the main improvements over the existing

Languages support -> Language support

Quoted 8 lines

speech synthesizer packages, such as flite.

Tested in desktop PC with Ubuntu and embedded device with Allwinner A20 processor (ARMv7).

The program only can output the synthesized sound to a wav file, and you have to specify the language as an argument if it's not en_US. I've added to the package to scripts that are installed to /usr/bin

Don't use personal sentences such as "I've added". Something like "Two helper scripts have been added..."

Quoted 5 lines

to help with that:
- picotts: create the output wav file in /tmp, play it with aplay and delete it
- picotts-lc: detect the current system language and call picotts script

However, I am not convinced that we want those helper scripts. They seem to be pretty use case specific, and it's not really the point of Buildroot to carry this type of script IMO. If you think they are generally useful, then talk with upstream to get them merged.

However, I want to point out that this commit log is nice, and provide interesting details to understand the usefulness of this package. Thanks!

Quoted 8 lines
---
 package/Config.in            |  1 +
 package/picotts/Config.in    |  8 ++++++
 package/picotts/picotts      | 40 ++++++++++++++++++++++++++
 package/picotts/picotts-lc   | 54 ++++++++++++++++++++++++++++++++++++
 package/picotts/picotts.hash |  1 +
 package/picotts/picotts.mk   | 34 +++++++++++++++++++++++

Please add an entry in the DEVELOPERS file for this new package.

package/picotts/Config.in line 7

Quoted 13 lines
package/picotts/Config.in new file +7 -0
new file mode 100755
index 0000000000..7ee5505fa0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PICOTTS
+	bool "picotts"
+	select BR2_PACKAGE_POPT
+	help
+	  PicoTTS: text-to-speech voice synthesizer from Android AOSP.
+	  It is lightweight and sounds quite good and natural.
+	  PicoTTS supports languages: English (British and American),

PicoTTS supports the following languages:

package/picotts/Config.in line 8

Quoted 1 line
package/picotts/Config.in new file +1 -0
+	  Spanish, German, French and Italian.

Please add a blank line, and then the upstream URL of the project.

Quoted 14 lines
package/picotts/Config.in new file +1 -0
+picotts $lang_pico "$@"
package/picotts/picotts.hash new file +1 -0
new file mode 100644
index 0000000000..967544767c
@@ -0,0 +1 @@
+sha256 1cc989efd85ea90ca228bbb694c4b842a909a232e2c8b9a307d241b3ddec246c  picotts-2f86050dc5da9ab68fc61510b594d8e6975c4d2d.tar.gz
package/picotts/picotts.mk new file +0 -0
new file mode 100755
index 0000000000..02ccb4d13f

package/picotts/picotts.mk line 7

Quoted 7 lines
package/picotts/picotts.mk new file +7 -0
@@ -0,0 +1,34 @@
+################################################################################
+#
+# picotts
+#
+################################################################################
+
+# pkg info

Please don't add this type of comment, we don't have them anywhere in other Buildroot packages.

package/picotts/picotts.mk line 10

Quoted 3 lines
package/picotts/picotts.mk new file +3 -0
+PICOTTS_VERSION = 2f86050dc5da9ab68fc61510b594d8e6975c4d2d
+PICOTTS_SITE = $(call github,naggety,picotts,$(PICOTTS_VERSION))
+PICOTTS_LICENSE = Apache-2.0

Sad that upstream doesn't include a license file :-/

package/picotts/picotts.mk line 18

Quoted 7 lines
package/picotts/picotts.mk new file +7 -0
+# dependencies
+PICOTTS_DEPENDENCIES = popt
+
+# extract
+define PICOTTS_EXTRACT_CMDS
+	tar xf $(PICOTTS_DL_DIR)/picotts-$(PICOTTS_VERSION).tar.gz -C $(@D) picotts-$(PICOTTS_VERSION)/pico --strip-components=2
+endef

Instead of this, could you try

PICOTTS_SUBDIR = pico

This tells the autotools-package infrastructure that all the autoconf/automake stuff is in the pico/ sub-directory.

package/picotts/picotts.mk line 24

Quoted 5 lines
package/picotts/picotts.mk new file +5 -0
+# generate build files (autotools)
+PICOTTS_PRE_CONFIGURE_HOOKS += PICOTTS_EXEC_AUTOGEN
+define PICOTTS_EXEC_AUTOGEN
+	cd $(@D) && ./autogen.sh
+endef

This won't work correctly, because you're not adding host-autoconf, host-automake and host-libtool in dependencies.

Could you use PICOTTS_AUTORECONF = YES instead? If it doesn't work, could you give more details at what doesn't work?

package/picotts/picotts.mk line 30

Quoted 5 lines
package/picotts/picotts.mk new file +5 -0
+# install additional files
+PICOTTS_POST_INSTALL_TARGET_HOOKS += PICOTTS_INSTALL_ADDITIONAL_FILES
+define PICOTTS_INSTALL_ADDITIONAL_FILES
+	$(INSTALL) -D -m 0755 $(TOPDIR)/$(PICOTTS_PKGDIR)/picotts $(TARGET_DIR)/usr/bin/picotts
+	$(INSTALL) -D -m 0755 $(TOPDIR)/$(PICOTTS_PKGDIR)/picotts-lc $(TARGET_DIR)/usr/bin/picotts-lc

$(TOPDIR)/$(PICOTTS_PKGDIR)/ can be simplified as $(PICOTTS_PKGDIR)/:
all Buildoot make code is exactly from the Buildroot source code top-level directory.

Could you rework the package to take into account those comments, and send an updated version ?

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 picotts: new package

Hi, some comments below.

El 02/11/18 a las 22:11, Thomas Petazzoni escribi?:

Quoted 9 lines
Quoted 5 lines

to help with that:
- picotts: create the output wav file in /tmp, play it with aplay and delete it
- picotts-lc: detect the current system language and call picotts script

However, I am not convinced that we want those helper scripts. They seem to be pretty use case specific, and it's not really the point of Buildroot to carry this type of script IMO. If you think they are generally useful, then talk with upstream to get them merged.

The problem is that there is no upstream anywhere. This program source was "extracted" from Android source, but there is not any "official" team maintaining it. Actually, I got the source code from Ubuntu's package and uploaded it to my own github.

About the scripts being use case specific, I think they're not. The program only can create a .wav file, so if you want to use it to make "on the fly" speech, you need to create a temporary wav, play it, and delete it. This is in fact what the helper scripts do.

I you think they must be removed I will do it, please tell me exactly what to do. Or, since the repository from which the package download the program is mine, I can include them to my repo directly.

Quoted 1 line

Please add a blank line, and then the upstream URL of the project.

Same problem, there is not any upstream URL.

Quoted 10 lines

package/picotts/picotts.mk line 24

Quoted 5 lines
package/picotts/picotts.mk new file +5 -0
+# generate build files (autotools)
+PICOTTS_PRE_CONFIGURE_HOOKS += PICOTTS_EXEC_AUTOGEN
+define PICOTTS_EXEC_AUTOGEN
+	cd $(@D) && ./autogen.sh
+endef

This won't work correctly, because you're not adding host-autoconf, host-automake and host-libtool in dependencies.

Could you use PICOTTS_AUTORECONF = YES instead? If it doesn't work, could you give more details at what doesn't work?

It will work if I just add those packages as dependencies? I will also try with autoreconf, I didn't do it because I don't know enough about how autotools works to know if there is any important difference or not.

Quoted 6 lines

Could you rework the package to take into account those comments, and send an updated version ?

Thanks a lot!

Thomas

Of course, I can.

Regards

I?igo

#3 lore raw

PATCH 1/1 picotts: new package

Hello,

Quoted 4 lines · I?igo Huguet

The problem is that there is no upstream anywhere. This program source was "extracted" from Android source, but there is not any "official" team maintaining it. Actually, I got the source code from Ubuntu's package and uploaded it to my own github.

Meh, Android is really wonderful open-source :-)

Quoted 8 lines

About the scripts being use case specific, I think they're not. The program only can create a .wav file, so if you want to use it to make "on the fly" speech, you need to create a temporary wav, play it, and delete it. This is in fact what the helper scripts do.

I you think they must be removed I will do it, please tell me exactly what to do. Or, since the repository from which the package download the program is mine, I can include them to my repo directly.

Yes, it would be nicer if you included them directly in your repo.

An example of something that was not completely correct is that your script uses aplay, but the package does not select BR2_PACAKAGE_ALSA_UTILS. But I believe it should not: there are possible use cases for this text-to-speech engine that don't involve playing the sound on the local device.

Quoted 3 lines
Quoted 1 line

Please add a blank line, and then the upstream URL of the project.

Same problem, there is not any upstream URL.

Just put the Github URL then :)

Quoted 1 line

It will work if I just add those packages as dependencies?

Yes, but we very much prefer to use <pkg>_AUTORECONF = YES when possible.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com