This project has moved. For the latest updates, please go here.

SoundFont presets

Nov 27, 2016 at 5:46 AM
Hi,
Im using the NAudio SoundFont class to access the parts of an sf2 file.
I see how to access the SampleHeaders and get the raw audio sample data bytes from the Start and End times, and their Loop starts/ends.
But I don't get how to connect the Presets to their associated SampleHeader data.
That is, if I want to get the Sample data for, say, the preset named "Organ 2", I need some sort of index which points to the SampleHeader for that preset. (The Preset.Name and SampleHeader.SampleName strings don't necessarily match.)

Thanks,
Dec 4, 2016 at 7:23 AM
Incidentally for those interested, I figured out how to do this.
First, you don't go through the Presets but rather the Instruments.
You have to go through the Zones and get their Generators, and access the Generators that are of GeneratorType.SampleID.
Those Generators will have an associated SampleHeader, from which you get the offsets for that Generator in the SampleData.

At least that's how I managed to do it...