Sound-LED mapping

Hey guys,

I have this issue I was hoping to get some help in.
Pseudocode-wise, I want to be able to turn on an LED when sound is played on my left headphone, and a different LED when sound is played on my right headphone.

Any advice? (functions, libraries, forums, etc)

Thank y’all so much in advance.

What makes the sounds?

The computer, I was thinking taking the sound output and plug something like a TRRS 3.5mmm sound jack

You can send the sound to a VOX (internet search "voice operated switch schematic") which can be set to trigger a high/low to indicate to the uController that a sound was produced light the light.

Idahowalker:
You can send the sound to a VOX (internet search "voice operated switch schematic") which can be set to trigger a high/low to indicate to the uController that a sound was produced light the light.

Would I be able to utilize the TRRS to take the computer sound output into the audio input of a VOX system? The schematics I was looking at said audio input and most work with microphones.

joselunav:
Would I be able to utilize the TRRS to take the computer sound output into the audio input of a VOX system? The schematics I was looking at said audio input and most work with microphones.

You might need some attenuation, or not. That's the fun of experimentation.

Idahowalker:
You might need some attenuation, or not. That's the fun of experimentation.

By attenuation you mean filters, right? I’m not too concerned about that as of right now, I kind of want to see what I definitely need since I don’t have too much money to work with. I wanna get the basics down, just simple left-right sound recognition.

thank you for your replies!

joselunav:
By attenuation you mean filters, right? I’m not too concerned about that as of right now, I kind of want to see what I definitely need since I don’t have too much money to work with. I wanna get the basics down, just simple left-right sound recognition.

thank you for your replies!

Attenuation can be a form of filtering.

Would I be able to utilize the TRRS to take the computer sound output...

A line-level (or headphone level) signal is "about right" for the Arduinos 0-5V range, but the Arduino can't read the negative half of the AC audio signal, In fact, the Arduino can be damaged by the negative voltage and/or the signal can be "damaged" distorted.

The most common solution is to add a bias circuit (2 equal-value resistors) to bias the input at 2.5V. Then a capacitor is added to "isolate" the bias from the audio circuit. There is a schematic at the bottom of my [u]World's Simplest Lighting Effect[/u] post.


For my real effects I use a op-amp [u]peak detector[/u] (AKA envelope follower). That throws-away the negative half of the signal so you don't need the bias and then I can automatically increase the sensitivity by switching to the optional 1.1V ADC reference when the signal level is low. It also allows me to sample the "loudness" about 10 times per second instead of sampling the waveform thousands of times per second. But, that's additional circuitry, and since you're not getting the actual audio signal you can't do any digital filtering or frequency analysis..

Thank you guys so much for your help! I just ordered some parts and I'll get to experimenting shortly, will keep this thread updated.