Author Topic: BASS_BFX_PEAKEQ question.  (Read 686 times)

mackie928

  • Posts: 2
BASS_BFX_PEAKEQ question.
« on: 28 Sep '11 - 03:22 »
Is there a  way to use BASS_BFX_PEAKEQ to detect when a frequency is reached? I would like to trigger an event when each band of a eq is hit.

Thanks in advance!
« Last Edit: 28 Sep '11 - 04:10 by mackie928 »

Ian @ un4seen

  • Administrator
  • Posts: 20426
Re: BASS_BFX_PEAKEQ question.
« Reply #1 on: 28 Sep '11 - 15:07 »
That sounds like FFT data is what you want, which is available from BASS_ChannelGetData. For example, to get the level of a particular frequency, you could do something like this...

Code: [Select]
float fft[1024];
BASS_ChannelGetData(handle, fft, BASS_DATA_FFT2048); // perform a 2048 sample FFT
int bin=2048*frequency/samplerate+0.5; // calculate the nearest "bin" to the frequency of interest
float level=fft[bin]; // get the level of it

Please see the BASS_ChannelGetData documentation for details.

mackie928

  • Posts: 2
Re: BASS_BFX_PEAKEQ question.
« Reply #2 on: 29 Sep '11 - 06:13 »
Thank you Ian. After posting, I searched and found an example of what I need in a post by Radio42. I do appreciate the reply and the great work that you have put into the BASS lib.

I will try and implement BASS_ChannelGetData in to my project. Again, Thanks!