gnu: All snippets report errors using exceptions, else return #t.
[jackhill/guix/guix.git] / gnu / packages / pulseaudio.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
7 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
8 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
9 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages pulseaudio)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module ((guix licenses) #:prefix l:)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system python)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages algebra)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages avahi)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages databases)
38 #:use-module (gnu packages glib)
39 #:use-module (gnu packages gtk)
40 #:use-module (gnu packages libcanberra)
41 #:use-module (gnu packages web)
42 #:use-module (gnu packages linux)
43 #:use-module (gnu packages m4)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages xiph))
46
47 (define-public libsndfile
48 (package
49 (name "libsndfile")
50 (replacement libsndfile/fixed)
51 (version "1.0.28")
52 (source (origin
53 (method url-fetch)
54 (uri (string-append "http://www.mega-nerd.com/libsndfile/files/libsndfile-"
55 version ".tar.gz"))
56 (patches (search-patches "libsndfile-armhf-type-checks.patch"
57 "libsndfile-CVE-2017-8361-8363-8365.patch"
58 "libsndfile-CVE-2017-8362.patch"))
59 (sha256
60 (base32
61 "1afzm7jx34jhqn32clc5xghyjglccam2728yxlx37yj2y0lkkwqz"))))
62 (build-system gnu-build-system)
63 (inputs
64 `(("libvorbis" ,libvorbis)
65 ("libogg" ,libogg)
66 ("flac" ,flac)))
67 (native-inputs
68 `(("pkg-config" ,pkg-config)))
69 (home-page "http://www.mega-nerd.com/libsndfile/")
70 (synopsis "Reading and writing files containing sampled sound")
71 (description
72 "Libsndfile is a C library for reading and writing files containing
73 sampled sound (such as MS Windows WAV and the Apple/SGI AIFF format) through
74 one standard library interface.
75
76 It was designed to handle both little-endian (such as WAV) and
77 big-endian (such as AIFF) data, and to compile and run correctly on
78 little-endian (such as Intel and DEC/Compaq Alpha) processor systems as well
79 as big-endian processor systems such as Motorola 68k, Power PC, MIPS and
80 SPARC. Hopefully the design of the library will also make it easy to extend
81 for reading and writing new sound file formats.")
82 (license l:gpl2+)))
83
84 (define libsndfile/fixed
85 (package
86 (inherit libsndfile)
87 (source (origin
88 (inherit (package-source libsndfile))
89 (patches (append
90 (origin-patches (package-source libsndfile))
91 (search-patches "libsndfile-CVE-2017-12562.patch")))))))
92
93 (define-public libsamplerate
94 (package
95 (name "libsamplerate") ; aka. Secret Rabbit Code (SRC)
96 (version "0.1.9")
97 (source (origin
98 (method url-fetch)
99 (uri (string-append "http://www.mega-nerd.com/SRC/libsamplerate-"
100 version ".tar.gz"))
101 (sha256
102 (base32
103 "1ha46i0nbibq0pl0pjwcqiyny4hj8lp1bnl4dpxm64zjw9lb2zha"))))
104 (build-system gnu-build-system)
105 (native-inputs
106 `(("pkg-config" ,pkg-config)))
107 (propagated-inputs
108 `(("libsndfile" ,libsndfile)
109 ("fftw" ,fftw)))
110 (home-page "http://www.mega-nerd.com/SRC/index.html")
111 (synopsis "Audio sample rate conversion library")
112 (description
113 "Secret Rabbit Code (aka. libsamplerate) is a Sample Rate Converter for
114 audio. One example of where such a thing would be useful is converting audio
115 from the CD sample rate of 44.1kHz to the 48kHz sample rate used by DAT
116 players.
117
118 SRC is capable of arbitrary and time varying conversions; from downsampling by
119 a factor of 256 to upsampling by the same factor. Arbitrary in this case means
120 that the ratio of input and output sample rates can be an irrational
121 number. The conversion ratio can also vary with time for speeding up and
122 slowing down effects.
123
124 SRC provides a small set of converters to allow quality to be traded off
125 against computation cost. The current best converter provides a
126 signal-to-noise ratio of 145dB with -3dB passband extending from DC to 96% of
127 the theoretical best bandwidth for a given pair of input and output sample
128 rates.")
129 (license l:bsd-2)))
130
131 (define-public pulseaudio
132 (package
133 (name "pulseaudio")
134 (version "11.1")
135 (source (origin
136 (method url-fetch)
137 (uri (string-append
138 "https://freedesktop.org/software/pulseaudio/releases/"
139 name "-" version ".tar.xz"))
140 (sha256
141 (base32
142 "17ndr6kc7hpv4ih4gygwlcpviqifbkvnk4fbwf4n25kpb991qlpj"))
143 (modules '((guix build utils)))
144 (snippet
145 ;; Disable console-kit support by default since it's deprecated
146 ;; anyway.
147 '(begin
148 (substitute* "src/daemon/default.pa.in"
149 (("load-module module-console-kit" all)
150 (string-append "#" all "\n")))
151 #t))
152 (patches (search-patches
153 "pulseaudio-fix-mult-test.patch"
154 "pulseaudio-longer-test-timeout.patch"))))
155 (build-system gnu-build-system)
156 (arguments
157 `(#:configure-flags (list "--localstatedir=/var" ;"--sysconfdir=/etc"
158 "--disable-oss-output"
159 "--enable-bluez5"
160 (string-append "--with-udev-rules-dir="
161 (assoc-ref %outputs "out")
162 "/lib/udev/rules.d"))
163 #:phases (modify-phases %standard-phases
164 (add-before 'check 'pre-check
165 (lambda _
166 ;; 'tests/lock-autospawn-test.c' wants to create a file
167 ;; under ~/.config/pulse.
168 (setenv "HOME" (getcwd))
169 ;; 'thread-test' needs more time on hydra and on slower
170 ;; machines, so we set the default timeout to 120 seconds.
171 (setenv "CK_DEFAULT_TIMEOUT" "120")
172 #t)))))
173 (inputs
174 ;; TODO: Add optional inputs (GTK+?).
175 `(("alsa-lib" ,alsa-lib)
176 ("bluez" ,bluez)
177 ("sbc" ,sbc)
178 ("speex" ,speex)
179 ("libsndfile" ,libsndfile)
180 ("libsamplerate" ,libsamplerate)
181 ("dbus" ,dbus)
182 ("glib" ,glib)
183 ("intltool" ,intltool)
184 ("m4" ,m4)
185 ("libltdl" ,libltdl)
186 ("fftwf" ,fftwf)
187 ("avahi" ,avahi)
188 ("eudev" ,eudev) ;for the detection of hardware audio devices
189 ("check" ,check)))
190 (native-inputs
191 `(("pkg-config" ,pkg-config)))
192 (propagated-inputs
193 ;; 'libpulse*.la' contain `-lgdbm' and `-lcap', so propagate them.
194 `(("libcap" ,libcap)
195 ("gdbm" ,gdbm)))
196 (home-page "http://www.pulseaudio.org/")
197 (synopsis "Sound server")
198 (description
199 "PulseAudio is a sound server. It is basically a proxy for your sound
200 applications. It allows you to do advanced operations on your sound data as
201 it passes between your application and your hardware. Things like
202 transferring the audio to a different machine, changing the sample format or
203 channel count and mixing several sounds into one are easily achieved using a
204 sound server.")
205
206 ;; PulseAudio is LGPLv2+, but some of the optional dependencies (GNU dbm,
207 ;; FFTW, etc.) are GPL'd, so the result is effectively GPLv2+. See
208 ;; 'LICENSE' for details.
209 (license l:gpl2+)))
210
211 (define-public pavucontrol
212 (package
213 (name "pavucontrol")
214 (version "3.0")
215 (source (origin
216 (method url-fetch)
217 (uri (string-append
218 "https://freedesktop.org/software/pulseaudio/pavucontrol/pavucontrol-"
219 version
220 ".tar.xz"))
221 (sha256
222 (base32
223 "14486c6lmmirkhscbfygz114f6yzf97h35n3h3pdr27w4mdfmlmk"))))
224 (build-system gnu-build-system)
225 (arguments
226 '(#:configure-flags '("CXXFLAGS=-std=c++11"))) ; required by gtkmm
227 (inputs
228 `(("libcanberra" ,libcanberra)
229 ("gtkmm" ,gtkmm)
230 ("pulseaudio" ,pulseaudio)))
231 (native-inputs
232 `(("intltool" ,intltool)
233 ("pkg-config" ,pkg-config)))
234 (home-page "https://www.freedesktop.org/software/pulseaudio/pavucontrol/")
235 (synopsis "PulseAudio volume control")
236 (description
237 "PulseAudio Volume Control (pavucontrol) provides a GTK+
238 graphical user interface to connect to a PulseAudio server and
239 easily control the volume of all clients, sinks, etc.")
240 (license l:gpl2+)))
241
242 (define-public ponymix
243 (package
244 (name "ponymix")
245 (version "5")
246 (source (origin
247 (method url-fetch)
248 (uri (string-append "https://github.com/falconindy/ponymix/"
249 "archive/" version ".tar.gz"))
250 (sha256
251 (base32
252 "1c0ch98zry3c4ixywwynjid1n1nh4xl4l1p548giq2w3zwflaghn"))
253 (file-name (string-append name "-" version ".tar.gz"))))
254 (build-system gnu-build-system)
255 (arguments
256 `(#:tests? #f ; There is no test suite.
257 #:make-flags (let ((out (assoc-ref %outputs "out")))
258 (list (string-append "DESTDIR=" out)))
259 #:phases
260 (modify-phases %standard-phases
261 (add-after 'unpack 'patch-paths
262 (lambda _
263 (substitute* "Makefile"
264 (("/usr") ""))))
265 (delete 'configure)))) ; There's no configure phase.
266 (inputs
267 `(("pulseaudio" ,pulseaudio)))
268 (native-inputs
269 `(("pkg-config" ,pkg-config)))
270 (home-page "https://github.com/falconindy/ponymix")
271 (synopsis "Console-based PulseAudio mixer")
272 (description "Ponymix is a PulseAudio mixer and volume controller with a
273 command-line interface. In addition, it is possible to use named sources and
274 sinks.")
275 (license l:expat)))
276
277 (define-public pulsemixer
278 (package
279 (name "pulsemixer")
280 (version "1.4.0")
281 (source (origin
282 (method url-fetch)
283 (uri (string-append "https://github.com/GeorgeFilipkin/"
284 "pulsemixer/archive/" version ".tar.gz"))
285 (file-name (string-append name "-" version ".tar.gz"))
286 (sha256
287 (base32
288 "1lpad90ifr2xfldyf39sbwx1v85rif2gm9w774gwwpjv53zfgk1g"))))
289 (build-system python-build-system)
290 (arguments
291 `(#:phases
292 (modify-phases %standard-phases
293 (add-after 'unpack 'patch-path
294 (lambda* (#:key inputs #:allow-other-keys)
295 (let ((pulse (assoc-ref inputs "pulseaudio")))
296 (substitute* "pulsemixer"
297 (("libpulse.so.0")
298 (string-append pulse "/lib/libpulse.so.0")))
299 #t))))))
300 (inputs
301 `(("pulseaudio" ,pulseaudio)))
302 (home-page "https://github.com/GeorgeFilipkin/pulsemixer/")
303 (synopsis "Command-line and curses mixer for PulseAudio")
304 (description "Pulsemixer is a PulseAudio mixer with command-line and
305 curses-style interfaces.")
306 (license l:expat)))