How to use aubio framework in iOS?
Asked Answered
Y

4

8

I am trying to detect beat, pitch, onset, and fast Fourier Transform (FFT) of audio file in iOS and I found that aubio provides these features and iOS framework also available.

So far, I am using The Amazing Audio Engine to receive audio data in terms of Core Audio's AudioBufferList like this:

id<AEAudioReceiver> receiver = [AEBlockAudioReceiver audioReceiverWithBlock:
                               ^(void                     *source,
                                 const AudioTimeStamp     *time,
                                 UInt32                    frames,
                                 AudioBufferList          *audio) {
    // I don't know how to use audio library.
}];

Can I detect beat, pitch, onset, and fast Fourier Transform (FFT) using aubio from this AudioBufferList and how? If I am on the wrong track, please give me any suggestion?

Yugoslav answered 23/1, 2014 at 8:10 Comment(2)
Hi! I have the same problem - did you find the solution for this task?Guatemala
@Guatemala No, I didn't. Sorry.Yugoslav
M
1

Look at the aubio download page, I believe they've compiled it into framework for iOS and you can import to your Xcode directly.

Reference : http://aubio.org/download#ios

Myongmyopia answered 26/3, 2014 at 6:1 Comment(0)
D
0

There is a compiled framework to use with iOS in the download page.

One you have drag and dropped the library into your project, make sure you also have followign frameworks:

  • Accelerate.framework
  • AudioToolbox.framework

Now, if you download Aubio's source, you will have an examples folder. There, you will find code for detecting beat, pitch, onset (there is also FFT) written in C, which, since ObjC is a superset of C, will also work in your project.

Detruncate answered 28/6, 2015 at 22:55 Comment(2)
Seems like it's not working anymore, any idea why?Bloc
Something may have changed in the last 8 years ;)Detruncate
T
0

My solution for this was to write the audio buffer into a file and then send the file to aubio. Whenever you get a new buffer of audio you can either append to the file (if you want to analyze the whole thing so far) or just overwrite if you're only interested in the incremental piece.

Toucan answered 9/10, 2015 at 12:22 Comment(2)
What where you using to write the audio buffer to file? An AvAssetWriter, or perhaps two AvAssetWriters, or AVCaptureAudioDataOutput or AVCaptureSession delegate with CMSampleBufferRef or where you using Amazing Audio Engine to write to file?Cuomo
did you incur a noticeable performance hit with that? usually you do this kind of thing in-memory but aubio seems to only have a file based input mechanism?Paresthesia
C
0

UPDATE So it looks like the Cocoa Pod for Aubio is not the latest, in my Podfile, I use this code to add Aubio to my Xcode Workspace:

pod 'aubio-iOS-SDK', '~> 0.4'

This installs Aubio 0.4.1 and that is not the latest. Finding documentation for Aubio, in general, is a bit of an obscure process where you piecemeal multiple internet search results together into a workings solution.

For iOS it is even more obscure, if you go to the Aubio downloads page you will find version 0.4.2 for iOS, scroll to bottom, that is later version than the Aubio Cocoa Pod. And yet, here, in comments I found a later iOS Aubio module, 0.4.3, here is the direct download to what might be the latest Aubio for iOS:

https://aubio.org/bin/tmp/aubio-0.4.3~const.iosuniversal_framework.zip

You still need a bridging header reference to aubio.h if you are using Swift as I mentioned in my original answer

ORIGINAL ANSWER There is CocoaPod for aubio that really makes it simple to reference aubio libraries in Swift. Here is the Aubio CocoaPod of iOS:

https://cocoapods.org/pods/aubio-iOS-SDK

Once you install, note that, in Swift, you will NOT write:

import aubio 

at the top of your Swift file.

You need to make sure you add an objective C bridging header to expose the aubio C library to Swift, in the that bridging header you write the following:

#import <aubio/aubio.h>

Now Swift will have access to the aubio library/framework.

Cuomo answered 18/7, 2016 at 22:47 Comment(2)
hi @brian-ogden, could you please open a bug report about this? import aubio in swift should be working. cheersCaracalla
on a more general note: complaining on stackoverflow that the documentation is lacking is unlikely to improve it. Opening a new issue about it would be much appreciated: github.com/aubio/aubio/issues/newCaracalla

© 2022 - 2024 — McMap. All rights reserved.