I have an app that uses .aupreset
files along with .wav
samples to define instruments that are loaded into an AUSampler audio unit.
The .aupreset
files reference the .wav
files with absolute paths. As described in Technical Note 2283, if the audio files cannot be found at the original path, then the system searches in the Bundle Directory, NSLibraryDirectory, NSDocumentsDirectory, and NSDownloadsDirectory, in that order.
I can get the instruments working in the app bundle, but now I'm trying to support downloaded instruments. If I put the content in <NSLibraryDirectory>/Sounds/
, the AUSampler can't find the .wav
samples, but if I put it in <NSDocumentsDirectory>/Sounds/
, it works. I don't want to clutter the Documents directory with the instruments though, as that folder shows up in iTunes.
This is the error printed by the AUSampler:
09:27:25.251 ERROR: [0x19989c310] 372: Failed to locate sample 'file:///Sounds/trance/square-lead/Square-12000Hz.wav'
Also, I can't even create a directory at the NSDownloadsDirectory location - I just get an Operation not permitted error.
Has anyone successfully loaded samples from the Library before?
(This is on iOS 8.)