gnu: Add NTK.
[jackhill/guix/guix.git] / gnu / packages / music.scm
CommitLineData
1b6826d3
RW
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages music)
20 #:use-module (guix utils)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix build-system gnu)
8b9ec354 25 #:use-module (guix build-system cmake)
1b6826d3 26 #:use-module (gnu packages)
c267cc15 27 #:use-module (gnu packages audio)
8b9ec354
RW
28 #:use-module (gnu packages base) ;libbdf
29 #:use-module (gnu packages boost)
1b6826d3 30 #:use-module (gnu packages bison)
8b9ec354
RW
31 #:use-module (gnu packages code)
32 #:use-module (gnu packages check)
33 #:use-module (gnu packages compression)
1b6826d3
RW
34 #:use-module (gnu packages docbook)
35 #:use-module (gnu packages flex)
36 #:use-module (gnu packages fonts)
37 #:use-module (gnu packages fontutils)
6260d1a8 38 #:use-module (gnu packages gcc)
1b6826d3
RW
39 #:use-module (gnu packages gettext)
40 #:use-module (gnu packages ghostscript)
ec8da0e2 41 #:use-module (gnu packages gl)
c267cc15 42 #:use-module (gnu packages gnome)
1b6826d3
RW
43 #:use-module (gnu packages gtk)
44 #:use-module (gnu packages guile)
c267cc15 45 #:use-module (gnu packages image)
1b6826d3 46 #:use-module (gnu packages imagemagick)
6260d1a8 47 #:use-module (gnu packages java)
c267cc15
RW
48 #:use-module (gnu packages linux) ; for alsa-utils
49 #:use-module (gnu packages man)
50 #:use-module (gnu packages mp3)
1b6826d3
RW
51 #:use-module (gnu packages netpbm)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pkg-config)
d231bb35 54 #:use-module (gnu packages pulseaudio) ;libsndfile
1b6826d3 55 #:use-module (gnu packages python)
8b9ec354 56 #:use-module (gnu packages qt)
d231bb35 57 #:use-module (gnu packages rdf)
1b6826d3
RW
58 #:use-module (gnu packages rsync)
59 #:use-module (gnu packages texinfo)
60 #:use-module (gnu packages texlive)
8b9ec354 61 #:use-module (gnu packages web)
c267cc15
RW
62 #:use-module (gnu packages xml)
63 #:use-module (gnu packages xiph)
1b6826d3
RW
64 #:use-module (gnu packages zip))
65
d231bb35
RW
66(define-public hydrogen
67 (package
68 (name "hydrogen")
69 (version "0.9.5.1")
70 (source (origin
71 (method url-fetch)
72 (uri (string-append
73 "mirror://sourceforge/hydrogen/Hydrogen/"
74 (version-prefix version 3) "%20Sources/"
75 "hydrogen-" version ".tar.gz"))
76 (sha256
77 (base32
78 "1fvyp6gfzcqcc90dmaqbm11p272zczz5pfz1z4lj33nfr7z0bqgb"))))
79 (build-system gnu-build-system)
80 (arguments
81 `(#:tests? #f ;no "check" target
82 #:phases
83 ;; TODO: Add scons-build-system and use it here.
84 (modify-phases %standard-phases
85 (delete 'configure)
86 (add-after 'unpack 'scons-propagate-environment
87 (lambda _
88 ;; By design, SCons does not, by default, propagate
89 ;; environment variables to subprocesses. See:
90 ;; <http://comments.gmane.org/gmane.linux.distributions.nixos/4969>
91 ;; Here, we modify the Sconstruct file to arrange for
92 ;; environment variables to be propagated.
93 (substitute* "Sconstruct"
94 (("^env = Environment\\(")
95 "env = Environment(ENV=os.environ, "))))
96 (replace 'build
97 (lambda* (#:key inputs outputs #:allow-other-keys)
98 (let ((out (assoc-ref outputs "out")))
99 (zero? (system* "scons"
100 (string-append "prefix=" out)
101 "lrdf=0" ; cannot be found
102 "lash=1")))))
103 (add-before
104 'install
105 'fix-img-install
106 (lambda _
107 ;; The whole ./data/img directory is copied to the target first.
108 ;; Scons complains about existing files when we try to install all
109 ;; images a second time.
110 (substitute* "Sconstruct"
111 (("os.path.walk\\(\"./data/img/\",install_images,env\\)") ""))
112 #t))
113 (replace 'install (lambda _ (zero? (system* "scons" "install")))))))
114 (native-inputs
115 `(("scons" ,scons)
116 ("python" ,python-2)
117 ("pkg-config" ,pkg-config)))
118 (inputs
119 `(("zlib" ,zlib)
120 ("libtar" ,libtar)
121 ("alsa-lib" ,alsa-lib)
122 ("jack" ,jack-1)
123 ("lash" ,lash)
124 ;;("lrdf" ,lrdf) ;FIXME: cannot be found by scons
125 ("qt" ,qt-4)
126 ("libsndfile" ,libsndfile)))
127 (home-page "http://www.hydrogen-music.org")
128 (synopsis "Drum machine")
129 (description
130 "Hydrogen is an advanced drum machine for GNU/Linux. Its main goal is to
131enable professional yet simple and intuitive pattern-based drum programming.")
132 (license license:gpl2+)))
133
1b6826d3
RW
134(define-public lilypond
135 (package
136 (name "lilypond")
137 (version "2.18.2")
138 (source (origin
139 (method url-fetch)
140 (uri (string-append
141 "http://download.linuxaudio.org/lilypond/sources/v"
142 (version-major+minor version) "/"
143 name "-" version ".tar.gz"))
144 (sha256
145 (base32
146 "01xs9x2wjj7w9appaaqdhk15r1xvvdbz9qwahzhppfmhclvp779j"))))
147 (build-system gnu-build-system)
148 (arguments
149 `(;; Tests fail with this error:
150 ;; Undefined subroutine &main::get_index called at
151 ;; ./lilypond-2.18.2/Documentation/lilypond-texi2html.init line 2127.
152 #:tests? #f
153 #:out-of-source? #t
154 #:phases
155 (alist-cons-before
156 'configure 'prepare-configuration
157 (lambda _
158 (substitute* "configure"
159 (("SHELL=/bin/sh") "SHELL=sh"))
160 (setenv "out" "")
161 #t)
162 %standard-phases)))
163 (inputs
164 `(("guile" ,guile-1.8)
165 ("font-dejavu" ,font-dejavu)
166 ("fontconfig" ,fontconfig)
167 ("freetype" ,freetype)
168 ("ghostscript" ,ghostscript)
169 ("pango" ,pango)
170 ("python" ,python-2)))
171 (native-inputs
172 `(("bison" ,bison)
173 ("perl" ,perl)
174 ("flex" ,flex)
175 ("fontforge" ,fontforge)
176 ("dblatex" ,dblatex)
177 ("gettext" ,gnu-gettext)
178 ("imagemagick" ,imagemagick)
179 ("netpbm" ,netpbm) ;for pngtopnm
180 ("texlive" ,texlive) ;metafont and metapost
181 ("texinfo" ,texinfo)
182 ("texi2html" ,texi2html)
183 ("rsync" ,rsync)
184 ("pkg-config" ,pkg-config)
185 ("zip" ,zip)))
186 (home-page "http://www.lilypond.org/")
187 (synopsis "Music typesetting")
188 (description
189 "GNU LilyPond is a music typesetter, which produces high-quality sheet
190music. Music is input in a text file containing control sequences which are
191interpreted by LilyPond to produce the final document. It is extendable with
192Guile.")
193 (license license:gpl3+)))
c267cc15
RW
194
195(define-public solfege
196 (package
197 (name "solfege")
198 (version "3.22.2")
199 (source (origin
200 (method url-fetch)
201 (uri (string-append
202 "mirror://gnu/solfege/solfege-"
203 version ".tar.xz"))
204 (sha256
205 (base32
206 "1w25rxdbj907nsx285k9nm480pvy12w3yknfh4n1dfv17cwy072i"))))
207 (build-system gnu-build-system)
208 (arguments
209 `(#:tests? #f ; xmllint attempts to download DTD
210 #:test-target "test"
211 #:phases
212 (alist-cons-after
213 'unpack 'fix-configuration
214 (lambda* (#:key inputs #:allow-other-keys)
215 (substitute* "default.config"
216 (("csound=csound")
217 (string-append "csound="
218 (assoc-ref inputs "csound")
219 "/bin/csound"))
220 (("/usr/bin/aplay")
221 (string-append (assoc-ref inputs "aplay")
222 "/bin/aplay"))
223 (("/usr/bin/timidity")
224 (string-append (assoc-ref inputs "timidity")
225 "/bin/timidity"))
226 (("/usr/bin/mpg123")
227 (string-append (assoc-ref inputs "mpg123")
228 "/bin/mpg123"))
229 (("/usr/bin/ogg123")
230 (string-append (assoc-ref inputs "ogg123")
231 "/bin/ogg123"))))
232 (alist-cons-before
233 'build 'patch-python-shebangs
234 (lambda _
235 ;; Two python scripts begin with a Unicode BOM, so patch-shebang
236 ;; has no effect.
237 (substitute* '("solfege/parsetree.py"
238 "solfege/presetup.py")
239 (("#!/usr/bin/python") (string-append "#!" (which "python")))))
240 (alist-cons-before
241 'build 'add-sitedirs
242 ;; .pth files are not automatically interpreted unless the
243 ;; directories containing them are added as "sites". The directories
244 ;; are then added to those in the PYTHONPATH. This is required for
245 ;; the operation of pygtk and pygobject.
246 (lambda _
247 (substitute* "run-solfege.py"
248 (("import os")
249 "import os, site
250for path in [path for path in sys.path if 'site-packages' in path]: site.addsitedir(path)")))
251 (alist-cons-before
252 'build 'adjust-config-file-prefix
253 (lambda* (#:key outputs #:allow-other-keys)
254 (substitute* "run-solfege.py"
255 (("prefix = os.path.*$")
256 (string-append "prefix = " (assoc-ref outputs "out")))))
257 (alist-cons-after
258 'install 'wrap-program
259 (lambda* (#:key inputs outputs #:allow-other-keys)
260 ;; Make sure 'solfege' runs with the correct PYTHONPATH. We
261 ;; also need to modify GDK_PIXBUF_MODULE_FILE for SVG support.
262 (let* ((out (assoc-ref outputs "out"))
263 (path (getenv "PYTHONPATH"))
264 (rsvg (assoc-ref inputs "librsvg"))
265 (pixbuf (find-files rsvg "^loaders\\.cache$")))
266 (wrap-program (string-append out "/bin/solfege")
267 `("PYTHONPATH" ":" prefix (,path))
268 `("GDK_PIXBUF_MODULE_FILE" ":" prefix ,pixbuf))))
269 %standard-phases)))))))
270 (inputs
271 `(("python" ,python-2)
272 ("pygtk" ,python2-pygtk)
273 ("gettext" ,gnu-gettext)
274 ("gtk" ,gtk+)
275 ;; TODO: Lilypond is optional. Produces errors at build time:
276 ;; Drawing systems...Error: /undefinedresult in --glyphshow--
277 ;; Fontconfig is needed to fix one of the errors, but other similar
278 ;; errors remain.
279 ;;("lilypond" ,lilypond)
280 ("librsvg" ,librsvg) ; needed at runtime for icons
281 ("libpng" ,libpng) ; needed at runtime for icons
282 ;; players needed at runtime
283 ("aplay" ,alsa-utils)
284 ("csound" ,csound) ; optional, needed for some exercises
285 ("mpg123" ,mpg123)
286 ("ogg123" ,vorbis-tools)
287 ("timidity" ,timidity++)))
288 (native-inputs
289 `(("pkg-config" ,pkg-config)
290 ("txt2man" ,txt2man)
291 ("libxml2" ,libxml2) ; for tests
292 ("ghostscript" ,ghostscript)
293 ;;("fontconfig" ,fontconfig) ; only needed with lilypond
294 ;;("freetype" ,freetype) ; only needed with lilypond
295 ("texinfo" ,texinfo)))
296 (home-page "https://www.gnu.org/software/solfege/")
297 (synopsis "Ear training")
298 (description
299 "GNU Solfege is a program for practicing musical ear-training. With it,
300you can practice your recognition of various musical intervals and chords. It
301features a statistics overview so you can monitor your progress across several
302sessions. Solfege is also designed to be extensible so you can easily write
303your own lessons.")
304 (license license:gpl3+)))
6260d1a8 305
8b9ec354
RW
306(define-public powertabeditor
307 (package
308 (name "powertabeditor")
d19cf783 309 (version "2.0.0-alpha8")
8b9ec354
RW
310 (source (origin
311 (method url-fetch)
312 (uri (string-append
313 "https://github.com/powertab/powertabeditor/archive/"
314 version ".tar.gz"))
315 (file-name (string-append name "-" version ".tar.gz"))
316 (sha256
317 (base32
d19cf783 318 "0gaa2x209v3azql8ak3r1n9a9qbxjx2ssirvwdxwklv2lmfqkm82"))
8b9ec354
RW
319 (modules '((guix build utils)))
320 (snippet
321 '(begin
322 ;; Remove bundled sources for external libraries
323 (delete-file-recursively "external")
324 (substitute* "CMakeLists.txt"
325 (("include_directories\\(\\$\\{PROJECT_SOURCE_DIR\\}/external/.*") "")
8b9ec354
RW
326 (("add_subdirectory\\(external\\)") ""))
327 (substitute* "test/CMakeLists.txt"
328 (("include_directories\\(\\$\\{PROJECT_SOURCE_DIR\\}/external/.*") ""))
329
330 ;; Add install target
331 (substitute* "source/CMakeLists.txt"
332 (("qt5_use_modules")
333 (string-append
334 "install(TARGETS powertabeditor "
335 "RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)\n"
336 "install(FILES data/tunings.json DESTINATION "
337 "${CMAKE_INSTALL_PREFIX}/share/powertabeditor/)\n"
338 "qt5_use_modules")))
339 #t))))
340 (build-system cmake-build-system)
341 (arguments
7e11d113 342 `(#:modules ((guix build cmake-build-system)
8b9ec354
RW
343 (guix build utils)
344 (ice-9 match))
345 #:configure-flags
346 ;; CMake appears to lose the RUNPATH for some reason, so it has to be
347 ;; explicitly set with CMAKE_INSTALL_RPATH.
7e11d113
RW
348 (list "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
349 "-DCMAKE_ENABLE_PRECOMPILED_HEADERS=OFF" ; if ON pte_tests cannot be built
350 (string-append "-DCMAKE_INSTALL_RPATH="
8b9ec354
RW
351 (string-join (map (match-lambda
352 ((name . directory)
353 (string-append directory "/lib")))
354 %build-inputs) ";")))
355 #:phases
356 (modify-phases %standard-phases
7e11d113
RW
357 (replace
358 'check
359 (lambda _
360 (zero? (system* "bin/pte_tests"
361 ;; Exclude this failing test
362 "~Formats/PowerTabOldImport/Directions"))))
363 (add-before
364 'configure 'fix-tests
365 (lambda _
366 ;; Tests cannot be built with precompiled headers
367 (substitute* "test/CMakeLists.txt"
368 (("cotire\\(pte_tests\\)") ""))
369 #t))
8b9ec354
RW
370 (add-before
371 'configure 'remove-third-party-libs
372 (lambda* (#:key inputs #:allow-other-keys)
373 ;; Link with required static libraries, because we're not
374 ;; using the bundled version of withershins.
375 (substitute* '("source/CMakeLists.txt"
376 "test/CMakeLists.txt")
7e11d113 377 (("target_link_libraries\\((powertabeditor|pte_tests)" _ target)
8b9ec354
RW
378 (string-append "target_link_libraries(" target " "
379 (assoc-ref inputs "binutils")
380 "/lib/libbfd.a "
d6902798 381 (assoc-ref inputs "libiberty")
8b9ec354
RW
382 "/lib/libiberty.a "
383 "dl")))
384 #t)))))
385 (inputs
386 `(("boost" ,boost)
387 ("alsa-lib" ,alsa-lib)
388 ("qt" ,qt)
389 ("withershins" ,withershins)
d6902798 390 ("libiberty" ,libiberty) ;for withershins
8b9ec354
RW
391 ("binutils" ,binutils) ;for -lbfd and -liberty (for withershins)
392 ("timidity" ,timidity++)
393 ("pugixml" ,pugixml)
394 ("rtmidi" ,rtmidi)
395 ("rapidjson" ,rapidjson)
396 ("zlib" ,zlib)))
397 (native-inputs
398 `(("catch" ,catch-framework)
399 ("pkg-config" ,pkg-config)))
400 (home-page "http://powertabs.net")
401 (synopsis "Guitar tablature editor")
402 (description
403 "Power Tab Editor 2.0 is the successor to the famous original Power Tab
404Editor. It is compatible with Power Tab Editor 1.7 and Guitar Pro.")
405 (license license:gpl3+)))
406
ec8da0e2
RW
407(define-public setbfree
408 (package
409 (name "setbfree")
410 (version "0.8.0")
411 (source (origin
412 (method url-fetch)
413 (uri
414 (string-append
415 "https://github.com/pantherb/setBfree/releases/download/v"
416 version "/setbfree-" version ".tar.gz"))
417 (sha256
418 (base32
419 "045bgp7qsigpbrhk7qvgvliwiy26sajifwn7f2jvk90ckfqnlw4b"))))
420 (build-system gnu-build-system)
421 (arguments
422 `(#:tests? #f ; no "check" target
423 #:make-flags
424 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
425 (string-append "FONTFILE="
426 (assoc-ref %build-inputs "font-bitstream-vera")
b42d4508
RW
427 "/share/fonts/truetype/VeraBd.ttf")
428 ;; Disable unsupported optimization flags on non-x86
429 ,@(let ((system (or (%current-target-system)
430 (%current-system))))
431 (if (or (string-prefix? "x86_64" system)
432 (string-prefix? "i686" system))
433 '()
434 '("OPTIMIZATIONS=-ffast-math -fomit-frame-pointer -O3"))))
ec8da0e2
RW
435 #:phases
436 (modify-phases %standard-phases
437 (add-before 'build 'set-CC-variable
438 (lambda _ (setenv "CC" "gcc") #t))
439 (delete 'configure))))
440 (inputs
441 `(("jack" ,jack-1)
442 ("lv2" ,lv2)
443 ("zita-convolver" ,zita-convolver)
444 ("glu" ,glu)
445 ("ftgl" ,ftgl)
446 ("font-bitstream-vera" ,font-bitstream-vera)))
447 (native-inputs
448 `(("help2man" ,help2man)
449 ("pkg-config" ,pkg-config)))
450 (home-page "http://setbfree.org")
451 (synopsis "Tonewheel organ")
452 (description
453 "setBfree is a MIDI-controlled, software synthesizer designed to imitate
454the sound and properties of the electromechanical organs and sound
455modification devices that brought world-wide fame to the names and products of
456Laurens Hammond and Don Leslie.")
457 (license license:gpl2+)))
458
6260d1a8
RW
459(define-public tuxguitar
460 (package
461 (name "tuxguitar")
462 (version "1.2")
463 (source (origin
464 (method url-fetch)
465 (uri (string-append
466 "mirror://sourceforge/tuxguitar/TuxGuitar/TuxGuitar-"
467 version "/tuxguitar-src-" version ".tar.gz"))
468 (sha256
469 (base32
470 "1g1yf2gd06fzdhqb8kb8dmdcmr602s9y24f01kyl4940wimgr944"))))
471 (build-system gnu-build-system)
472 (arguments
473 `(#:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
474 (assoc-ref %outputs "out") "/lib")
475 (string-append "PREFIX="
476 (assoc-ref %outputs "out"))
477 (string-append "SWT_PATH="
478 (assoc-ref %build-inputs "swt")
479 "/share/java/swt.jar"))
480 #:tests? #f ;no "check" target
481 #:parallel-build? #f ;not supported
482 #:phases
483 (alist-cons-before
484 'build 'enter-dir-set-path-and-pass-ldflags
485 (lambda* (#:key inputs #:allow-other-keys)
486 (chdir "TuxGuitar")
487 (substitute* "GNUmakefile"
488 (("PROPERTIES\\?=")
489 (string-append "PROPERTIES?= -Dswt.library.path="
490 (assoc-ref inputs "swt") "/lib"))
491 (("\\$\\(GCJ\\) -o") "$(GCJ) $(LDFLAGS) -o"))
492 #t)
493 (alist-delete 'configure %standard-phases))))
494 (inputs
495 `(("swt" ,swt)))
496 (native-inputs
497 `(("gcj" ,gcj-4.8)
498 ("pkg-config" ,pkg-config)))
499 (home-page "http://tuxguitar.com.ar")
500 (synopsis "Multitrack tablature editor and player")
501 (description
502 "TuxGuitar is a guitar tablature editor with player support through midi.
503It can display scores and multitrack tabs. TuxGuitar provides various
504additional features, including autoscrolling while playing, note duration
505management, bend/slide/vibrato/hammer-on/pull-off effects, support for
506tuplets, time signature management, tempo management, gp3/gp4/gp5 import and
507export.")
508 (license license:lgpl2.1+)))