Hello!
I am working on code to analyze 6 frequencies of audio, and then turn that info into different brightnesses of led light. my setup involves an arduino uno, BlipTronics.com stereo audio analyzer(takes the load off the arduino, and will make coding easier) and finally 2 RGB amplifiers from usLEDsupply to power 2 strips of RGB leds. (so total of 6 total channels) here is my code... I am willing to compensate you for what you think is reasonable
THANK YOU!
P.S. my code currently puts up a nice light bluish color(color doesn't matter, just that it puts up light with no music being played) and doesn't actually analyze the music... I started to add a feature that would fade out the lights if no music was playing... but it doesn't want to work... it compiles.... but the light blue does not fade...
int SpectrumLeft[6];
int ledintensity[6];
int ledintensity2[6];
int ledintensity3[6];
int analyze1[6];
int analyze2[6];
int fadespeed;
byte LED;
byte LED2;
byte spect;
byte db;
int led6 = 6;
int led7 = 7;
int led8 = 8;
int led9 = 9;
int led10 = 10;
int led11 = 11;
//have a fade out based on whether or not the music is playing use this for ideas http://arduino.cc/en/Tutorial/Calibration
//maybe something like run analyze levels, wait, analyze again, if they are same, fade (another function)
void setup () {
pinMode(led6,OUTPUT);
pinMode(led7,OUTPUT);
pinMode(led8,OUTPUT);
pinMode(led9,OUTPUT);
pinMode(led10,OUTPUT);
pinMode(led11,OUTPUT);
}
//Add a for loop so animation is smoother http://www.arduino.cc/en/Reference/For (this is all the basic code that the anaylzer needs)
void readSpectrum() {
// Band 0 = Lowest Frequencies.
byte Band;
for(Band=0;Band <6; Band++){
SpectrumLeft[Band] = analogRead(0); //left
digitalWrite(4,HIGH); //Strobe pin on the shield
digitalWrite(4,LOW);
}
}
void same() {
for(LED2=6; LED2 <12; LED2++){
ledintensity2[LED2]=analyze1[LED2];
delay(1);
ledintensity2[LED2]=analyze2[LED2];
if (analyze1[LED2]==analyze2[LED2]) {
fadespeed = 75;
}
else {
fadespeed = 0;
}
}
}
void fade() {
if (fadespeed > 0) {
for(LED2=6; LED2<12; LED2++)
ledintensity2[LED2] - fadespeed;
}
}
void loop () {
for(LED=6; LED <12; LED++){
for(spect=0; spect <7; spect++){
for(LED2=6; LED2 <12; LED2++){
readSpectrum();`
ledintensity2[LED2]=(ledintensity[LED]+(25*SpectrumLeft[spect])); //this should in theory add the data of the analyzer to the base value for the lights, then send to the output the correct light level
fade();
}
}
}
analogWrite(led6, ledintensity2[6]);
analogWrite(led7, ledintensity2[7]);
analogWrite(led8, ledintensity2[8]);
analogWrite(led9, ledintensity2[9]);
analogWrite(led10, ledintensity2[10]);
analogWrite(led11, ledintensity2[11]);
}