How to get the FFT for specific channels in the device

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:

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!

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, 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.

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_getmeteringinfo

1 Like