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