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