Go Down

Topic: Use of 3.5mm TRS Jack for Audio Spectrum Visualizer (Read 453 times) previous topic - next topic

Omega13S

Hello all,

Question about wiring and components for TRS audio input. So, I'm looking to make an audio visualizer with LED's, easy enough. Where I'm currently tripped up is the physical input to send to the FFT code. I want to use an audio in jack, rather than a microphone, to pick up the sound. The input I am looking at is the 5-pin type (https://www.adafruit.com/product/1699). I've already looked through other forum posts, here and elsewhere, and a few questions come up.

1. Is there a way to use both Left and Right channels from the jack? Say, to average them somehow before sending data to the Arduino? Or am I just best off choosing one side or the other.

2. Looking in this post (https://forum.arduino.cc/index.php?topic=476900.0) I've seen two different methods of processing the signal from the jack before sending the the A0 pin, one an envelope follower, and the other a sort of biasing circuit. I'm curious on what the functional differences are between the two, which would be more appropriate for my project, and when you would use one vs the other. The two circuits are attached below for reference (biasing circuit first, then envelope follower)

DVDdoug

Quote
The input I am looking at is the 5-pin type (https://www.adafruit.com/product/1699).
That should be fine, but you only need 3 of the pins.   The extra pins are so you can pass-through the signal to a pair of speakers and switch-off the speakers when headphones are plugged-in.


Quote
1. Is there a way to use both Left and Right channels from the jack? Say, to average them somehow before sending data to the Arduino?
You can run both signals through resistors (about 10K).  Connect other resistor-ends together and to the Arduino input.   This will give you a mixed (summed) signal without affecting the original L & R audio signals.

Another option is to use 2 analog inputs (with 2 bias circuits) and mix in software.    It's just a matter of summing.   Analog mixers are built-around summing amplifiers and digital mixing is done by summing (sample-by-sample).


Quote
2. Looking in this post (https://forum.arduino.cc/index.php?topic=476900.0) I've seen two different methods of processing the signal from the jack before sending the the A0 pin, one an envelope follower, and the other a sort of biasing circuit.
Use the bias circuit.   There are 2 issues with the voltage follower.    You loose all of the frequency information (which makes FFT useless), and there is a voltage drop of about 0.7V across the diode which means if the signal is low, nothing will get through.     You can use an active voltage follower (an op-amp circuit) to solve the voltage drop, but you still loose the frequency information.

And, with the bias circuit, either leave-out or increase the value of R1 .   A 1K load is OK for headphones but too low for a line-level signal,   Plus, when used with the above "mixing resistors" all of these resistors make voltage divider which will reduce the signal, so I'd just leave it out, especially if you mix the left & right signals.

FYI - There is a chip called the MSGEQ7.    It gives you 7 bands filtered and then output as a DC voltage (like a voltage follower).   That makes your software a LOT easier if you can live with 7-bands.    That chip doesn't require bias on the signal.

Omega13S

Thank you Doug!

To summarize, I should put 10K resistors from both L and R pins from the jack, then run it through the bias circuit from before, omitting R1.

FYI - There is a chip called the MSGEQ7.    It gives you 7 bands filtered and then output as a DC voltage (like a voltage follower).   That makes your software a LOT easier if you can live with 7-bands.    That chip doesn't require bias on the signal.
I had seen the ol' MSGEQ7 method, but I shyed away from it. I want the output LED's for each band to dim based on the magnitude of each band, and the approach I have set up so far uses PWM to do so. Am I mistaken? Would the MSGEQ7 do that, i.e give a value that can be put into analogWrite? If not, I think I would honestly prefer the approach I have used so far.

DVDdoug

Quote
To summarize, I should put 10K resistors from both L and R pins from the jack, then run it through the bias circuit from before, omitting R1.
Yes.    You'll have the 2 "left & right" resistors connected to one end of the capacitor and the 2 (higher-value) bias resistors on the other end of the capacitor.   Sorry, I'm too lazy to make a schematic...

Quote
Would the MSGEQ7 do that, i.e give a value that can be put into analogWrite?
Yes.   The MAGEQ7 puts-out 7 time-multiplexed analog voltages so those can be written-out as "analog" PWM.  (Probably after scaling/adjusting appropriately.)     Some people have complained about problems with the MSGEQ7.    Neither method is "perfect".    (I've made sound activated lighting effects but I've never used frequency information.)

Go Up