Reputation: 21
I'm working on parsing an SF2 file in C and extracting information like sample data and preset headers. I've successfully identified the main chunks (INFO, sdta, and pdta) and read several sub-chunks like phdr, pbag, and shdr. However, I'm having trouble understanding how these sections interact, especially when linking presets to their corresponding samples through the generator and modulator sections (pgen, igen, etc.).
For example, while reading the phdr and pbag chunks, I can see references to indices in other sections, but it's unclear how to follow these indices to retrieve the associated sample data correctly. The documentation I've found is either incomplete or ambiguous about the relationships between these chunks.
I can provide code snippets of how I'm handling the file parsing so far if that would help clarify my implementation.
Does this provide the context you need?
I parsed all the sections (phdr, pbag, pgen, inst, ibag, igen, shdr, etc.) and verified their sizes and indices.
I attempted to map presets to zones using IdxPbag and instruments to their zones using IdxIbag, but the resulting mappings don’t seem consistent with the preset or instrument names.
I expected each preset to reference its zones and instruments, and each instrument to reference its associated samples, but I’m not sure how to correctly traverse the indices or interpret some of the generator/modulator values.
I’ve also tried debugging with sample SF2 files, but I am unable to confidently determine the relationships.
Any guidance, code examples, or clarification would be greatly appreciated!
Upvotes: 2
Views: 17