Is this possible?

Hello,

I want to ask if a certain project I want to undertake would be possible with a single arduino processor.
I'm really new to programming, my only background is half a year of AP Computer Science that I'm currently enrolled in at my high school. I haven't really looked around the forum too much, I wanted to ask if it were possible before I started looking into how to do it.

Ok, so I have one of these:

It's a midi controller. I wanted to start dj'ing live, but triggering my own lights to be in sync with the music. I wanted to know if it would be possible with arduino. I'd figure out all of the specifics later on, I just want to know for now whether or not it's possible. I wanted to build several 20x20 LED light panels and have them all flash simultaneously at different tempos, at different frequencies, all triggered by the controller. So, for example, one row of buttons could be 128 bpm, with the lights flashing in quarter notes, eighth notes, sixteenth notes, etc depending on the button I pressed. Another row would be 140 bpm, another could be 110, and so on. I'd originally planned to build every panel with it's own processor, but then I realized that might be stupid/inefficient and a bit too expensive. Could I manage to do all this with a single processor? If so, which one should I be looking at?

Some other things; does a frequency sensor exist? Like, something that could change how bright a light is depending on the sound frequencies it picks up? So, say, if I cut out all the high frequencies, the lights dim, and then get bright again as soon as I bring them all back? Similarly, does something exist to detect how loud a sound is? Any other suggestions?

I know this all sounds super pipe-dreamy, maybe even a bit childish, but I feel like it'd be a really cool project to take on if it were actually possible. Especially now that I'm actually starting to look forward to my programming class at school.

I guess I'll have a look in the LEDs and Multiplexing forum while I wait :stuck_out_tongue:

Thanks!

Probably possible. ..... For someone that is proficient in electronics and coding.

Weedpharma

Sound activated lighting is a fairly common Arduino application. I've made a few sound-activated lighting effects... I've made a 4-channel AC lighting effect that uses colored floodlights (usually 4 different colored pairs plugged-in, but sometimes 16 smaller white floods), a dual 24-LED "VU meter" effect, and a 7-channel effect that controls 8 strings of 7-lights built into the ceiling of my van (the van came with the lights, and I "re-wired" them). Actually, each of these is several different effects that run randomly.

Ok, so I have one of these:

http://createdigitalmusic.com/files/2013/04/launchpad_s.jpg

I'm not familiar with the Launchpad. If it's pure MIDI, it's relatively easy. MIDI commands are notes/instruments/timing that trigger a synthesizer or virtual synthesizer. You can "capture" the MIDI commands and instead of playing a particular note on a particular instrument (or a particular drum), you can trigger a light.

It's easier to "plug into" regular-old serial MIDI than USB MIDI. In either case you'll need some additional hardware.

I wanted to build several 20x20 LED light panels and have them all flash simultaneously at different tempos, at different frequencies, all triggered by the controller.

So, all 400 LEDs in the 20x20 panel will switch on & off together, acting as one light?

The Arduiino has 14 general purpose I/O pins, so you can directly control several lights, depending on the number of pins you need for other purposes (such as MIDI). If you don't need to dim, you can use serial shift registers and control many lights/channels with just 3 output lines. My 8-foot VU meter effect has 48 individually addressable LEDs all controlled from 3 output pins.

Some other things; does a frequency sensor exist?

Yes, but like I said you don't need it for MIDI because MIDI knows the notes.

For regular audio it can be done with hardware filters or software (look-up "FFT"). There is a super-handy little chip called the [u]MSGEQ7[/u] that takes an analog input and gives you 7 frequency bands.

With regular music, it's almost impossible to detect the actual "note" being played because musical instruments generate overtones and harmonics, and real music (and instruments that play chords) has more than one note at a time. But, you can still get a good effect (look-up "Spectrum Analyzer").

Like, something that could change how bright a light is depending on the sound frequencies it picks up? So, say, if I cut out all the high frequencies, the lights dim, and then get bright again as soon as I bring them all back?

Once you get the data, you can dim or do whatever you want.

There are basically 3 different methods of dimming for regular LEDs, high-power LEDs, and incandescent lamps. (Add a 4th method if you need to dim fluorescent amps.)

Similarly, does something exist to detect how loud a sound is?

Yes. The Arduino has analog inputs. The MSGEQ7 gives you 7 time-multiplexed analog signals, each proportional to the "loudness" of the related frequency band.

