# FmodAudio wrapper in C#, but how to use?

**URL:** <https://qa.fmod.com/t/fmodaudio-wrapper-in-c-but-how-to-use/17196>\
**Category:** FMOD Engine\
**Tags:** csharp\
**Created:** [May 13, 2021, 3:18pm UTC](https://qa.fmod.com/t/fmodaudio-wrapper-in-c-but-how-to-use/17196 "2021-05-13T15:18:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saiaku](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Saiaku](https://qa.fmod.com/u/Saiaku)\
**Post date:** [May 13, 2021, 3:18pm UTC](https://qa.fmod.com/t/fmodaudio-wrapper-in-c-but-how-to-use/17196/1 "2021-05-13T15:18:35Z")

</div>

I’m trying to extract spectral information using this [GitHub - sunkin351/FmodAudio: C# .NET 5+ Wrapper for the Fmod audio library](https://github.com/sunkin351/FmodAudio), but there is some information lacking on how to use it.  
It implements the Fmod binaries and all underlying code.

I want to do something like (the params are slightly different from the official documentation, instead of 2 out params, it returns the result as a void\*)

> var res = fftPass.GetParameterData(index, out length)

but for the index parameter, I can’t find the [DSP::getNumParameters] object, so I am not sure what to pass in there. The result is probably(?) an IntPtr, and this result has to be converted via a Marshall.PtrToStructure(…) into a ParameterFFT object.

The block of code looks like this:

> fftPass = System.CreateDSPByType(DSPType.FFT);  
> fftPass.Active = true;  
> fftPass.Bypass = true;
> 
> unsafe  
> {  
> uint length;  
> IntPtr unmanagedData = (IntPtr)fftPass.GetParameterData(0, out length);  
> ParameterFFT fftdata = (ParameterFFT) Marshal.PtrToStructure(unmanagedData, typeof(ParameterFFT));  
> var spectrum = fftdata.Spectrum;
> 
> }

What am I doing wrong apart from not knowing the index of the GetParameterData?  
Any guidelines would be helpful, thank you.

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [May 19, 2021, 1:27am UTC](https://qa.fmod.com/t/fmodaudio-wrapper-in-c-but-how-to-use/17196/2 "2021-05-19T01:27:41Z")

</div>

We have some examples on using the `GetParameterData()` function in this script, which should help you understand it a bit better.

[https://www.fmod.com/resources/documentation-unity?version=2.2&page=examples-spectrum-analysis.html](https://www.fmod.com/resources/documentation-unity?version=2.2&page=examples-spectrum-analysis.html)
