Accessing music files on iOS from JUCE?


#1

Hi,
does JUCE currently have functionality to access music files from the user’s music library on an iOS device?
Looking for these things basically:

  • accessing the raw audio samples for processing
  • accessing sound file meta data info (such as title, artist, …)
    Koen

#2

Last time I checked, iOS forbids apps from getting the raw samples. It’ll let you start/stop songs playing, but I’ve not added anything to juce to do that, as it’s such an iOS-specific piece of functionality.


#3

I created a couple of classes to do exactly this in my module. The one’s you’ll be after are:

AudioPicker: which shows the iOS audio library and returns an array of MPMediaItems which you can then pass to…

AVAssetAudioFormat: which reads samples from the file like any other JUCE AudioFormat.

Make sure you read the docs though as there’s quite a lot of casting to void* due to the Obj-C layer so you’ll have to follow the steps quite carefully.

I haven’t actually used that code in about a year but it was working great so let me know how it goes.


#4

Thanks dave96! I’ll have a look at this. That AudioPicker sounds interesting too.
Koen