Returns the index of a specific frequency for FFT data.

**Namespace:** Un4seen.Bass**Assembly:** Bass.Net (in Bass.Net.dll) Version: 2.4.12.0

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

Public Shared Function FFTFrequency2Index (
frequency As Integer,
length As Integer,
samplerate As Integer
) As Integer

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

static member FFTFrequency2Index :
frequency : int *
length : int *
samplerate : int -> int

#### 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:

Int32The index within the FFT data array (max. to length/2 -1).

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]).

#### Reference