[pulseaudio-discuss] How to mix streams?

Colin Guthrie gmane at colin.guthr.ie
Sat Nov 3 08:50:08 PDT 2012


'Twas brillig, and Vadim Peretokin at 16/10/12 09:04 did gyre and gimble:
> I'd like to mix mic input and output into one stream, to be passed to my
> ALSA-based app as one channel so it can record it in sync with video.
> How can I do this with PulseAudio?

So if I understand correctly you want to record whatever sound is
playing and mix that with input from the mic?

If that's correct then it's a bit fiddly, but it is possible.

Essentially what you want is a "module-combine-source" to combine two
sources into one. Sadly this doesn't exist :p We do have a
module-combine-sink which allows one stream to be played to multiple
sinks, but this is the opposite.

So in order to do what you need there are a couple different options.

The easiest is to simply load a loopback module and loop your mic to
your output device. This means that everything you say will be heard on
the output. This might cause echo and feedback and thus might not be ideal!

> I tried adding the loopback module and making the input stream of the
> app be the monitor of my output - that seemed to have worked at the
> expense of me getting the input echoed back to me. However the next time
> I tried this, the input echo kept building "lag" - after recording for a
> few minutes the echo was 2-3s late and getting slower, so this solution
> is unacceptable.

Ha! I should really read to the end of emails before writing replies!

OK, so the second suggestion is as foolows:

1. Load a null sink.
2. Load a loopback module that connects the monitor of the real sound
card to the null sink.
3. Load a second loopback module that connects your mic to the null sink.
4. Record from the null sinks monitor.

That should get things working as you need.

HTHs

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the pulseaudio-discuss mailing list