source: doc/requirements.rst

Last change on this file was 380c529, checked in by Paul Brossier <piem@piem.org>, 4 months ago

[doc] list libswresample in requirements

  • Property mode set to 100644
File size: 10.7 KB
RevLine 
[5069da3]1.. _requirements:
2
[e15d7d0]3Build options
4=============
5
6If built without any external dependencies aubio can be somewhat useful, for
7instance to read, process, and write simple wav files.
8
[8f1b354]9To support more media input formats and add more features to aubio, you can use
10one or all of the following `external libraries`_.
[e15d7d0]11
12You may also want to know more about the `other options`_ and the `platform
13notes`_
14
15The configure script will automatically for these extra libraries. To make sure
16the library or feature is used, pass the `--enable-flag` to waf. To disable
17this feature, use `--disable-feature`.
18
19To find out more about the build commands, use the `--verbose` option.
[5069da3]20
[e15d7d0]21External libraries
22------------------
23
24External libraries are checked for using ``pkg-config``. Set the
25``PKG_CONFIG_PATH`` environment variable if you have them installed in an
26unusual location.
27
28
29.. note::
30
31    If ``pkg-config`` is not found in ``PATH``, the configure step will
32    succeed, but none of the external libraries will be used.
33
[9aac2b5]34To build aubio with no external libraries, use the ``--nodeps`` build option.
35
[b45af44]36Media libraries
37---------------
38
[e15d7d0]39libav
40.....
41
42  `libav.org <https://libav.org/>`_, open source audio and video processing
43  tools.
44
45If all of the following libraries are found, they will be used to compile
46``aubio_source_avcodec``. so that ``aubio_source`` will be able to decode audio
47from all formats supported by `libav
48<https://libav.org/documentation/general.html#Audio-Codecs>`_.
49
50* libavcodec
51* libavformat
52* libavutil
[380c529]53* libswresample
[e15d7d0]54
55To enable this option, configure with ``--enable-avcodec``. The build will then
56failed if the required libraries are not found. To disable this option,
57configure with ``--disable-avcodec``
58
59
60libsndfile
61..........
62
63  `libsndfile <http://www.mega-nerd.com/libsndfile/>`_, a C library for reading
64  and writing sampled sound files.
65
66With libsndfile built in, ``aubio_source_sndfile`` will be built in and used by
67``aubio_source``.
68
69To enable this option, configure with ``--enable-sndfile``. The build will then
70fail if the required library is not found. To disable this option, configure
71with ``--disable-sndfile``
72
73libsamplerate
74.............
75
76  `libsamplerate <http://www.mega-nerd.com/SRC/>`_, a sample rate converter for
77  audio.
78
79With libsamplerate built in, ``aubio_source_sndfile`` will support resampling,
80and ``aubio_resample`` will be fully functional.
81
82To enable this option, configure with ``--enable-samplerate``. The build will
83then fail if the required library is not found. To disable this option,
84configure with ``--disable-samplerate``
85
[b45af44]86Optimisation libraries
87----------------------
88
[e15d7d0]89libfftw3
90........
91
92  `FFTW <http://fftw.org/>`_, a C subroutine for computing the discrete Fourier
93  transform
94
95With libfftw3 built in, ``aubio_fft`` will use `FFTW`_ to
96compute Fast Fourier Transform (FFT), allowing aubio to compute FFT on length
97that are not a power of 2.
98
99To enable this option, configure with ``--enable-fftw3``. The build will
100then fail if the required library is not found. To disable this option,
101configure with ``--disable-fftw3``
[5069da3]102
[46b065d1]103blas
104....
105
106On macOs/iOS, `blas
107<https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms>`_ are made
108available through the Accelerate framework.
109
110On Linux, they can be enabled with ``--enable-blas``.  On Debian (etch),
111`atlas`_, `openblas`_, and `libblas`_ have been successfully tested.
112
113When enabled, ``waf`` will check for the current blas configuration by running
114``pkg-config --libs blas``. Depending of the library path returned by
115``pkg-config``, different headers will be searched for.
116
117.. note::
118
119    On Debian systems, `multiple versions of BLAS and LAPACK
120    <https://wiki.debian.org/DebianScience/LinearAlgebraLibraries>`_ can be
121    installed. To configure which libblas is being used:
122
123    .. code-block:: console
124
125      $ sudo update-alternatives --config libblas.so
126
127..
128  Expected pkg-config output for each alternative:
129    /usr/lib/atlas-base/atlas/libblas.so
130    -L/usr/lib/atlas-base/atlas -lblas
131    /usr/lib/openblas-base/libblas.so
132    -L/usr/lib/openblas-base -lblas
133    /usr/lib/libblas/libblas.so
134    -lblas
135
136atlas
137.....
138
139`ATLAS BLAS APIs <http://math-atlas.sourceforge.net/>`_ will be used the path
140returned by ``pkg-config --libs blas`` contains ``atlas``.
141
142..
143  ``<atlas/cblas.h>`` will be included.
144
145Example:
146
147.. code-block:: console
148
149  $ pkg-config --libs blas
150  -L/usr/lib/atlas-base/atlas -lblas
151  $ ./waf configure --enable-atlas
152  [...]
153  Checking for 'blas'                      : yes
154  Checking for header atlas/cblas.h        : yes
155
156openblas
157........
158
159`OpenBlas libraries <https://www.openblas.net/>`_ will be used when the output
160of ``pkg-config --libs blas`` contains 'openblas',
161
162..
163  ``<openblas/cblas.h>`` will be included.
164
165Example:
166
167.. code-block:: console
168
169  $ pkg-config --libs blas
170  -L/usr/lib/openblas-base -lblas
171  $ ./waf configure --enable-atlas
172  [...]
173  Checking for 'blas'                      : yes
174  Checking for header openblas/cblas.h     : yes
175
176libblas
177.......
178
179`Netlib's libblas (LAPACK) <https://www.netlib.org/lapack/>`_ will be used if
180no specific library path is specified by ``pkg-config``
181
182..
183  ``<cblas.h>`` will be included.
184
185Example:
186
187.. code-block:: console
188
189  $ pkg-config --libs blas
190  -lblas
191  $ ./waf configure --enable-atlas
192  [...]
193  Checking for 'blas'                      : yes
194  Checking for header cblas.h              : yes
195
196
[5069da3]197Platform notes
198--------------
199
[a9a1e79]200On all platforms, you will need to have installed:
201
202 - a compiler (gcc, clang, msvc, ...)
203 - python (any version >= 2.7, including 3.x)
204 - a terminal to run command lines in
205
[5069da3]206Linux
207.....
208
209The following `External libraries`_ will be used if found: `libav`_,
210`libsamplerate`_, `libsndfile`_, `libfftw3`_.
211
212macOS
213.....
214
215The following system frameworks will be used on Mac OS X systems:
216
217  - `Accelerate <https://developer.apple.com/reference/accelerate>`_ to compute
218    FFTs and other vectorized operations optimally.
219
220  - `CoreAudio <https://developer.apple.com/reference/coreaudio>`_ and
221    `AudioToolbox <https://developer.apple.com/reference/audiotoolbox>`_ to
222    decode audio from files and network streams.
223
224.. note::
225
226  To build a fat binary for both ``i386`` and ``x86_64``, use ``./waf configure
227  --enable-fat``.
228
229The following `External libraries`_ will also be checked: `libav`_,
230`libsamplerate`_, `libsndfile`_, `libfftw3`_.
231
[e15d7d0]232To build a fat binary on a darwin like system (macOS, tvOS, appleOS, ...)
233platforms, configure with ``--enable-fat``.
234
[5069da3]235Windows
236.......
237
[7b3668c]238To use a specific version of the compiler, ``--msvc_version``. To build for a
239specific architecture, use ``--msvc_target``. For instance, to build aubio
240for ``x86`` using ``msvc 12.0``, use:
241
242.. code:: bash
243
244    waf configure --msvc_version='msvc 12.0' --msvc_target='x86'
245
246
[5069da3]247The following `External libraries`_ will be used if found: `libav`_,
248`libsamplerate`_, `libsndfile`_, `libfftw3`_.
249
250iOS
251...
252
253The following system frameworks will be used on iOS and iOS Simulator.
254
255  - `Accelerate <https://developer.apple.com/reference/accelerate>`_ to compute
256    FFTs and other vectorized operations optimally.
257
258  - `CoreAudio <https://developer.apple.com/reference/coreaudio>`_ and
259    `AudioToolbox <https://developer.apple.com/reference/audiotoolbox>`_ to
260    decode audio from files and network streams.
261
262To build aubio for iOS, configure with ``--with-target-platform=ios``. For the
263iOS Simulator, use ``--with-target-platform=iosimulator`` instead.
264
265By default, aubio is built with the following flags on iOS:
266
267.. code:: bash
268
269    CFLAGS="-fembed-bitcode -arch arm64 -arch armv7 -arch armv7s -miphoneos-version-min=6.1"
270
271and on iOS Simulator:
272
273.. code::
274
[6f29fe3]275    CFLAGS="-arch i386 -arch x86_64 -mios-simulator-version-min=6.1"
[5069da3]276
277Set ``CFLAGS`` and ``LINKFLAGS`` to change these default values, or edit
278``wscript`` directly.
279
[e15d7d0]280Other options
[5069da3]281-------------
282
[a9a1e79]283Some additional options can be passed to the configure step. For the complete
284list of options, run:
285
[385a9c1e]286.. code:: bash
287
[e15d7d0]288    $ ./waf --help
289
290Here is an example of a custom command:
291
292.. code:: bash
293
294    $ ./waf --verbose configure build install \
295                --enable-avcodec --enable-wavread --disable-wavwrite \
296                --enable-sndfile --enable-samplerate --enable-docs \
297                --destdir $PWD/build/destdir --testcmd="echo %s" \
298                --prefix=/opt --libdir=/opt/lib/multiarch \
299                --manpagesdir=/opt/share/man  \
300                uninstall clean distclean dist distcheck
[5069da3]301
[6d4802f]302.. _doubleprecision:
303
[5069da3]304Double precision
305................
306
[8924bdf]307The datatype used to store real numbers in aubio is named `smpl_t`. By default,
308`smpl_t` is defined as `float`, a `single-precision format
309<https://en.wikipedia.org/wiki/Single-precision_floating-point_format>`_
310(32-bit).  Some algorithms require a floating point representation with a
311higher precision, for instance to prevent arithmetic underflow in recursive
312filters.  In aubio, these special samples are named `lsmp_t` and defined as
313`double` by default (64-bit).
314
315Sometimes it may be useful to compile aubio in `double-precision`, for instance
316to reproduce numerical results obtained with 64-bit routines. In this case,
317`smpl_t` will be defined as `double`.
318
319The following table shows how `smpl_t` and `lsmp_t` are defined in single- and
320double-precision modes:
321
322.. list-table:: Single and double-precision modes
323   :align: center
324
325   * -
326     - single
327     - double
328   * - `smpl_t`
329     - ``float``
330     - ``double``
331   * - `lsmp_t`
332     - ``double``
333     - ``long double``
334
[5069da3]335To compile aubio in double precision mode, configure with ``--enable-double``.
336
[8924bdf]337To compile in single-precision mode (default), use ``--disable-double`` (or
338simply none of these two options).
[5069da3]339
[9682d9d]340Disabling the tests
341...................
342
343In some case, for instance when cross-compiling, unit tests should not be run.
344Option ``--notests`` can be used for this purpose. The tests will not be
345executed, but the binaries will be compiled, ensuring that linking against
346libaubio works as expected.
347
348.. note::
349
350  The ``--notests`` option should be passed to both ``build`` and ``install``
351  targets, otherwise waf will try to run them.
352
[e15d7d0]353Edit wscript
354............
[5069da3]355
[e15d7d0]356Many of the options are gathered in the file `wscript`. a good starting point
357when looking for additional options.
[5069da3]358
[e15d7d0]359.. _build_docs:
[5069da3]360
[e15d7d0]361Building the docs
362-----------------
[5069da3]363
[e15d7d0]364If the following command line tools are found, the documentation will be built
365built:
[5069da3]366
[7a8a07e]367 - `doxygen <http://doxygen.org>`_ to build the :ref:`doxygen-documentation`.
[5069da3]368 - `txt2man <https://github.com/mvertes/txt2man>`_ to build the :ref:`manpages`
[e15d7d0]369 - `sphinx <http://sphinx-doc.org>`_ to build this document
[5069da3]370
371These tools are searched for in the current ``PATH`` environment variable.
372By default, the documentation is built only if the tools are found.
373
374To disable the documentation, configure with ``--disable-docs``. To build with
375the documentation, configure with ``--enable-docs``.
Note: See TracBrowser for help on using the repository browser.