Ds2 Wav Converter
I assume you mean sd2, or SDII, in other words Sound Designer II? There are several software packages around that can do this job and the easy method is to use one of those available software packages and try to automate them from your application, on such: or w/source:. Here's a quick guide to some popular commandline tools, but it does not include sd2, however, the tools may support it regardless.
Convert your ds2 and wav files free and easy online with the following audio converters. Convert your ds2 and wav files free and easy online with the following audio converters.
Wav Converter
If you want to do it directly from your application without an external software package you can use the open source for MP3 and the open source for the sound conversion. There's a ready-made library for C# that does just that, which comes with source. You will have to add the option for SD2 yourself, but the structure is there for you to use.