gnu: zn_poly: Rename to zn-poly, according to our naming conventions.
[jackhill/guix/guix.git] / gnu / packages / speech.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2016, 2019 Marius Bakke <mbakke@fastmail.com>
4 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages speech)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix utils)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages audio)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages gcc)
34 #:use-module (gnu packages glib)
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages pulseaudio)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages textutils))
40
41 (define-public espeak
42 (package
43 (name "espeak")
44 (version "1.48.04")
45 (source (origin
46 (method url-fetch)
47 (uri (string-append "mirror://sourceforge/espeak/espeak/"
48 "espeak-" (version-major+minor version)
49 "/espeak-" version "-source.zip"))
50 (sha256
51 (base32
52 "0n86gwh9pw0jqqpdz7mxggllfr8k0r7pc67ayy7w5z6z79kig6mz"))
53 (modules '((guix build utils)))
54 (snippet
55 ;; remove prebuilt binaries
56 '(begin
57 (delete-file-recursively "linux_32bit")
58 #t))))
59 (build-system gnu-build-system)
60 (arguments
61 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
62 (string-append "DATADIR="
63 (assoc-ref %outputs "out")
64 "/share/espeak-data")
65 (string-append "LDFLAGS=-Wl,-rpath="
66 (assoc-ref %outputs "out")
67 "/lib")
68 "AUDIO=pulseaudio")
69 #:tests? #f ; no check target
70 #:phases
71 (modify-phases %standard-phases
72 (replace 'configure
73 (lambda _
74 (chdir "src")
75 ;; We use version 19 of the PortAudio library, so we must copy the
76 ;; corresponding file to be sure that espeak compiles correctly.
77 (copy-file "portaudio19.h" "portaudio.h")
78 (substitute* "Makefile"
79 (("/bin/ln") "ln"))
80 #t)))))
81 (inputs
82 `(("portaudio" ,portaudio)
83 ("pulseaudio" ,pulseaudio)))
84 (native-inputs `(("unzip" ,unzip)))
85 (home-page "http://espeak.sourceforge.net/")
86 (synopsis "Software speech synthesizer")
87 (description "eSpeak is a software speech synthesizer for English and
88 other languages. eSpeak uses a \"formant synthesis\" method. This allows many
89 languages to be provided in a small size. The speech is clear, and can be used
90 at high speeds, but is not as natural or smooth as larger synthesizers which are
91 based on human speech recordings.")
92 (license license:gpl3+)))
93
94 (define-public espeak-ng
95 (package
96 (name "espeak-ng")
97 (version "1.49.2")
98 (home-page "https://github.com/espeak-ng/espeak-ng")
99 (source (origin
100 (method url-fetch)
101 (uri (string-append home-page "/releases/download/" version
102 "/espeak-ng-" version ".tar.gz"))
103 (sha256
104 (base32 "1d10x9rbvqi2zwcz65fxh04k0x0scnk7732l37laz6xra1ldhzng"))))
105 (build-system gnu-build-system)
106 (arguments
107 `(#:configure-flags '("--disable-static")
108 ;; Building in parallel triggers a race condition in 1.49.2.
109 #:parallel-build? #f
110 ;; XXX: Some tests require an audio device.
111 #:tests? #f))
112 (inputs
113 `(("libcap" ,libcap)
114 ("pcaudiolib" ,pcaudiolib)))
115 (synopsis "Software speech synthesizer")
116 (description
117 "eSpeak NG is a software speech synthesizer for more than 100 languages.
118 It is based on the eSpeak engine and supports spectral and Klatt formant
119 synthesis, and the ability to use MBROLA voices.")
120 (license license:gpl3+)))
121
122 (define-public mitlm
123 (package
124 (name "mitlm")
125 (version "0.4.2")
126 (source (origin
127 (method url-fetch)
128 (uri (string-append "https://github.com/mitlm/mitlm/releases/"
129 "download/v" version "/"
130 name "-" version ".tar.xz"))
131 (sha256
132 (base32
133 "09fv4fcpmw9g1j0zml0k5kk1lgjw2spr8gn51llbkaaph6v8d62a"))))
134 (build-system gnu-build-system)
135 (native-inputs
136 `(("gfortran" ,gfortran)))
137 (synopsis "The MIT Language Modeling toolkit")
138 (description "The MIT Language Modeling (MITLM) toolkit is a set of
139 tools designed for the efficient estimation of statistical n-gram language
140 models involving iterative parameter estimation. It achieves much of its
141 efficiency through the use of a compact vector representation of n-grams.")
142 (home-page "https://github.com/mitlm/mitlm")
143 (license license:expat)))
144
145 (define-public speech-dispatcher
146 (package
147 (name "speech-dispatcher")
148 (version "0.9.1")
149 (source (origin
150 (method url-fetch)
151 (uri (string-append "https://github.com/brailcom/speechd/releases"
152 "/download/" version "/speech-dispatcher-"
153 version ".tar.gz"))
154 (sha256
155 (base32
156 "16bg52hnkrsrs7kgbzanb34b9zb6fqxwj0a9bmsxmj1skkil1h1p"))))
157 (build-system gnu-build-system)
158 (arguments
159 `(#:configure-flags '("--disable-static"
160
161 ;; Disable support for proprietary TTS engines.
162 "--with-ibmtts=no"
163 "--with-kali=no" "--with-baratinoo=no")))
164 (native-inputs
165 `(("intltool" ,intltool)
166 ("pkg-config" ,pkg-config)))
167 (inputs
168 `(("dotconf" ,dotconf)
169 ("espeak" ,espeak-ng)
170 ("glib" ,glib)
171 ("libltdl" ,libltdl)
172 ("libsndfile" ,libsndfile)
173 ("pulseaudio" ,pulseaudio)
174 ("python" ,python)))
175 (synopsis "Common interface to speech synthesizers")
176 (description "The Speech Dispatcher project provides a high-level
177 device independent layer for access to speech synthesis through a simple,
178 stable and well documented interface.")
179 (home-page "https://devel.freebsoft.org/speechd")
180 ;; The software is distributed under GPL2+, but includes a number
181 ;; of files covered by other licenses. Note: in practice, this
182 ;; is linked against dotconf, which is LGPL 2.1 only.
183 (license (list license:gpl2+
184 license:fdl1.2+ ; Most files in doc/ are dual gpl2+/fdl1.2+.
185 license:lgpl2.1+
186 (license:non-copyleft
187 ;; festival_client.{c,h} carries an expat-style license.
188 "See src/modules/festival_client.c in the distribution.")
189 license:gpl3+)))) ; doc/texinfo.tex -- with TeX exception.
190
191 (define-public sonic
192 (package
193 (name "sonic")
194 (version "0.2.0")
195 (source (origin
196 (method url-fetch)
197 (uri (string-append "https://github.com/waywardgeek/sonic/archive/"
198 "release-" version ".tar.gz"))
199 (file-name (string-append name "-" version ".tar.gz"))
200 (sha256
201 (base32
202 "11a0q9wkgbb9ymf52v7dvybfhj8hprgr67zs1xcng143fvjpr0n7"))))
203 (build-system gnu-build-system)
204 (arguments
205 `(#:tests? #f ; No test suite.
206 #:make-flags
207 (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
208 #:phases
209 (modify-phases %standard-phases
210 (delete 'configure)))) ; No ./configure script.
211 (synopsis "Speed up or slow down speech")
212 (description "Sonic implements a simple algorithm for speeding up or slowing
213 down speech. However, it's optimized for speed ups of over 2X, unlike previous
214 algorithms for changing speech rate. Sonic is a C library designed to be easily
215 integrated into streaming voice applications such as text-to-speech (TTS) back
216 ends.
217
218 The primary motivation behind Sonic is to enable the blind and visually impaired
219 to improve their productivity with speech engines, like eSpeak. Sonic can also
220 be used by the sighted.")
221 (home-page "https://github.com/waywardgeek/sonic")
222 (license license:asl2.0)))