3

It is possible using AudioUnits on iOS to create samplers that load and play soundfont (or SF2) files. This is a really great feature. The problem is that I don't see any interface for inspecting a soundfont to see: a) how many presets it contains and b) the names of the presets it contains.

It is possible to obtain the current preset name by first loading the soundfont into the sampler using AudioUnitSetProperty with kAUSamplerProperty_LoadInstrument and then calling AudioUnitGetProperty with kAudioUnitProperty_ClassInfo on the sampler. This is not very efficient however, and only tells you the name of the currently loaded preset. It also does not seem to tell you how many presets are contained in the soundfont.

How does one do these things without using 3rd party code (surely it is natively supported)?

Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
Ruben
  • 1,950
  • 1
  • 12
  • 13
  • To answer my question, the workaround I found is the following. I am using the `kAudioUnitProperty_ClassInfo` property to grab the name of the current preset. Then iterating through all the presets until `AudioUnitSetProperty` returns an error, indicating that the last preset has been reached. Then I put all the preset names into an NSArray and save this data to disk. Then I can simply load it back from the file next time I need to use the same soundfont. Works well enough for my current purposes. – Ruben Oct 13 '12 at 05:30

2 Answers2

1

Another option is a soundfont editor for OSX called polyphone

robuch
  • 51
  • 7
1

This is a very old question, but I do have another solution: my SoundFonts application. It is available on the AppStore for a small fee, or you can use the source to build what you want.

The repo contains an SF2 parser in C++ that I reworked from some code I found online. The repo also contains a catalog.py Python script that generates listing from a SF2 file. It uses the sf2utils Python package.

Brad Howes
  • 114
  • 1
  • 6