Video: Triggering lights with guitar frequency levels

EQTrigger

Had an idea after catching this post on Hack a Day, why not use the frequency level values to trip a 120 volt relay? So I ordered some parts and did it. The audio analyzing chip, the MSGEQ7, is easily accessed using DFRobot’s DFR0126, which, being in Canada, I got from RobotShop. Connecting the breakout board to an Arduino Nano was a 5 minute job, sample code and a library is linked from the DFRobot product page. I initially used a potentiometer to input the threshold levels for the relay, but then realized I could use a momentary switch to sample the desired threshold and then use that to compare the real-time input to.

The circuit is simple, when a button (momentary stomp) is depressed, and we all get depressed sometimes, the code saves the input values from the audio analyzer. There are seven frequency bands it records, but I found only three or four of them are applicable to guitar, so ignore the lowest and perhaps the highest two. After a threshold has been recorded simply check the input against the recorded levels and trip the relay (or not).

I gave the thresholds a grace of 5 (on a theoretical input range of 0-1023), I may add a pot for this adjustment as it may vary based on guitar signal types. The result is quite versatile, you could have the relay turn off a mellow light and turn on a spastic light when the signal goes loud. If you pay close enough attention to EQ bands and levels you could trigger various lights based on a variety of guitar effects. This setup would also allow, albeit in a roundabout way, you to engage a guitar effect based on the frequency band levels, as long as the effect will pass-through without power then connecting it to the relay would engage the effect — or you could redesign this circuit to route some audio signals based on the input levels.


The pedal I stomp in the video is the MP-1 fuzz from Inductor Guitars, the EQTrigger pedal is connected to the extra output on a Boss TU-2 tuner and is reacting auto-magically to the change in guitar signal when I play louder or engage the fuzz.



Parts List

eqtrigger
Okay, so I didn’t spend a lot of time working out a clean circuit diagram — at least I didn’t use as much electrical tape in the diagram.

Arduino Sketch


#include <AudioAnalyzer.h>
Analyzer Audio = Analyzer(4,5,0);

int FreqVal[7];
int FreqThreshVal[7];

int switchPin = 3;
int switchValue = 0;

int relayPin = 2;

void setup()
{
  pinMode(relayPin, OUTPUT);
  pinMode(switchPin, INPUT);

  for(int i=0;i<7;i++)
    FreqThreshVal[i] = 512;

  //Serial.begin(57600);
  Audio.Init();
}

void loop()
{
  Audio.ReadFreq(FreqVal);//return 7 value of 7 bands pass filiter
                          //Frequency(Hz):63  160  400  1K  2.5K  6.25K  16K
                          //FreqVal[]:      0    1    2    3    4    5    6  

  switchValue = digitalRead(switchPin);  

  if(switchValue == HIGH)
  {
    for(int i=1;i<5;i++)
    {
       FreqThreshVal[i] = FreqVal[i];
       /*
       Serial.print(max((FreqVal[i]-100),0));

       if(i<6)
        Serial.print(",");
       else
        Serial.println(" SET ");
        */
    }
  }
  else
  {
    boolean thresholdMet = true;

    for(int i=1;i<5;i++)
    {
       //Serial.print(max((FreqVal[i]-100),0));

       if(FreqVal[i] < FreqThreshVal[i]-5)
         thresholdMet = false;

       /*
       if(i<6)
         Serial.print(",");
       else
         Serial.println(" READ ");
         */
    }  

    if(thresholdMet == true)
    {
      //Serial.println(" MET ");
      digitalWrite(relayPin, HIGH);
    }
    else
    {
      digitalWrite(relayPin, LOW);
    }
  }
}
  1. Guitar EQ levels trigger the stage lights - RaspberryPiBoards - pingback on April 11, 2013 at 3:07 pm
  2. rndm(mod) » Guitar EQ levels trigger the stage lights - pingback on April 11, 2013 at 3:08 pm
  3. Guitar EQ levels trigger the stage lights | Blog of MPRosa - pingback on April 11, 2013 at 3:20 pm
  4. Well done, thanks for sharing!

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>