Commit | Line | Data |
---|---|---|
9698f4b7 DT |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2016 David Thompson <davet@gnu.org> | |
7566afb1 | 3 | ;;; Copyright © 2016, 2019 Marius Bakke <mbakke@fastmail.com> |
b3e2ea8d | 4 | ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> |
075972d1 | 5 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
b8098cc6 | 6 | ;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net> |
34583ec6 | 7 | ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net> |
9698f4b7 DT |
8 | ;;; |
9 | ;;; This file is part of GNU Guix. | |
10 | ;;; | |
11 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
12 | ;;; under the terms of the GNU General Public License as published by | |
13 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
14 | ;;; your option) any later version. | |
15 | ;;; | |
16 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
17 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;;; GNU General Public License for more details. | |
20 | ;;; | |
21 | ;;; You should have received a copy of the GNU General Public License | |
22 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | (define-module (gnu packages speech) | |
25 | #:use-module ((guix licenses) #:prefix license:) | |
26 | #:use-module (guix packages) | |
27 | #:use-module (guix download) | |
b8098cc6 | 28 | #:use-module (guix utils) |
9698f4b7 DT |
29 | #:use-module (guix build-system gnu) |
30 | #:use-module (gnu packages) | |
904f8a31 | 31 | #:use-module (gnu packages audio) |
b3df4d7e | 32 | #:use-module (gnu packages autotools) |
b8098cc6 | 33 | #:use-module (gnu packages compression) |
34583ec6 | 34 | #:use-module (gnu packages emacs) |
b3df4d7e MB |
35 | #:use-module (gnu packages gcc) |
36 | #:use-module (gnu packages glib) | |
7566afb1 | 37 | #:use-module (gnu packages linux) |
34583ec6 | 38 | #:use-module (gnu packages ncurses) |
b3df4d7e MB |
39 | #:use-module (gnu packages pkg-config) |
40 | #:use-module (gnu packages pulseaudio) | |
904f8a31 | 41 | #:use-module (gnu packages python) |
34583ec6 | 42 | #:use-module (gnu packages texinfo) |
b3df4d7e | 43 | #:use-module (gnu packages textutils)) |
9698f4b7 | 44 | |
b8098cc6 MB |
45 | (define-public espeak |
46 | (package | |
47 | (name "espeak") | |
48 | (version "1.48.04") | |
49 | (source (origin | |
50 | (method url-fetch) | |
51 | (uri (string-append "mirror://sourceforge/espeak/espeak/" | |
52 | "espeak-" (version-major+minor version) | |
53 | "/espeak-" version "-source.zip")) | |
54 | (sha256 | |
55 | (base32 | |
56 | "0n86gwh9pw0jqqpdz7mxggllfr8k0r7pc67ayy7w5z6z79kig6mz")) | |
57 | (modules '((guix build utils))) | |
58 | (snippet | |
59 | ;; remove prebuilt binaries | |
60 | '(begin | |
61 | (delete-file-recursively "linux_32bit") | |
62 | #t)))) | |
63 | (build-system gnu-build-system) | |
64 | (arguments | |
65 | `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) | |
66 | (string-append "DATADIR=" | |
67 | (assoc-ref %outputs "out") | |
68 | "/share/espeak-data") | |
69 | (string-append "LDFLAGS=-Wl,-rpath=" | |
70 | (assoc-ref %outputs "out") | |
71 | "/lib") | |
636037fd MB |
72 | ;; The package fails to build with newer C++ standards. |
73 | "CXXFLAGS=-std=c++98" | |
b8098cc6 MB |
74 | "AUDIO=pulseaudio") |
75 | #:tests? #f ; no check target | |
76 | #:phases | |
77 | (modify-phases %standard-phases | |
78 | (replace 'configure | |
79 | (lambda _ | |
80 | (chdir "src") | |
81 | ;; We use version 19 of the PortAudio library, so we must copy the | |
82 | ;; corresponding file to be sure that espeak compiles correctly. | |
83 | (copy-file "portaudio19.h" "portaudio.h") | |
84 | (substitute* "Makefile" | |
85 | (("/bin/ln") "ln")) | |
86 | #t))))) | |
87 | (inputs | |
88 | `(("portaudio" ,portaudio) | |
89 | ("pulseaudio" ,pulseaudio))) | |
90 | (native-inputs `(("unzip" ,unzip))) | |
91 | (home-page "http://espeak.sourceforge.net/") | |
92 | (synopsis "Software speech synthesizer") | |
93 | (description "eSpeak is a software speech synthesizer for English and | |
94 | other languages. eSpeak uses a \"formant synthesis\" method. This allows many | |
95 | languages to be provided in a small size. The speech is clear, and can be used | |
96 | at high speeds, but is not as natural or smooth as larger synthesizers which are | |
97 | based on human speech recordings.") | |
98 | (license license:gpl3+))) | |
99 | ||
7566afb1 MB |
100 | (define-public espeak-ng |
101 | (package | |
102 | (name "espeak-ng") | |
103 | (version "1.49.2") | |
104 | (home-page "https://github.com/espeak-ng/espeak-ng") | |
105 | (source (origin | |
106 | (method url-fetch) | |
107 | (uri (string-append home-page "/releases/download/" version | |
108 | "/espeak-ng-" version ".tar.gz")) | |
109 | (sha256 | |
110 | (base32 "1d10x9rbvqi2zwcz65fxh04k0x0scnk7732l37laz6xra1ldhzng")))) | |
111 | (build-system gnu-build-system) | |
112 | (arguments | |
113 | `(#:configure-flags '("--disable-static") | |
114 | ;; Building in parallel triggers a race condition in 1.49.2. | |
115 | #:parallel-build? #f | |
116 | ;; XXX: Some tests require an audio device. | |
117 | #:tests? #f)) | |
118 | (inputs | |
119 | `(("libcap" ,libcap) | |
120 | ("pcaudiolib" ,pcaudiolib))) | |
121 | (synopsis "Software speech synthesizer") | |
122 | (description | |
123 | "eSpeak NG is a software speech synthesizer for more than 100 languages. | |
124 | It is based on the eSpeak engine and supports spectral and Klatt formant | |
125 | synthesis, and the ability to use MBROLA voices.") | |
126 | (license license:gpl3+))) | |
127 | ||
9698f4b7 DT |
128 | (define-public mitlm |
129 | (package | |
130 | (name "mitlm") | |
075972d1 | 131 | (version "0.4.2") |
9698f4b7 DT |
132 | (source (origin |
133 | (method url-fetch) | |
075972d1 TGR |
134 | (uri (string-append "https://github.com/mitlm/mitlm/releases/" |
135 | "download/v" version "/" | |
136 | name "-" version ".tar.xz")) | |
9698f4b7 DT |
137 | (sha256 |
138 | (base32 | |
075972d1 | 139 | "09fv4fcpmw9g1j0zml0k5kk1lgjw2spr8gn51llbkaaph6v8d62a")))) |
9698f4b7 DT |
140 | (build-system gnu-build-system) |
141 | (native-inputs | |
142 | `(("gfortran" ,gfortran))) | |
143 | (synopsis "The MIT Language Modeling toolkit") | |
144 | (description "The MIT Language Modeling (MITLM) toolkit is a set of | |
145 | tools designed for the efficient estimation of statistical n-gram language | |
146 | models involving iterative parameter estimation. It achieves much of its | |
147 | efficiency through the use of a compact vector representation of n-grams.") | |
148 | (home-page "https://github.com/mitlm/mitlm") | |
149 | (license license:expat))) | |
b3df4d7e MB |
150 | |
151 | (define-public speech-dispatcher | |
152 | (package | |
153 | (name "speech-dispatcher") | |
6ced4433 | 154 | (version "0.9.1") |
b3df4d7e MB |
155 | (source (origin |
156 | (method url-fetch) | |
5d04ce48 MB |
157 | (uri (string-append "https://github.com/brailcom/speechd/releases" |
158 | "/download/" version "/speech-dispatcher-" | |
b3df4d7e MB |
159 | version ".tar.gz")) |
160 | (sha256 | |
161 | (base32 | |
6ced4433 | 162 | "16bg52hnkrsrs7kgbzanb34b9zb6fqxwj0a9bmsxmj1skkil1h1p")))) |
b3df4d7e | 163 | (build-system gnu-build-system) |
2422b1b4 | 164 | (arguments |
5d04ce48 | 165 | `(#:configure-flags '("--disable-static" |
6ced4433 | 166 | |
5d04ce48 | 167 | ;; Disable support for proprietary TTS engines. |
6ced4433 | 168 | "--with-ibmtts=no" |
5d04ce48 | 169 | "--with-kali=no" "--with-baratinoo=no"))) |
b3df4d7e MB |
170 | (native-inputs |
171 | `(("intltool" ,intltool) | |
172 | ("pkg-config" ,pkg-config))) | |
173 | (inputs | |
174 | `(("dotconf" ,dotconf) | |
c268c6a0 | 175 | ("espeak" ,espeak-ng) |
b3df4d7e MB |
176 | ("glib" ,glib) |
177 | ("libltdl" ,libltdl) | |
904f8a31 SB |
178 | ("libsndfile" ,libsndfile) |
179 | ("pulseaudio" ,pulseaudio) | |
180 | ("python" ,python))) | |
b3df4d7e MB |
181 | (synopsis "Common interface to speech synthesizers") |
182 | (description "The Speech Dispatcher project provides a high-level | |
183 | device independent layer for access to speech synthesis through a simple, | |
184 | stable and well documented interface.") | |
185 | (home-page "https://devel.freebsoft.org/speechd") | |
186 | ;; The software is distributed under GPL2+, but includes a number | |
6ced4433 MB |
187 | ;; of files covered by other licenses. Note: in practice, this |
188 | ;; is linked against dotconf, which is LGPL 2.1 only. | |
b3df4d7e MB |
189 | (license (list license:gpl2+ |
190 | license:fdl1.2+ ; Most files in doc/ are dual gpl2+/fdl1.2+. | |
191 | license:lgpl2.1+ | |
b3df4d7e MB |
192 | (license:non-copyleft |
193 | ;; festival_client.{c,h} carries an expat-style license. | |
194 | "See src/modules/festival_client.c in the distribution.") | |
195 | license:gpl3+)))) ; doc/texinfo.tex -- with TeX exception. | |
b3e2ea8d LF |
196 | |
197 | (define-public sonic | |
198 | (package | |
199 | (name "sonic") | |
200 | (version "0.2.0") | |
201 | (source (origin | |
202 | (method url-fetch) | |
203 | (uri (string-append "https://github.com/waywardgeek/sonic/archive/" | |
204 | "release-" version ".tar.gz")) | |
205 | (file-name (string-append name "-" version ".tar.gz")) | |
206 | (sha256 | |
207 | (base32 | |
208 | "11a0q9wkgbb9ymf52v7dvybfhj8hprgr67zs1xcng143fvjpr0n7")))) | |
209 | (build-system gnu-build-system) | |
210 | (arguments | |
211 | `(#:tests? #f ; No test suite. | |
212 | #:make-flags | |
213 | (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))) | |
214 | #:phases | |
215 | (modify-phases %standard-phases | |
216 | (delete 'configure)))) ; No ./configure script. | |
217 | (synopsis "Speed up or slow down speech") | |
218 | (description "Sonic implements a simple algorithm for speeding up or slowing | |
219 | down speech. However, it's optimized for speed ups of over 2X, unlike previous | |
220 | algorithms for changing speech rate. Sonic is a C library designed to be easily | |
221 | integrated into streaming voice applications such as text-to-speech (TTS) back | |
222 | ends. | |
223 | ||
224 | The primary motivation behind Sonic is to enable the blind and visually impaired | |
225 | to improve their productivity with speech engines, like eSpeak. Sonic can also | |
226 | be used by the sighted.") | |
227 | (home-page "https://github.com/waywardgeek/sonic") | |
228 | (license license:asl2.0))) | |
34583ec6 RW |
229 | |
230 | (define-public festival | |
231 | (package | |
232 | (name "festival") | |
233 | (version "2.5.0") | |
234 | (source (origin | |
235 | (method url-fetch) | |
236 | (uri (string-append "http://festvox.org/packed/festival/" | |
237 | (version-major+minor version) | |
238 | "/festival-" version "-release.tar.gz")) | |
239 | (sha256 | |
240 | (base32 | |
241 | "1d5415nckiv19adxisxfm1l1xxfyw88g87ckkmcr0lhjdd10g42c")))) | |
242 | (build-system gnu-build-system) | |
243 | (arguments | |
244 | `(#:tests? #f ; there is no test target | |
245 | #:make-flags | |
246 | (list (string-append "RM=" | |
247 | (assoc-ref %build-inputs "coreutils") | |
248 | "/bin/rm") | |
249 | (string-append "ECHO_N=" | |
250 | (assoc-ref %build-inputs "coreutils") | |
251 | "/bin/printf \"%s\"")) | |
252 | #:parallel-build? #f ; not supported | |
253 | #:modules ((guix build gnu-build-system) | |
254 | (guix build utils) | |
255 | (guix build emacs-utils)) | |
256 | #:imported-modules (,@%gnu-build-system-modules | |
257 | (guix build emacs-utils)) | |
258 | #:phases | |
259 | (modify-phases %standard-phases | |
260 | (add-after 'unpack 'unpack-and-patch-speech-tools | |
261 | (lambda* (#:key inputs #:allow-other-keys) | |
262 | (invoke "tar" "-C" ".." | |
263 | "-xf" (assoc-ref inputs "speech-tools")) | |
264 | (with-directory-excursion "../speech_tools" | |
265 | (substitute* '("config/rules/modules.mak" | |
266 | "config/rules/test_make_rules.mak" | |
267 | "config/make_system.mak") | |
268 | (("/bin/sh") (which "sh")))) | |
269 | #t)) | |
270 | (add-after 'unpack 'patch-/bin/sh | |
271 | (lambda _ | |
272 | (substitute* '("config/test_make_rules" | |
273 | "config/make_system.mak") | |
274 | (("/bin/sh") (which "sh"))) | |
275 | #t)) | |
276 | (add-before 'build 'build-speech-tools | |
277 | (lambda* (#:key configure-flags make-flags #:allow-other-keys) | |
278 | (with-directory-excursion "../speech_tools" | |
279 | (apply invoke "sh" "configure" | |
280 | (string-append "CONFIG_SHELL=" (which "sh")) | |
281 | (string-append "SHELL=" (which "sh")) | |
282 | configure-flags) | |
283 | (apply invoke "make" make-flags)))) | |
284 | (add-after 'build 'build-documentation | |
285 | (lambda _ | |
286 | (with-directory-excursion "doc" | |
287 | (invoke "make" "festival.info")))) | |
288 | (add-after 'unpack 'set-installation-directories | |
289 | (lambda* (#:key outputs #:allow-other-keys) | |
290 | (let ((out (assoc-ref outputs "out"))) | |
291 | (substitute* "config/project.mak" | |
292 | (("^FTLIBDIR.*") | |
293 | (string-append "FTLIBDIR=" out "/share/festival/lib"))) | |
294 | (substitute* "config/systems/default.mak" | |
295 | (("^INSTALL_PREFIX.*") | |
296 | (string-append "INSTALL_PREFIX=" out))) | |
297 | #t))) | |
298 | (add-after 'install 'actually-install | |
299 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
300 | (let ((out (assoc-ref outputs "out"))) | |
301 | ;; Install Speech Tools first | |
302 | (with-directory-excursion "../speech_tools" | |
303 | ;; Target directories | |
304 | (for-each (lambda (dir) | |
305 | (mkdir-p (string-append out dir))) | |
306 | '("/bin" | |
307 | "/lib" | |
308 | "/include/speech_tools/" | |
309 | "/include/speech_tools/instantiate" | |
310 | "/include/speech_tools/ling_class" | |
311 | "/include/speech_tools/rxp" | |
312 | "/include/speech_tools/sigpr" | |
313 | "/include/speech_tools/unix")) | |
314 | ;; Install binaries | |
315 | (for-each (lambda (file) | |
316 | (install-file file (string-append out "/bin"))) | |
317 | (find-files "bin" ".*")) | |
318 | (for-each (lambda (file) | |
319 | (delete-file (string-append out "/bin/" file))) | |
320 | '("est_gdb" "est_examples" "est_program")) | |
321 | ;; Install libraries | |
322 | (for-each (lambda (file) | |
323 | (install-file file (string-append out "/lib"))) | |
324 | (find-files "lib" "lib.*\\.so.*")) | |
325 | ||
326 | ;; Install headers | |
327 | (for-each | |
328 | (lambda (dir) | |
329 | (for-each | |
330 | (lambda (header) | |
331 | (install-file header | |
332 | (string-append out "/include/speech_tools/" dir))) | |
333 | (find-files (string-append "include/" dir) | |
334 | "\\.h$"))) | |
335 | '("." "instantiate" "ling_class" "rxp" "sigpr" "unix"))) | |
336 | ||
337 | ;; Unpack files that will be installed together with the | |
338 | ;; Festival libraries. | |
339 | (invoke "tar" "--strip-components=1" | |
340 | "-xvf" (assoc-ref inputs "festvox-cmu")) | |
341 | (invoke "tar" "--strip-components=1" | |
dfcf79ac RW |
342 | "-xvf" (assoc-ref inputs "festvox-poslex")) |
343 | (invoke "tar" "--strip-components=1" | |
344 | "-xvf" (assoc-ref inputs "default-voice")) | |
34583ec6 RW |
345 | |
346 | ;; Install Festival | |
347 | (let ((bin (string-append out "/bin")) | |
348 | (incdir (string-append out "/include/festival")) | |
349 | (share (string-append out "/share/festival")) | |
350 | (info (string-append out "/share/info"))) | |
351 | (for-each (lambda (executable) | |
352 | (install-file executable bin)) | |
353 | '("src/main/festival" | |
354 | "src/main/festival_client" | |
a870b800 RW |
355 | "examples/benchmark")) |
356 | (let ((scripts '("examples/dumpfeats" | |
357 | "examples/durmeanstd" | |
358 | "examples/latest" | |
359 | "examples/make_utts" | |
360 | "examples/powmeanstd" | |
361 | "examples/run-festival-script" | |
362 | "examples/saytime" | |
363 | "examples/scfg_parse_text" | |
364 | "examples/text2pos" | |
365 | "examples/text2wave"))) | |
366 | (substitute* scripts | |
367 | (("exec /tmp/guix-build.*/bin/festival") | |
368 | (string-append "exec " bin "/festival"))) | |
369 | (for-each (lambda (script) | |
370 | (install-file script bin)) | |
371 | scripts)) | |
34583ec6 RW |
372 | |
373 | ;; Documentation | |
17bbd30d RW |
374 | (for-each (lambda (file) |
375 | (install-file file info)) | |
376 | (find-files "doc/info/" "festival.info.*")) | |
34583ec6 RW |
377 | |
378 | ;; Headers | |
379 | (mkdir-p incdir) | |
380 | (for-each (lambda (header) | |
381 | (install-file header | |
382 | (string-append incdir "/" | |
383 | (dirname header)))) | |
384 | (find-files "src/include" "\\.h$")) | |
385 | ||
386 | ;; Data | |
387 | (mkdir-p share) | |
388 | (for-each (lambda (file) | |
389 | (install-file file | |
390 | (string-append share "/" | |
391 | (dirname file)))) | |
392 | (find-files "lib" ".*")) | |
393 | (for-each delete-file | |
394 | (append (find-files share "Makefile") | |
395 | (find-files bin "Makefile"))))) | |
396 | #t)) | |
397 | (add-after 'actually-install 'install-emacs-mode | |
398 | (lambda* (#:key outputs #:allow-other-keys) | |
399 | (let ((emacs-dir (string-append (assoc-ref outputs "out") | |
400 | "/share/emacs/site-lisp"))) | |
401 | (install-file "lib/festival.el" emacs-dir) | |
402 | (emacs-generate-autoloads ,name emacs-dir) | |
403 | #t))) | |
404 | ;; Rebuild the very old configure script that is confused by extra | |
405 | ;; arguments. | |
406 | (add-before 'configure 'bootstrap | |
407 | (lambda _ (invoke "autoreconf" "-vif")))))) | |
408 | (inputs | |
409 | `(("ncurses" ,ncurses))) | |
410 | (native-inputs | |
411 | `(("autoconf" ,autoconf) | |
412 | ("automake" ,automake) | |
413 | ("texinfo" ,texinfo) | |
414 | ("emacs" ,emacs-minimal) | |
415 | ("festvox-cmu" | |
416 | ,(origin | |
417 | (method url-fetch) | |
418 | (uri (string-append "http://festvox.org/packed/festival/" | |
419 | (version-major+minor version) | |
420 | "/festlex_CMU.tar.gz")) | |
421 | (sha256 | |
422 | (base32 | |
423 | "01vwidqhhg2zifvk1gby91mckg1z2pv2mj6lihvdaifakf8k1561")))) | |
424 | ("festvox-poslex" | |
425 | ,(origin | |
426 | (method url-fetch) | |
427 | (uri (string-append "http://festvox.org/packed/festival/" | |
428 | (version-major+minor version) | |
429 | "/festlex_POSLEX.tar.gz")) | |
430 | (sha256 | |
431 | (base32 | |
432 | "18wywilxaqwy63lc47p5g5529mpxhslibh1bjij0snxx5mjf7ip7")))) | |
dfcf79ac RW |
433 | ("default-voice" |
434 | ,(origin | |
435 | (method url-fetch) | |
436 | (uri (string-append "http://festvox.org/packed/festival/" | |
437 | (version-major+minor version) | |
438 | "/voices/festvox_kallpc16k.tar.gz")) | |
439 | (sha256 | |
440 | (base32 | |
441 | "136hmsyiwnlg2qwa508dy0imf19mzrb5r3dmb2kg8kcyxnslm740")))) | |
34583ec6 RW |
442 | ("speech-tools" |
443 | ,(origin | |
444 | (method url-fetch) | |
445 | (uri (string-append "http://festvox.org/packed/festival/" | |
446 | (version-major+minor version) | |
447 | "/speech_tools-" version "-release.tar.gz")) | |
448 | (sha256 | |
449 | (base32 | |
450 | "1k2xh13miyv48gh06rgsq2vj25xwj7z6vwq9ilsn8i7ig3nrgzg4")))))) | |
451 | (home-page "http://www.cstr.ed.ac.uk/projects/festival/") | |
452 | (synopsis "Speech synthesis system") | |
453 | (description "Festival offers a general framework for building speech | |
454 | synthesis systems as well as including examples of various modules. As a | |
455 | whole it offers full text to speech through a number APIs: from shell level, | |
456 | though a Scheme command interpreter, as a C++ library, from Java, and an Emacs | |
457 | interface. Festival is multi-lingual though English is the most advanced. | |
458 | The system is written in C++ and uses the Edinburgh Speech Tools Library for | |
459 | low level architecture and has a Scheme (SIOD) based command interpreter for | |
460 | control.") | |
461 | (license (license:non-copyleft "file://COPYING")))) |