How do I add tone() audio to audio from a stereo input?

I've built a device that I want to use when I'm running. It generates telemetry as I'm moving, and gives me occasional beeps to let me know what's going on. All of this works fine, and I can send this out to my headphones via a 2.5mm stereo jack. However, I'd also like to listen to music while this is going on. I figured that I could plug the audio source into the arduino project, wiring up the stereo jacks in parallel, and they'd happily share a ground.

What I didn't count on is the fact that when the audio source (my phone, in this case) is actively producing audio, the volume on the beeper drops considerably - from an uncomfortable volume to barely discernable. When I pause the music and let the phone deactivate its output, the beeping volume returns to normal.

I could, of course, control the volume on the beep with a stereo pot I have lying around, but if the phone deactivated itself while I was running, the beep would return to full volume and I'd be half deafened by the volume change.

Any thoughts on what I need to do to wire this up to allow the arduino to "add" its tone() output to that of the phone?

Thanks...

The problem is you should NEVER connect two (or more) outputs together. You can get a small audio mixer, or build a mixer/amplifier which is based on a [u]summing amplifier[/u].

You also shouldn't be driving headphones directly from the Arduino (the impedance is too low).

I figured that I could plug the audio source into the arduino project, wiring up the stereo jacks in parallel, and they'd happily share a ground.

The shared ground is not the problem... The problem is you are driving a signal "backwards" into an output and each output puts a too-low impedance load on the the other output. It's a little easier to understand the problem if you think about digital outputs... If one output is writing high and the other output is writing low, the signals will be fighting each other and you'll get excess current.

I'd been figuring that the phone was eating a fair chunk of the current from the arduino, given that the arduino signal would drop considerably. However, the phone level wasn't being affected - so, I put a pair of 1k resistors between the phone jack and the headphone jack (in addition to the pair of 10k resistors between the arduino and the headphone jack, and everything is cool. I wanted to add a volume knob for the arduino, but my pots are twice the size of my stereo jacks. =]

Thanks for the help, DVDDoug!