Get FFT data for currently playing samples.
function GetFFTData(FFTPoints: Integer; FFTWindow: TFFTWindow; out HarmonicNumber: Integer; HarmonicFreq: TDynamicIntegerArray; LeftAmplitude: TDynamicIntegerArray; RightAmplitude: TDynamicIntegerArray; LeftPhase: TDynamicIntegerArray; RightPhase: TDynamicIntegerArray): Boolean;
Parameters |
Description |
FFTPoints: Integer |
Set this value to specify FFT size. This value must be power of 2. |
FFTWindow: TFFTWindow |
Set this value to specify FFT window. |
out HarmonicNumber: Integer |
Reference to variable receiving number of harmonics returned from FFT analysis. NumberOfHarmonics = (nFFTPoints/2 + 1) |
HarmonicFreq: TDynamicIntegerArray |
Reference to integer array receiving frequency of each harmonic. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics. |
LeftAmplitude: TDynamicIntegerArray |
Reference to integer array receiving amplitude of each harmonic for left channel. Amplitude range is from 0 to about 120 dB. User needs to allocate memory for this array. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics. |
RightAmplitude: TDynamicIntegerArray |
Reference to integer array receiving amplitude of each harmonic for right channel. Amplitude range is from 0 to about 120 dB. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics. |
LeftPhase: TDynamicIntegerArray |
Reference to integer array receiving phase of each harmonic for left channel. Phase range is from -90 to 90 degrees. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics. |
RightPhase: TDynamicIntegerArray |
Reference to integer array receiving phase of each harmonic for right channel. User must to allocate memory for this array. Use returned HarmonicNumber value to get number of harmonics. |
Return Values |
Description |
True |
All OK. |
False |
Error. To get error message read here. |
FFTPoints parameter specifies number of samples for FFT algorithm. This parameter must be power of 2. Larger value produces more harmonics and better frequency resolution. But this needs more processor power to calculate FFT algorithm.
Note: NumOfHarmnics = NumOfFFTPoints/2 + 1
Note: FFT data are fully synchronized with audio data from wave buffer.
Copyright (c) 2010. Zoran Cindori - All rights reserved.
Web: http://libzplay.sourceforge.net/ Email: zcindori@inet.hr |