source: doc/xcode_frameworks.rst @ 45f4f7a2

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change on this file since 45f4f7a2 was 18373d8, checked in by Paul Brossier <piem@piem.org>, 8 years ago

doc/xcode_frameworks.rst: remove duplicated label

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[4e2173e]1Frameworks for Xcode
2--------------------
[40dd715]3
4`Binary frameworks`_ are available and ready to use in your XCode project, for
5`iOS`_ and `macOS`_.
6
[3438b42]7#. Download and extract the corresponding ``framework.zip`` file from the `Download`_ page
[40dd715]8
[3438b42]9#. Select **Build Phases** in your project setting and unfold **Link Binary with Libraries**
[40dd715]10
[3438b42]11#. Add *AudioToolbox* and *Accelerate* system frameworks (or make sure they are listed)
[40dd715]12
[3438b42]13#. Add ``aubio.framework`` from the unzipped ``framework.zip``
[40dd715]14
15#. Include the aubio header in your code:
16
17  * in C/C++:
18
19  .. code-block:: c
20
21    #include <aubio/aubio.h>
22
23  * in Obj-C:
24
25  .. code-block:: obj-c
26
27    #import <aubio/aubio.h>
28
29  * in Swift:
30
31  .. code-block:: swift
32
33    import aubio
34
[24a7764]35Using aubio from swift
[4e2173e]36----------------------
37
38Once you have downloaded and installed :ref:`aubio.framework
39<xcode-frameworks-label>`, you sould be able to use aubio from C, Obj-C, and
40Swift source files.
41
[24a7764]42
43Here is a short example showing how to read a sound file in swift:
44
45
46  .. code-block:: swift
47
48    import aubio
49
50    let path = Bundle.main.path(forResource: "example", ofType: "mp4")
51    if (path != nil) {
52        let hop_size : uint_t = 512
53        let a = new_fvec(hop_size)
54        let b = new_aubio_source(path, 0, hop_size)
55        var read: uint_t = 0
56        var total_frames : uint_t = 0
57        while (true) {
58            aubio_source_do(b, a, &read)
59            total_frames += read
60            if (read < hop_size) { break }
61        }
62        print("read", total_frames, "frames at", aubio_source_get_samplerate(b), "Hz")
63        del_aubio_source(b)
64        del_fvec(a)
65    } else {
66        print("could not find file")
67    }
68
69
[40dd715]70.. _Binary frameworks: https://aubio.org/download
71.. _iOS: https://aubio.org/download#ios
72.. _macOS: https://aubio.org/download#osx
Note: See TracBrowser for help on using the repository browser.