This is a Swift package for parsing SoundFonts
Read the blog post. Or just read the code. Or run the tests.
e.g. Listing the preset names
import GDSoundFontParser
func getPresets() {
let parser = GDSoundFontParser()
let sf: SoundFont
guard let fileURL = Bundle.module.url(forResource: "FreeFont", withExtension: "sf2") else {
return
}
do {
sf = try parser.parse(fileURL: fileURL)
let presets = sf.getPresets()
for p in presets {
print("\(p.name) (\(p.bank):\(p.preset)) \(p.presetBagIndex)")
}
} catch {
print("\(error.localizedDescription)")
}
}
If you find one, please add it to Issues
MIT License article on Wikipedia
Please read the LICENSE for details.