iOS AUSampler audiounit - file path issue with EXS

2019-02-15 10:50发布

Following the Apple docs here I have been able to successfully load a GarageBand EXS sampler instrument into AUSampler in my iOS app by recreating, for example the following path within my app directory:

/Sampler Files/Funk Horn Section/nameofaudio.aif

iOS looks for the audio file in the following directory:

file:///Library/Application%20Support/GarageBand/Instrument%20Library/Sampler/Sampler%20Files/Funk%20Horn%20Section/'

However this doesn't work when I create my own EXS file. How does it know to remove the first part of the filepath if GarageBand?? I've even tried creating my EXS instrument and even created in the same GarageBand directory but it makes no difference:

Failed to locate sample '001%20VirusTI%20-%20SeaThr%2314A1B3.aif -- file:///macSSD/Library/Application%20Support/GarageBand/Instrument%20Library/Sampler/Sampler%20Files/VirusTI%20-%20SeaThreeHS%20v2/'

I've also tried manually editing the file path in the exs file with a text editor but nothing works.

The EXS instrument plays fine in logic. But my app can't find it.

Any help greatly appreciated.

1条回答
干净又极端
2楼-- · 2019-02-15 11:14

The key here is that your source sampler file has to reference samples that come from any of these 'trigger' directory structures to work properly:

"/Sounds/" "/Sampler Files/" "/Apple Loops/" "/EXS Factory Samples/" "/SoundFont Samples/"

Your sample has to exist in a directory path with one of those triggers in it, and then the path has to match the exact same in your bundle. iOS looks for one of those triggers, then deletes everything before that, and uses that as the new search path in the bundle to find your sample. It is tricky, but it will work this way if you make sure everything is in order.

I fought with this because my samples were stored in places without any of those keywords, and so it would never find them.

查看更多
登录 后发表回答