source: doc/develop.rst @ b8503f8

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5sampleryinfft+
Last change on this file since b8503f8 was 7a8a07e, checked in by Paul Brossier <piem@piem.org>, 8 years ago

doc/develop.rst: add some documentation about the c-api

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[7a8a07e]1Developping with aubio
2======================
3
4Read `Contribute`_ to report issues and request new features.
5
6See `Doxygen documentation`_ for the complete documentation of the C library,
7built using `Doxygen <http://www.doxygen.org/>`_.
8
9Below is a brief `Library overview`_.
10
11Library overview
12----------------
13
14Here is a brief overview of the C library. See also the `Doxygen
15documentation`_ for a more detailed list of available functions.
16
17Vectors and matrix
18``````````````````
19
20``fvec_t`` are used to hold vectors of float (``smpl_t``).
21
22.. literalinclude:: ../tests/src/test-fvec.c
23   :language: C
24   :lines: 7
25
26
27.. code-block:: C
28
29        // set some elements
30        vec->data[511] = 2.;
31        vec->data[vec->length-2] = 1.;
32
33Similarly, ``fmat_t`` are used to hold matrix of floats.
34
35.. literalinclude:: ../tests/src/test-fmat.c
36   :language: C
37   :lines: 9-19
38
39Reading a sound file
40````````````````````
41In this example, ``aubio_source`` is used to read a media file.
42
43First, create the objects we need.
44
45.. literalinclude:: ../tests/src/io/test-source.c
46   :language: C
47   :lines: 22-24, 30-32, 34
48
49.. note::
50   With ``samplerate = 0``, ``aubio_source`` will be created with the file's
51   original samplerate.
52
53Now for the processing loop:
54
55.. literalinclude:: ../tests/src/io/test-source.c
56   :language: C
57   :lines: 40-44
58
59At the end of the processing loop, clean-up and de-allocate memory:
60
61.. literalinclude:: ../tests/src/io/test-source.c
62   :language: C
63   :lines: 50-56
64
65See the complete example: :download:`test-source.c
66<../tests/src/io/test-source.c>`.
67
68Computing the spectrum
69``````````````````````
70
71Now let's create a phase vocoder:
72
73.. literalinclude:: ../tests/src/spectral/test-phasevoc.c
74   :language: C
75   :lines: 6-11
76
77The processing loop could know look like:
78
79.. literalinclude:: ../tests/src/spectral/test-phasevoc.c
80   :language: C
81   :lines: 21-35
82
83See the complete example: :download:`test-phasevoc.c
84<../tests/src/spectral/test-phasevoc.c>`.
85
86.. _doxygen-documentation:
87
88Doxygen documentation
89---------------------
90
91The latest version of the doxygen documentation is available at:
92
93    https://aubio.org/doc/latest
94
95Contribute
96----------
97
98Please report any issue and feature request at the `Github issue tracker
99<https://github.com/aubio/aubio/issues>`_. Patches and pull-requests welcome!
100
Note: See TracBrowser for help on using the repository browser.