Again, with MIDI the loudness is included in the command (it's called velocity in MIDI for how hard you hit the key or how hard you pluck the string, etc.)

With analog audio, there is one thing you need to take care of... Audio is AC, which goes positive and negative. The Arduino can be damaged by negative voltages (and/or the Arduino could distort the negative half of your audio waveform). The most popular solution is to bias the input at 2.5 Volts. (I'll leave the details out for now).

I use an op-amp circuit called peak detector that throws-away the negative-half of the waveform and "holds" the peak level for a short period of time. It gives you a varying DC voltage proportional to the loudness. That means you only have to sample the volume at around 10 times per second instead sampling the audio waveform thousands of times per second, freeing-up the processor to do other things. The downside to a peak detector is that it throws-away the frequency information.

Any other suggestions?

You generally needs lots of variation & "randomness". Any lighting effect can get boring rather quickly. For example, my VU meter effect is only one effect mode. There is a handful of other sequencing/flashing modes. And, the VU meter randomly reverses directions (where louder is down instead of up), it inverts (where the loudness turns the LEDs off instead of on). And, the left channel can be reversed while the right channel remains normal or vice-versa, etc. There is a "dot mode" (with only one LED on at a time) in addition to the regular bar-graph mode, and a "dots mode" with some random number of LEDs on at a time.

A very simple "flicker" effect can be made by taking a moving loudness-average over 15-30 seconds and turning the light on whenever the sound is above average and off whenever it's less than average. I expand this a bit by loading a random pattern into the 24 LEDs in each channel, and then when it's louder than average the LEDs that were off toggle-on, and the LEDs that were on toggle-off.

All of my effects use the average volume to automatically and continuously calibrate to volume changes or louder/quieter music. I also switch between the 5V and 1.1V ADC reference depending on the signal level. (When I switch the reference, I have to re-calculate the moving average to compensate.)

None of my effects are based on frequency. They are just based on the loudness and some crude beat detection, but I still get plenty of interesting variations. Frequency detection can add another dimension. Another thing that can add variety is to use RGB (color-changeable) LEDs.

I actually prefer "loose" beat detection that responds more to loudness than simply flashing/blinking to the same-constant (boring) tempo through the song.

I wanted to build several 20x20 LED light panels

If you are planning on hand-wiring & hand soldering 400 LEDs, that's a ship-load of wiring!!!! It took me "forever" to wire-up 48 LEDs. (Part of the difficulty was the mechanical construction I chose.)

Hey, really appreciate the detailed answer man.

I've made a few sound-activated lighting effects...

Do you have any pictures/videos of your van setup? I'm really curious as to how that would look like in action :stuck_out_tongue:

I'm not familiar with the Launchpad...

It's mainly used to trigger samples in real time for performances. Here's a popular demo:

The main thing here is that touching any button on there is a command, and I can use that command to manipulate the lights, right? How would I go about "capturing" those commands? I'm not entirely sure what you mean by serial and USB MIDI. I'm assuming that "plugging-into" is taking the information from the controller and passing it on to whatever light. My main concern here is whether or not I'll be able to make the lights flicker at different rates, whether those rates could be defined tempos, and whether I could trigger each of the rates with different buttons, all using the one arduino processor. I'm sure I could trigger whatever light I'd like using whatever button I'd like, I just want to know the feasibility of using a MIDI controller to do so, as well as if what I have in mind is possible.

Yes, but like I said you don't need it for MIDI because MIDI knows the notes.

I actually wanted to have certain lights operate independently of the MIDI-triggered ones. I would have them coming in and out as their respective frequencies would come and go, while the MIDI-tiggered LEDs flicker all over the place. Same goes for the volume-sensitive lights that I was thinking about. The velocity values for whatever MIDI input wouldn't really matter. Again, would this all be possible with a single Arduino processor?

I have a few other questions but I'll have to post them later, I have school tomorrow... Anyway, thanks again. Feel free to tell me to research some stuff on my own. I understand how silly some of my noobier questions can seem :smiley:

This takes me back to my youth. One of the first circuits I designed and built from scratch was a "chromatone"
With 3 spot lamps following the bass, mid range and treble. I used a pair of EL34 to drive each lamp. Not a transistor in sight, let alone a microcontroller. Doubt it would have much relevance now :slight_smile:

So after googling EL34, I still don't know how that would work lol. Aren't EL34 audio amplifiers? And how'd you split the frequencies? I'd like to make something like that before I decide to start on the bigger project. It'd definitely be useful for what I want to do. It would free up the arduino processor to do other stuff.

Ok so, continuing my 2nd to last post...

It's easier to "plug into" regular-old serial MIDI than USB MIDI. In either case you'll need some additional hardware.

The Launchpad definitely has USB MIDI. However, all the USB-MIDI related products on the website you linked to are "retired," and looked significantly harder to work with than the serial MIDI hardware that is available. I'm still willing to look into it though.

This topic seems to have what I need, I think

My processor would need to have something to receive the MIDI information, and then something to send it back out, right? Or would it just need MIDI input and then have it be interpreted by whatever program I load into the processor? Like I said, I don't really need pitch/velocity values for what I want to do. At least I don't think so...

The Arduino has analog inputs... The Arduino can be damaged by negative voltages (and/or the Arduino could distort the negative half of your audio waveform).

Does that mean I'll need a microphone to detect the sounds? KenF said that he made a chromaphone without using a processor, so do I have to worry about the negative voltages if I don't use the arduino and just use the chip with whatever other components I need?

Apart from the peak detector, I'd still like to know another workaround if ever I need to actually use a processor to take in analog audio and retain frequency info. Does anything exist to convert the negative voltage to positive voltage, while still keeping the frequency information? Seems more practical than the peak detector, and not too far out.

Any lighting effect can get boring rather quickly...

Yeah I agree, that's why I want to make a whole bunch of different patterns for the lights to flash to and use various tempos, and at the same time have some MIDI independent lights that work on their own based on frequency and and loudness or both. RGB LEDs would definitely be something to look into.

400 LEDs

Yeah that might be overkill... I just want it to be bright enough. I found this place online that sells LEDs for fractions of pennies, and thought "why not?" haha. I'd imagine the soldering wouldn't be too hard, just tedious, right? Wouldn't it just be the same thing over and over?

Thanks again~

EDIT - sorry or the double post, I know that used to piss people off on all the other forums I've gone on...