so to figure out which bin relates to what frequency, you need to know the sample rate. if you are using the default example from the library, that is 38kHz.

Frequency(k) = (k)*(sample_rate)/(FHT_N)

k is just the bin number.

if you want a pin to go high based on a certain frequency, just figure out which bin that is, and then check the value in that bin compared to a threshold, and set the pin high if its above the threshold

How can I change the sampling rate? I this is how it works...If I increase the sampling rate, the smaller the bin size will be and the more accurate the signal is represented right? But doing that will slow the transformation right?

I was interested in around 4kHz. But I also want to experiment will other frequencies.

guest wrote:im not sure what your asking here:"Could you give me an example of how I would detect the bin that contains the frequency I want to detect?"

Sorry, it was a little confusing! I just wanted to write a digital high on a pin once a frequency is present. So in order to do this, I need to wait until a specified bin reaches above a threshold... (I think?)

/*fht_adc.pdeguest openmusiclabs.com 9.5.12example sketch for testing the fht library.it takes in data on ADC0 (Analog0) and processes themwith the fht. the data is sent out over the serialport at 115.2kb. there is a pure data patch forvisualizing the data.*/

k = (j << 8) | m; // form into an int k -= 0x0200; // form into a signed int k <<= 6; // form into a 16b signed int fht_input[i] = k; // put real data into bins

well I just kept that the same... I didn't think I had to mess with that.

For right now, I just want to display the frequency on the serial port. I will worry about detecting a certain bin a little later on. You might have to just write down the necessary changes and spell it out for me since I am not getting it! Sorry about all the trouble!