File: xcode_frameworks.rst

package info (click to toggle)
aubio 0.4.9-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,720 kB
  • sloc: python: 20,447; ansic: 20,127; makefile: 348; sh: 232
file content (72 lines) | stat: -rw-r--r-- 1,797 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Frameworks for Xcode
--------------------

`Binary frameworks`_ are available and ready to use in your XCode project, for
`iOS`_ and `macOS`_.

#. Download and extract the corresponding ``framework.zip`` file from the `Download`_ page

#. Select **Build Phases** in your project setting and unfold **Link Binary with Libraries**

#. Add *AudioToolbox* and *Accelerate* system frameworks (or make sure they are listed)

#. Add ``aubio.framework`` from the unzipped ``framework.zip``

#. Include the aubio header in your code:

  * in C/C++:

  .. code-block:: c

    #include <aubio/aubio.h>

  * in Obj-C:

  .. code-block:: obj-c

    #import <aubio/aubio.h>

  * in Swift:

  .. code-block:: swift

    import aubio

Using aubio from swift
----------------------

Once you have downloaded and installed :ref:`aubio.framework
<xcode-frameworks-label>`, you sould be able to use aubio from C, Obj-C, and
Swift source files.


Here is a short example showing how to read a sound file in swift:


  .. code-block:: swift

    import aubio

    let path = Bundle.main.path(forResource: "example", ofType: "mp4")
    if (path != nil) {
        let hop_size : uint_t = 512
        let a = new_fvec(hop_size)
        let b = new_aubio_source(path, 0, hop_size)
        var read: uint_t = 0
        var total_frames : uint_t = 0
        while (true) {
            aubio_source_do(b, a, &read)
            total_frames += read
            if (read < hop_size) { break }
        }
        print("read", total_frames, "frames at", aubio_source_get_samplerate(b), "Hz")
        del_aubio_source(b)
        del_fvec(a)
    } else {
        print("could not find file")
    }


.. _Binary frameworks: https://aubio.org/download
.. _iOS: https://aubio.org/download#ios
.. _macOS: https://aubio.org/download#osx