#define OCTAVE 1 // // Group buckets into octaves (use the log output function LOG_OUT 1)
#define OCT_NORM 0 // Don't normalise octave intensities by number of bins
#define FHT_N 256 // set to 256 point fht
#include <FHT.h> // include the library
//int noise[] = {204,188,68,73,150,98,88,68}; // noise level determined by playing pink noise and seeing levels [trial and error]{204,188,68,73,150,98,88,68}
// int noise[] = {204,190,108,85,65,65,55,60}; // noise for mega adk
int noise[] = {204, 195, 100, 90, 85, 80, 75, 75}; // noise for NANO
//int noise[] = {204,198,100,85,85,80,80,80};
float noise_fact[] = {15, 7, 1.5, 1, 1.2, 1.4, 1.7, 3}; // noise level determined by playing pink noise and seeing levels [trial and error]{204,188,68,73,150,98,88,68}
float noise_fact_adj[] = {15, 7, 1.5, 1, 1.2, 1.4, 1.7, 3}; // noise level determined by playing pink noise and seeing levels [trial and error]{204,188,68,73,150,98,88,68}
#define OCTAVE 1 // // Group buckets into octaves (use the log output function LOG_OUT 1)
#define OCT_NORM 0 // Don't normalise octave intensities by number of bins
#define FHT_N 256 // set to 256 point fht
#include <FHT.h> // include the library
//int noise[] = {204,188,68,73,150,98,88,68}; // noise level determined by playing pink noise and seeing levels [trial and error]{204,188,68,73,150,98,88,68}
// int noise[] = {204,190,108,85,65,65,55,60}; // noise for mega adk
int noise[] = {204, 195, 100, 90, 85, 80, 75, 75}; // noise for NANO
//int noise[] = {204,198,100,85,85,80,80,80};
float noise_fact[] = {15, 7, 1.5, 1, 1.2, 1.4, 1.7, 3}; // noise level determined by playing pink noise and seeing levels [trial and error]{204,188,68,73,150,98,88,68}
float noise_fact_adj[] = {15, 7, 1.5, 1, 1.2, 1.4, 1.7, 3}; // noise level determined by playing pink noise and seeing levels [trial and error]{204,188,68,73,150,98,88,68}
Serial.println(LEDS.getFPS(), DEC); // Display frames per second on the serial monitor.
Serial.println(" "); // Display frames per second on the serial monitor.
Serial.println(analogRead(inputPin)); // print as an ASCII-encoded decimal */
}
void fhtsound() {
// hueinc++; // A cute little hue incrementer.
GetFHT(); // Let's take FHT_N samples and crunch 'em.
for (int i = 0; i < NUM_LEDS; i++) { // Run through the LED array.
int tmp = qsuba(fht_log_out[2 * i + 2], noiseval); // Get the sample and subtract the 'quiet' normalized values, but don't go < 0.
if (tmp > (leds[i].r + leds[i].g + leds[i].b) / 2) // Refresh an LED only when the intensity is low
leds[i] = CHSV((i * 4) + tmp * micmult, 255, tmp * micmult); // Note how we really cranked up the tmp value to get BRIGHT LED's. Also increment the hue for fun.
leds[i].nscale8(fadetime); // Let's fade the whole thing over time as well.
}
} // fhtsound()
void GetFHT() {
cli();
for (int i = 0 ; i < FHT_N ; i++) fht_input[i] = analogRead(inputPin);
sei();
fht_window(); // Window the data for better frequency response.
fht_reorder(); // Reorder the data before doing the fht.