gnu: Add TuxGuitar.
[jackhill/guix/guix.git] / gnu / packages / music.scm
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)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages audio)
27 #:use-module (gnu packages bison)
28 #:use-module (gnu packages docbook)
29 #:use-module (gnu packages flex)
30 #:use-module (gnu packages fonts)
31 #:use-module (gnu packages fontutils)
32 #:use-module (gnu packages gcc)
33 #:use-module (gnu packages gettext)
34 #:use-module (gnu packages ghostscript)
35 #:use-module (gnu packages gnome)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages guile)
38 #:use-module (gnu packages image)
39 #:use-module (gnu packages imagemagick)
40 #:use-module (gnu packages java)
41 #:use-module (gnu packages linux) ; for alsa-utils
42 #:use-module (gnu packages man)
43 #:use-module (gnu packages mp3)
44 #:use-module (gnu packages netpbm)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages rsync)
49 #:use-module (gnu packages texinfo)
50 #:use-module (gnu packages texlive)
51 #:use-module (gnu packages xml)
52 #:use-module (gnu packages xiph)
53 #:use-module (gnu packages zip))
54
55 (define-public lilypond
56 (package
57 (name "lilypond")
58 (version "2.18.2")
59 (source (origin
60 (method url-fetch)
61 (uri (string-append
62 "http://download.linuxaudio.org/lilypond/sources/v"
63 (version-major+minor version) "/"
64 name "-" version ".tar.gz"))
65 (sha256
66 (base32
67 "01xs9x2wjj7w9appaaqdhk15r1xvvdbz9qwahzhppfmhclvp779j"))))
68 (build-system gnu-build-system)
69 (arguments
70 `(;; Tests fail with this error:
71 ;; Undefined subroutine &main::get_index called at
72 ;; ./lilypond-2.18.2/Documentation/lilypond-texi2html.init line 2127.
73 #:tests? #f
74 #:out-of-source? #t
75 #:phases
76 (alist-cons-before
77 'configure 'prepare-configuration
78 (lambda _
79 (substitute* "configure"
80 (("SHELL=/bin/sh") "SHELL=sh"))
81 (setenv "out" "")
82 #t)
83 %standard-phases)))
84 (inputs
85 `(("guile" ,guile-1.8)
86 ("font-dejavu" ,font-dejavu)
87 ("fontconfig" ,fontconfig)
88 ("freetype" ,freetype)
89 ("ghostscript" ,ghostscript)
90 ("pango" ,pango)
91 ("python" ,python-2)))
92 (native-inputs
93 `(("bison" ,bison)
94 ("perl" ,perl)
95 ("flex" ,flex)
96 ("fontforge" ,fontforge)
97 ("dblatex" ,dblatex)
98 ("gettext" ,gnu-gettext)
99 ("imagemagick" ,imagemagick)
100 ("netpbm" ,netpbm) ;for pngtopnm
101 ("texlive" ,texlive) ;metafont and metapost
102 ("texinfo" ,texinfo)
103 ("texi2html" ,texi2html)
104 ("rsync" ,rsync)
105 ("pkg-config" ,pkg-config)
106 ("zip" ,zip)))
107 (home-page "http://www.lilypond.org/")
108 (synopsis "Music typesetting")
109 (description
110 "GNU LilyPond is a music typesetter, which produces high-quality sheet
111 music. Music is input in a text file containing control sequences which are
112 interpreted by LilyPond to produce the final document. It is extendable with
113 Guile.")
114 (license license:gpl3+)))
115
116 (define-public solfege
117 (package
118 (name "solfege")
119 (version "3.22.2")
120 (source (origin
121 (method url-fetch)
122 (uri (string-append
123 "mirror://gnu/solfege/solfege-"
124 version ".tar.xz"))
125 (sha256
126 (base32
127 "1w25rxdbj907nsx285k9nm480pvy12w3yknfh4n1dfv17cwy072i"))))
128 (build-system gnu-build-system)
129 (arguments
130 `(#:tests? #f ; xmllint attempts to download DTD
131 #:test-target "test"
132 #:phases
133 (alist-cons-after
134 'unpack 'fix-configuration
135 (lambda* (#:key inputs #:allow-other-keys)
136 (substitute* "default.config"
137 (("csound=csound")
138 (string-append "csound="
139 (assoc-ref inputs "csound")
140 "/bin/csound"))
141 (("/usr/bin/aplay")
142 (string-append (assoc-ref inputs "aplay")
143 "/bin/aplay"))
144 (("/usr/bin/timidity")
145 (string-append (assoc-ref inputs "timidity")
146 "/bin/timidity"))
147 (("/usr/bin/mpg123")
148 (string-append (assoc-ref inputs "mpg123")
149 "/bin/mpg123"))
150 (("/usr/bin/ogg123")
151 (string-append (assoc-ref inputs "ogg123")
152 "/bin/ogg123"))))
153 (alist-cons-before
154 'build 'patch-python-shebangs
155 (lambda _
156 ;; Two python scripts begin with a Unicode BOM, so patch-shebang
157 ;; has no effect.
158 (substitute* '("solfege/parsetree.py"
159 "solfege/presetup.py")
160 (("#!/usr/bin/python") (string-append "#!" (which "python")))))
161 (alist-cons-before
162 'build 'add-sitedirs
163 ;; .pth files are not automatically interpreted unless the
164 ;; directories containing them are added as "sites". The directories
165 ;; are then added to those in the PYTHONPATH. This is required for
166 ;; the operation of pygtk and pygobject.
167 (lambda _
168 (substitute* "run-solfege.py"
169 (("import os")
170 "import os, site
171 for path in [path for path in sys.path if 'site-packages' in path]: site.addsitedir(path)")))
172 (alist-cons-before
173 'build 'adjust-config-file-prefix
174 (lambda* (#:key outputs #:allow-other-keys)
175 (substitute* "run-solfege.py"
176 (("prefix = os.path.*$")
177 (string-append "prefix = " (assoc-ref outputs "out")))))
178 (alist-cons-after
179 'install 'wrap-program
180 (lambda* (#:key inputs outputs #:allow-other-keys)
181 ;; Make sure 'solfege' runs with the correct PYTHONPATH. We
182 ;; also need to modify GDK_PIXBUF_MODULE_FILE for SVG support.
183 (let* ((out (assoc-ref outputs "out"))
184 (path (getenv "PYTHONPATH"))
185 (rsvg (assoc-ref inputs "librsvg"))
186 (pixbuf (find-files rsvg "^loaders\\.cache$")))
187 (wrap-program (string-append out "/bin/solfege")
188 `("PYTHONPATH" ":" prefix (,path))
189 `("GDK_PIXBUF_MODULE_FILE" ":" prefix ,pixbuf))))
190 %standard-phases)))))))
191 (inputs
192 `(("python" ,python-2)
193 ("pygtk" ,python2-pygtk)
194 ("gettext" ,gnu-gettext)
195 ("gtk" ,gtk+)
196 ;; TODO: Lilypond is optional. Produces errors at build time:
197 ;; Drawing systems...Error: /undefinedresult in --glyphshow--
198 ;; Fontconfig is needed to fix one of the errors, but other similar
199 ;; errors remain.
200 ;;("lilypond" ,lilypond)
201 ("librsvg" ,librsvg) ; needed at runtime for icons
202 ("libpng" ,libpng) ; needed at runtime for icons
203 ;; players needed at runtime
204 ("aplay" ,alsa-utils)
205 ("csound" ,csound) ; optional, needed for some exercises
206 ("mpg123" ,mpg123)
207 ("ogg123" ,vorbis-tools)
208 ("timidity" ,timidity++)))
209 (native-inputs
210 `(("pkg-config" ,pkg-config)
211 ("txt2man" ,txt2man)
212 ("libxml2" ,libxml2) ; for tests
213 ("ghostscript" ,ghostscript)
214 ;;("fontconfig" ,fontconfig) ; only needed with lilypond
215 ;;("freetype" ,freetype) ; only needed with lilypond
216 ("texinfo" ,texinfo)))
217 (home-page "https://www.gnu.org/software/solfege/")
218 (synopsis "Ear training")
219 (description
220 "GNU Solfege is a program for practicing musical ear-training. With it,
221 you can practice your recognition of various musical intervals and chords. It
222 features a statistics overview so you can monitor your progress across several
223 sessions. Solfege is also designed to be extensible so you can easily write
224 your own lessons.")
225 (license license:gpl3+)))
226
227 (define-public tuxguitar
228 (package
229 (name "tuxguitar")
230 (version "1.2")
231 (source (origin
232 (method url-fetch)
233 (uri (string-append
234 "mirror://sourceforge/tuxguitar/TuxGuitar/TuxGuitar-"
235 version "/tuxguitar-src-" version ".tar.gz"))
236 (sha256
237 (base32
238 "1g1yf2gd06fzdhqb8kb8dmdcmr602s9y24f01kyl4940wimgr944"))))
239 (build-system gnu-build-system)
240 (arguments
241 `(#:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
242 (assoc-ref %outputs "out") "/lib")
243 (string-append "PREFIX="
244 (assoc-ref %outputs "out"))
245 (string-append "SWT_PATH="
246 (assoc-ref %build-inputs "swt")
247 "/share/java/swt.jar"))
248 #:tests? #f ;no "check" target
249 #:parallel-build? #f ;not supported
250 #:phases
251 (alist-cons-before
252 'build 'enter-dir-set-path-and-pass-ldflags
253 (lambda* (#:key inputs #:allow-other-keys)
254 (chdir "TuxGuitar")
255 (substitute* "GNUmakefile"
256 (("PROPERTIES\\?=")
257 (string-append "PROPERTIES?= -Dswt.library.path="
258 (assoc-ref inputs "swt") "/lib"))
259 (("\\$\\(GCJ\\) -o") "$(GCJ) $(LDFLAGS) -o"))
260 #t)
261 (alist-delete 'configure %standard-phases))))
262 (inputs
263 `(("swt" ,swt)))
264 (native-inputs
265 `(("gcj" ,gcj-4.8)
266 ("pkg-config" ,pkg-config)))
267 (home-page "http://tuxguitar.com.ar")
268 (synopsis "Multitrack tablature editor and player")
269 (description
270 "TuxGuitar is a guitar tablature editor with player support through midi.
271 It can display scores and multitrack tabs. TuxGuitar provides various
272 additional features, including autoscrolling while playing, note duration
273 management, bend/slide/vibrato/hammer-on/pull-off effects, support for
274 tuplets, time signature management, tempo management, gp3/gp4/gp5 import and
275 export.")
276 (license license:lgpl2.1+)))