Go Down

Topic: How to mix mic and line out into a single chnnel (Read 5379 times) previous topic - next topic

buffer_overfly

Jul 27, 2015, 11:06 pm Last Edit: Jul 27, 2015, 11:07 pm by buffer_overfly
I want to carry background audio over a mic channel, and on top of it I'd like to inject some DTMF tones coming from a line-out connector.

Let's assume the mic pre-amp expects a signal in the 10s of mV peak-to-peak range, and I already have attenuated the line-out signal to these levels (using a pad):


                  |--------- Mic (environment sound)
                  |
Mic input <-------|
                  |
                  |--------- Attenuator pad   <-  DTMF generator line out


How can I mix those two signals into a single channel?

I could use a splitter, but then the (attenuated) DTMF tones might propagate to the mic and make it vibrate. Would this be harmful, or produce sound?
The competent programmer is fully aware of the strictly limited size of his own skull...(E.W.Dijkstra) (dammit only 140 chars?)

DVDdoug

#1
Jul 28, 2015, 04:46 pm Last Edit: Jul 28, 2015, 05:14 pm by DVDdoug
Audio mixers are built-around a summing ampifier.

Normally the input resistors are equal*, but it's certainly possible to have unequal gains for the line & mic signal  If you want a microphone-level signal out of the circuit you can have a gain of less than one (attenuation) for the line-level input, or unity gain for the line-input and amplification on the mic input.

Quote
I could use a splitter, but then the (attenuated) DTMF tones might propagate to the mic and make it vibrate. Would this be harmful, or produce sound?
There's a "rule" that you should never connect two outputs together.   i.e., You shouldn't connect two CD players to the same amplifier.    However, it's generally OK to connect two inputs together, such as connecting a CD player to two amplifiers.




* In an audio mixer there are usually faders (volume controls) on each input, and a mic preamp for any mic-preamp, and all of this is (plus usually a master volume control) in front of a unity-gain summing amplifier.


P.S.
Just FYI -  Your drawing is clear but it's traditional for signal flow to go from left to right (with inputs on the left and outputs on the right).   

buffer_overfly

I have some LM386s in a drawer. Could they be used here?

Any suggestion for the summing circuit? Both source signals are <100mV peak to peak.
The competent programmer is fully aware of the strictly limited size of his own skull...(E.W.Dijkstra) (dammit only 140 chars?)

CrossRoads

Run the two signals thru two 10K resistors, feed the junction into the LM386 input.
LM386 is basically a power amp, not an op-amp where you would use negative feedback from the output to create a gain stage for example.

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

buffer_overfly

#4
Jul 29, 2015, 11:09 pm Last Edit: Jul 29, 2015, 11:33 pm by buffer_overfly
Run the two signals thru two 10K resistors, feed the junction into the LM386 input.
LM386 is basically a power amp, not an op-amp where you would use negative feedback from the output to create a gain stage for example.
Ok, no problem , I also have some 5532s. Are they good for the job? Do I need to use the inverting configuration?

And about the summing amp output: What I actually need is to mix the signals, not to add them. If I pick resistors with the same value, then the output would be -(V1 + V2). That's twice the expected amplitude of the signal. I could select the offset resistor to be 1/2 the input resistors, and then I'd get an output in the order of -((V1 + V2)/2). But then again if there is sound in only one of the inputs, the output would be half the expected amplitude!

Another possibility would be to give one of the input channels preference over the other one. For instance, if there are DTMF tones, then pick that channel and mute the mic. The rest of the time, output the mic. Is there a circuit for that?
The competent programmer is fully aware of the strictly limited size of his own skull...(E.W.Dijkstra) (dammit only 140 chars?)

DVDdoug

#5
Jul 29, 2015, 11:48 pm Last Edit: Jul 30, 2015, 12:02 am by DVDdoug
Quote
But there's something I don't understand. If there's this rule of not connecting 2 outputs together, then why is it allowed at the resistor junction?
As you suspected, one signal goes back-into the other output...   i.e.  The DTMF signal will go back into the mic and move the diaphragm.

But it gets worse...   Most solid state circuits have a source impedance much lower than the impedance they are intended to drive.    When one circuit tries to drive another output, you get excessive current.

