# How to get the FFT for specific channels in the device

**URL:** <https://qa.fmod.com/t/how-to-get-the-fft-for-specific-channels-in-the-device/17441>\
**Category:** FMOD Engine\
**Created:** [July 15, 2021, 4:08am UTC](https://qa.fmod.com/t/how-to-get-the-fft-for-specific-channels-in-the-device/17441 "2021-07-15T04:08:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Opus.Pier](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/opus.pier/32/2221_2.png) [@Opus.Pier](https://qa.fmod.com/u/Opus.Pier)\
**Post date:** [July 15, 2021, 4:08am UTC](https://qa.fmod.com/t/how-to-get-the-fft-for-specific-channels-in-the-device/17441/1 "2021-07-15T04:08:17Z")

</div>

Hi,

My main goal is to get how “loud” the input from a mic is.

Right now I’m using something based on the example in the link below to get the spectrum data, and then look for the higher values to determine the loudness:

> [@Getting spectrum of master channel in Unity...](https://qa.fmod.com/t/getting-spectrum-of-master-channel-in-unity/12579):
>
> Hey all! I’m new to FMOD and I’m using it to create an audio visualizer in Unity (so I’m using c#). I have the visualizer working using the getSpectrum function from Unity’s native audio engine, but I’d like to switch to FMOD. Unfortunately, I’m unsure of how exactly to do this. From what I understand, I need to create a custom DSP, add it to my master channel, and then use the getParameterData function on it in update in order to get the frequency spectrum at every frame. I suppose my ques…

This seems to be working fine, particularly when using a “normal” mic (1-2 channels).  
But I want to be able to use an Asio device that has 12 input channels, and using that device I see a significant drop in the fps.  
After profiling, the part that takes most of the time seems to be the FFT.

I actually only need 1 or 2 channels from that device, so I’d like to know if it’s possible to have the spectrum analysis only on those specific channels.

Or, any suggestions on how to get decent results for the mic volume with faster methods (ie not using spectrum analysis), would also be appreciated.

(For reference, I’m programming in Unity but without FMOD Studio.)

Thanks!

---

<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:** [July 19, 2021, 3:00am UTC](https://qa.fmod.com/t/how-to-get-the-fft-for-specific-channels-in-the-device/17441/2 "2021-07-19T03:00:19Z")

</div>

> [@Opus.Pier](#):
>
> (For reference, I’m programming in Unity but without FMOD Studio.)

Sorry, does this mean you’re using stock Unity, or that you have installed the FMOD Unity integration plugin and using the Core system?

---

<div class="post-metadata">

**Author:** ![Opus.Pier](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/opus.pier/32/2221_2.png) [@Opus.Pier](https://qa.fmod.com/u/Opus.Pier)\
**Post date:** [July 21, 2021, 8:26am UTC](https://qa.fmod.com/t/how-to-get-the-fft-for-specific-channels-in-the-device/17441/3 "2021-07-21T08:26:28Z")

</div>

> Sorry, does this mean you’re using stock Unity, or that you have installed the FMOD Unity integration plugin and using the Core system?

Sorry for making it unclear.  
The latter: I’m working on a Unity project that has a somewhat old version of FMOD (1.10.11) and has only the Core system.  
(I think updating the FMOD version could be doable, if necessary. But changing it to FMOD Studio seems too much trouble.)

About my original goal (getting how ‘loud’ a mic is), changed the code to use the PCM data I’m getting from FMOD, instead of using the spectrum data.  
Basically, I’m looking for the highest set of values there, getting the root mean square of them, and normalizing the result to a 0-1 range.  
(Actually, I was doing pretty much the same before, just with the spectrum data and changing to decibels before normalizing.)

I’m guessing this is probably not an accurate value for the ‘loudness’, but seems to be working fine and fast enough.  
Still curious if the FTT could be applied to only part of the input channels, though, in case I might happen to need it later.

---

<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:** [July 21, 2021, 2:34pm UTC](https://qa.fmod.com/t/how-to-get-the-fft-for-specific-channels-in-the-device/17441/4 "2021-07-21T14:34:59Z")

</div>

Thank you for the clarification. In that case, you can enable metering on a DSP and get the info from there. These DSPs can be placed on a channel group or wherever you feel the need.

[https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-dsp.html#dsp\_setmeteringenabled](https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-dsp.html#dsp_setmeteringenabled)

[https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-dsp.html#dsp\_getmeteringinfo](https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-dsp.html#dsp_getmeteringinfo)
