libZPlay documentation (Win32)
IndexReferenceHome
PreviousUpNext
ZPlay.GetFFTData Method

Get FFT data for currently playing samples.

Visual Basic
Public Function GetFFTData(ByVal FFTPoints As Integer, ByVal FFTWindow As TFFTWindow, ByRef HarmonicNumber As Integer, ByRef HarmonicFreq() As Integer, ByRef LeftAmplitude() As Integer, ByRef RightAmplitude() As Integer, ByRef LeftPhase() As Integer, ByRef RightPhase() As Integer) As Boolean
Parameters 
Description 
ByVal FFTPoints As Integer 
Set this value to specify FFT size. This value must be power of 2. 
ByVal FFTWindow As TFFTWindow 
Set this value to specify FFT window
ByRef HarmonicNumber As Integer 
Reference to variable receiving number of harmonics returned from FFT analysis. NumberOfHarmonics = (nFFTPoints/2 + 1) 
ByRef HarmonicFreq() As Integer 
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.
 
ByRef LeftAmplitude() As Integer 
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.
 
ByRef RightAmplitude() As Integer 
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.
 
ByRef LeftPhase() As Integer 
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.
 
ByRef RightPhase() As Integer 
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