In the case of the microphone and DTMF circuit, the low impedance of the DTMF circuit will probably kill the microphone signal.  (But, the mic probably won't get permanently damaged.)   

The resistors will prevent this from happening.   (Some signal will get back into the mic, but it will be attenuated.) 

You will loose about half the signal (with two equal outputs and two equal resistors) but you should still have enough signal to drive an amplifier, etc.  If the input impedance of whatever you're connecting to is low (compared to the resistors) you can loose more than half your signal.

For example....  An audio amplifier that's designed to drive an 8-Ohm speaker usually has an output impedance (source impedance) of less than one Ohm.    If you connect two amplifier outputs together, each amplifier sees the other as a low-impedance load and poof!

Or if you connect two digital outputs together, one output can be trying to go high while the other is trying to go low.  The two outputs will be "fighting each other", you'll have an undefined state, and again excess current and poof!    (There are some open-collector digital outputs that are designed to be "or-ed" together.)

polymorph

Depending on the microphone, it could damage it. A dynamic microphone is prone to damage.

An LM386 won't isolate the signals much. An Op Amp in the Summing configuration will absolutely isolate the inputs, as long as you don't overdrive the output.



Do you really mean you wish to mix them? As in, the frequencies of the DTMF and the microphone mix to form sum and difference frequencies?

Or do you just wish to be able to hear both the microphone and DTMF tones? If so, that is summing, not mixing.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

polymorph

To be fair, I can see how you can mix those up, as an audio console for combining signals is called a "mixing console" or a "mixing board".

You'll need to wire that up to run from a single supply, too. Isolation caps on each input, and the noninverting terminal connected to Vcc/2.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

buffer_overfly

Ok, thanks for the info.

I did a test wiring both outputs. When the DTMF signal was null, the mic could be heard. But when the DTMF tones kicked in, odd "electronic" noises were heard in the phone mic, and the volume of the signals dropped.

I'll try the summing amp, and I hope the signals can be heard.
The competent programmer is fully aware of the strictly limited size of his own skull...(E.W.Dijkstra) (dammit only 140 chars?)

polymorph

Do you mean that you could hear noises coming from the microphone itself? Not good. You can quickly destroy a microphone that way.

A dynamic microphone is built the same way as a magnetic coil speaker. Except extremely fragile, light, and not suited to having any kind of voltage applied to it.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

buffer_overfly

#10
Aug 05, 2015, 01:26 pm Last Edit: Aug 05, 2015, 01:28 pm by buffer_overfly
I have built a summing amplifier, and it works fine. This is what I've done:


Electrect mic  (V1) -----> ------------
                           |          |
                           |          |  -----> Vout  -------> Phone mic
                           |          |
Line out (V2)       -----> ------------


Although not depicted, R1 is 100 Ohm, R2 is 6.7 kOhm, and Rf (from the opamp virtual earth to Vout) is about 100 Ohm.

I've tested it with only V2, and it gets correctly attenuated to 40mV peak to peak centered at 0V.
I assume V1 will get correctly mixed as well. However, I now have two additional problems:

Problem #1: when wiring an electrect mic in V1, nothing from this mic is heard in Vout.
I've never worked with electrect mics, so I'm probably doing something wrong.
I've found that when connected directly directly to a phone, the mic DC offset is between 1.2V and 1.5V. Does an electrect mic does need external power to work? I thought it was just like a speaker but inverted, transforming air vibration into a very small voltage. My mic at V1 does not have power, and although I think it might generate a small amplitude signal when approached to a loud sound source, it probably is about 10mV in amplitude and my scope is not able to show it as it gets mixed with its own electrical noise. Do I need to add external power to this V1 mic to get a strong enough signal added to Vout??



Problem #2: Vout is correct but when connected to the phone mic, nothing can be heard
This is probably the same problem as the above one. Remember that my Vout signal is centered at 0V. I plugged it directly to a phone mic input, and I was able to hear it briefly, but then the phone switched to its own mic ignoring the audio jack input. To begin with, I don't know if it is a good idea to connect the output of an opamp to a DC source like the phone mic input. Can this DC offset get into the opamp and cause trouble? Or should I add my own offset to Vout before connecting it to the phone mic input?

How can I solve these two problems?
The competent programmer is fully aware of the strictly limited size of his own skull...(E.W.Dijkstra) (dammit only 140 chars?)

buffer_overfly

I have built a summing amplifier, and it works fine. This is what I've done:


Electrect mic  (V1) -----> ------------
                           |          |
                           |          |  -----> Vout  -------> Phone mic
                           |          |
Line out (V2)       -----> ------------


Although not depicted, R1 is 100 Ohm, R2 is 6.7 kOhm, and Rf (from the opamp virtual earth to Vout) is about 100 Ohm.

I've tested it with only V2, and it gets correctly attenuated to 40mV peak to peak centered at 0V.
I assume V1 will get correctly mixed as well. However, I now have two additional problems:

Problem #1: when wiring an electrect mic in V1, nothing from this mic is heard in Vout.
I've never worked with electrect mics, so I'm probably doing something wrong.
I've found that when connected directly directly to a phone, the mic DC offset is between 1.2V and 1.5V. Does an electrect mic does need external power to work? I thought it was just like a speaker but inverted, transforming air vibration into a very small voltage. My mic at V1 does not have power, and although I think it might generate a small amplitude signal when approached to a loud sound source, it probably is about 10mV in amplitude and my scope is not able to show it as it gets mixed with its own electrical noise. Do I need to add external power to this V1 mic to get a strong enough signal added to Vout??



Problem #2: Vout is correct but when connected to the phone mic, nothing can be heard
This is probably the same problem as the above one. Remember that my Vout signal is centered at 0V. I plugged it directly to a phone mic input, and I was able to hear it briefly, but then the phone switched to its own mic ignoring the audio jack input. To begin with, I don't know if it is a good idea to connect the output of an opamp to a DC source like the phone mic input. Can this DC offset get into the opamp and cause trouble? Or should I add my own offset to Vout before connecting it to the phone mic input?

How can I solve these two problems?
I've somehow solved problem #2 adding a voltage bias of +1V to my Vout. So now the V2 signal is audible in the phone mic.

Problem #1 still unsolved. The V1 mic is one of those PC mics you might use for skype or gaming. It has an on/off switch and a volume knob. When connected to the phone directly, the L channel connector is at 2V, and it works. I've tried powering the L channel with 1V through 1K resistor and nothing. Tried with 1V and no resistor and still nothing heard. I think the phone gaves it 2V, but at 1V it should be heard a little.

Anyone knows how to power an external mic?
The competent programmer is fully aware of the strictly limited size of his own skull...(E.W.Dijkstra) (dammit only 140 chars?)

polymorph

Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

DVDdoug

#13
Aug 05, 2015, 06:20 pm Last Edit: Aug 05, 2015, 06:35 pm by DVDdoug
Here is some information about powering electret mics.

You feed voltage to the mic through a resistor and the resistor allows the signal to ride on top of the voltage.   (If you connect the mic to power supply or battery without the resistor, the low impedance of the power supply will "short out" the audio signal.)

Then, you add capacitor in series with the audio output to block the DC power from feeding-into the audio circuitry.

(If your DTMF circuit puts-out DC, you may need a capacitor in series with that signal too.)

A computer soundcard has this circuitry is built-in.

USB mics essentially have a soundcard built-into the mic.   

Battery powered stage/PA electret condenser mics have the resistor & capacitor built into the mic.   

Studio condenser mics (usually not electret condensers) also have circuitry built-into the mic with "phantom power" supplied by the preamp, mixer, or interface. 


buffer_overfly

Finally managed to get decent audio mixing!!!!! I was about to become crazy, but then I realized that:
  • The audio jack connector I was using for the V1 mic was broken and only the right channel worked. I was powering the left (broken) pin. Changed the power to the right channel and now its fine (does not matter at all because the mic is mono)
  • The -5V wire for the opamp was loose


Also I opened the damn mic with an screwdriver and it is just an electret mic after all with nothing else inside (except the volume knob and the mute button). The positive terminal is soldered to L and R and the negative to ground (sleeve). It needs exactly 2V and needs 100x amplification to be heard loud and clear in Vout. However this amplification is not needed when connected directly to the phone (does it have an adaptive amplifier or something?)


Quote
You feed voltage to the mic through a resistor and the resistor allows the signal to ride on top of the voltage.   (If you connect the mic to power supply or battery without the resistor, the low impedance of the power supply will "short out" the audio signal.)
You are right and every schematics I've seen so far are as you say. However I tried that and it does not work. This mic needs exactly 2V directly on the positive pin. Any resistor in between and the sound is muted, no matter how small. From that pin I have added a capacitor in series to remove DC, and finally the R2 resistor that goes to the opamp virtual ground.

To achieve 100x amplification, I needed to change resistors for R1 and Rf in the summing amplifier circuit. R1 is a 100 Ohm resistor and Rf is a 1K one. That forced me to change R2 as well, so now it is 100K to attenuate the DTMF tones to 1/100 (to 60mV amplitude).

And this is all for now. Probably I'm still doing bad things but the audio is heard, the phone is not damaged, and the rule of not wiring two inputs together is observed. I've yet to solder the actual circuit in the perfboard, but I'll wait until the 8PIN sockets arrive (I don't want to burn those opamps).
The competent programmer is fully aware of the strictly limited size of his own skull...(E.W.Dijkstra) (dammit only 140 chars?)

Go Up