Using audio output instead of a microphone

I've just read a nice blog post about frequency analysis and beat detection: dpeckett.com - This website is for sale! - dpeckett Resources and Information.

and I would like to try it out on my own. But I would like to split the actual audio output that comes from my PC and want to connect it to my speakers and my Arduino directly.

Now the main differences that I see are
-audio is usually stereo, while mic is usually mono
-impedance/resistance/voltage (?) difference

I'm not really worried about the first point. But the second one is a problem I think.
The audio signal form my computers audio output is probably much stronger than a normal mic output would be and I don't want to break anything.

So my question is. What do I have to change in this circuit, in order to use a normal audio out instead of a microphone:

(taken form the before mentioned blog post)

Also, would a simple Y-connection between my computer and the speakers and the Arduino work or do I need to add resistors?

What do I have to change in this circuit, in order to use a normal audio out instead of a microphone:

audio input.png

Thank you. I assume the R2 just stays (even though you removed the 6.8k?).

One more question though, where does the gnd of my audio output go? Does it go straight to the Arduinos gnd?

where does the gnd of my audio output go? Does it go straight to the Arduinos gnd?

Yes.

R2 and R3 should be the same value, anything between 1K and 10K, but they should be the same.

[u]Line level[/u] or headphone level is about 1V so you don't need any amplification. However the Arduino can't read the negative half of the AC audio signal (it can actually be damaged by negative voltages or voltages greater than +5V) so you need to bias the input at 2.5V with two equal-value resistors as Mike showed you. (The bias can be subtracted-out in software.)

Line inputs are typically 10K - 100K Ohms, but anything greater than 1K is usually OK. Headphones are typically 32 or 64 Ohms and it never hurts to put a lighter load (higher resistance) on the circuit.

For stereo you can ignore one channel (I did that with one of my lighting effects*) or you can use two analog inputs (each with their own bias circuit) and from there you can sum (or average) the left & right signals in software or analyze them separately.

  • The visual part had to be mono, but if I did it again I'd combine the left & right channels in software.

Grumpy_Mike:
Yes.

R2 and R3 should be the same value, anything between 1K and 10K, but they should be the same.

Oh okay, I almost used a 6.8k and 2.2k resistor. Good thing I asked. : )

I would use three 10k resisors and a cap.
The third resistor between that 2.5volt point and A0.
Leo..

Why the third resistor? What is it doing for you?

Can you be sure that the audio signal (headphones output) will be < 5voltpeak/peak.
If the clamping diodes are used, then bettter make sure it a small current.

The cap should be connected with the + to the mid-voltage divider.
There is a bigger chance that the input signal has ground potential.
Leo..

I went with 2 6.8k resistors and it seemed to work.
But the "beat detection" just plain sucks.