BASS.NET API for the Un4seen BASS Audio Library

UtilsFFTFrequency2Index Method

BASS.NET API for the Un4seen BASS Audio Library
Returns the index of a specific frequency for FFT data.

Namespace:  Un4seen.Bass
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

public static int FFTFrequency2Index(
	int frequency,
	int length,
	int samplerate
)

Parameters

frequency
Type: SystemInt32
The frequency (in Hz) for which to get the index.
length
Type: SystemInt32
The FFT data length (e.g. 4096 for BASS_DATA_FFT4096).
samplerate
Type: SystemInt32
The sampling rate of the device or stream (e.g. 44100).

Return Value

Type: Int32
The index within the FFT data array (max. to length/2 -1).
Remarks

Example: If the stream is 44100Hz, then 16500Hz will be around bin 191 of a 512 sample FFT (512*16500/44100). Or, if you are using BASS_DATA_FFT4096 on a stream with a sample rate of 44100 a tone at 540Hz will be at: 540*4096/44100 = 50 (so a bit of the energy will be in fft[51], but mostly in fft[50]).
See Also

Reference