Detecting analog audio

I want to be able to plug in an auxiliary cable and have the Arduino recognize the tone. I've heard I need to amplify the signal to 0-5V peak-to-peak. How would I do this and how would the code to read the tone be?

Thanks guys! :slight_smile:

PS Quick responses are appreciated as I am pressed for time.

Start from this site:, than if you still have a specific question, post it here or in comments section of the blog.

Well, I was thinking of amplifying the signal with an small headphone amp, running it through a diode rectifier to get rid of the low wave of AC, and then feed it into a digital pin. Then run a pulseIn() commande to measure time between the high and low.

BTW, what section of code would I use from that link?

BTW, what section of code would I use from that link?

I thought you may find drawings useful, but I used analog input not digital.
The problem with diode rectifier /digital input may be low sensitivity, as diode would drop 0.7 V (Si) just to start conducting, plus 2.7 V necessary for digital input to trigger events. 3.4V is too high, even for headphone outputs. Moreover, in quite audio material, it wouldn't register anything at all.
OPA or at least a single transistor (h21 > 100) is would be necessary.

I can use analog. I just want to be able to detect frequencies. Any way works

What you need to detect frequencies is Fast Fourier Transform. Google it with arduino to narrow results or maybe convert this Goertzel algorithm - Wikipedia to arduino c++