Hello. Apologies for the slightly off-topic question, but I can't think of a better group to consult when it comes to SoundFont questions.
I'm currently working on some Java code to parse SoundFonts. While I've completed the actual parsing in the sense that I can extract all of the data from a given SF2 file, I'm struggling to interpret some of that data. Specifically, I'm seeing pbag entries in valid and playable SoundFonts that don't make any sense to me, and I can't seem to find an explanation for them in the spec. Here's an example of parsing one such soundfont (http://ataxia.io7m.com/2019/02/22/basic.sf2): TRACE com.io7m.jnoisetype.vanilla.NTParsers: [phdr][0] NTParsedPreset{name=NTPresetName{value=p0}, preset=0, bank=0, presetBagIndex=0, library=0, genre=0, morphology=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [phdr][1] NTParsedPreset{name=NTPresetName{value=p1}, preset=1, bank=0, presetBagIndex=2, library=2, genre=2, morphology=2} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pbag][0] NTParsedPresetZone{generatorIndex=0, modulatorIndex=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pbag][1] NTParsedPresetZone{generatorIndex=0, modulatorIndex=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pbag][2] NTParsedPresetZone{generatorIndex=2, modulatorIndex=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pbag][3] NTParsedPresetZone{generatorIndex=2, modulatorIndex=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pgen][0] NTParsedPresetZoneGenerator{generatorOperator=43, amount=NTGenericAmount{value=32512}} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pgen][1] NTParsedPresetZoneGenerator{generatorOperator=41, amount=NTGenericAmount{value=2}} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pgen][2] NTParsedPresetZoneGenerator{generatorOperator=43, amount=NTGenericAmount{value=32512}} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pgen][3] NTParsedPresetZoneGenerator{generatorOperator=41, amount=NTGenericAmount{value=1}} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [inst][0] NTParsedInstrument{name=NTInstrumentName{value=i0}, instrumentIndex=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [inst][1] NTParsedInstrument{name=NTInstrumentName{value=i1}, instrumentIndex=3} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [inst][2] NTParsedInstrument{name=NTInstrumentName{value=i2}, instrumentIndex=6} Note that file contains two presets, p0 and p1, and those presets link to the i0 and i2 instruments via the pgen[1] and pgen[3] entries. However, according to the spec, I have to read pbag entries starting at the presetBagIndex for each preset. So, when I read pbag[0] and pbag[1] as part of interpreting p0, I encounter: TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pbag][0] NTParsedPresetZone{generatorIndex=0, modulatorIndex=0} TRACE com.io7m.jnoisetype.vanilla.NTParsers: [pbag][1] NTParsedPresetZone{generatorIndex=0, modulatorIndex=0} Duplicate entries that both point to pgen[0]. Not pgen[0] and pgen[1] as I would expect. I've inspected the data in a hex editor and those duplicate entries are definitely present. Multiple SF2 implementations (including Fluidsynth) parse and play them correctly. How do I interpret those presets such that I can correctly link them to the instrument definitions? -- Mark Raynsford | http://www.io7m.com
pgp_PjUsik2UI.pgp
Description: OpenPGP digital signature
_______________________________________________ fluid-dev mailing list fluid-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/fluid-dev