0
0
 public void SpectrumData()
        {
            if (sampleChannel == null)
            {
                var rusult = EventInstance.getChannelGroup(out sampleChannel);
                if (rusult == RESULT.OK)
                {
                    RuntimeManager.LowlevelSystem.createDSPByType(DSP_TYPE.FFT, out FFTDsp);
                    FFTDsp.setParameterInt((int)FMOD.DSP_FFT.WINDOWTYPE, (int)fFTWindow);
                    FFTDsp.setParameterInt((int)FMOD.DSP_FFT.WINDOWSIZE, 128);
                    sampleChannel.addDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, FFTDsp);
                }
                else return;
            }

            FFTDsp.getParameterData((int)FMOD.DSP_FFT.SPECTRUMDATA, out _unmanagedDataTemp, out _spectrumLenTemp);
            _fftData = (FMOD.DSP_PARAMETER_FFT)Marshal.PtrToStructure(_unmanagedDataTemp, typeof(FMOD.DSP_PARAMETER_FFT));
            Array.Clear(sample, 0, sampleSize);
            if (_fftData.numchannels > 0 && _fftData.spectrum[0].Length >= sampleSize)
            {
                Array.Copy(_fftData.spectrum[0], sample, sampleSize);
            }
        }

enter image description here

zero value always starts at 63 when windowsize set as 128

  • You must to post comments
0
0

Without going into the math too much i’ll just say this is correct, ie from wikipedia

There is a topic already, in this FMOD QA post

http://www.fmod.org/questions/question/how-to-set-dsp-fft-window-size/

“Yes. To be precise the first half of the FFT buffer contains the positive frequencies, which is what you’re interested in. The second half contains the negative frequencies, which is symmetrical to the positive frequencies.”

and its mentioned here

https://fmod-com-staging.herokuapp.com/resources/documentation-api?page=content/generated/FMOD_DSP_PARAMETER_FFT.html

“Only read/display half of the buffer typically for analysis as the 2nd half is usually the same data reversed due to the nature of the way FFT works.”

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.