Looking (maybe) for audio mixer for use with Pulse Audio

I’ve been playing around with pulse audio on openSUSE-11.4 LXDE (and KDE4) with Skype and ffmpeg, and I’m encouraged by the ability to record, although I don’t know yet if it will do what I want to do at the quality I want.

I think I need a mixer that will accept multiple device inputs.

With Pulse Audio, I’ve been able to have two or more multimedia applications use one device (for either input or output), but I have not been able to have multi-devices interface in one direction to one application.

For example with pulse:

I can have multiple applications send their output to one speaker and play simultaneous

  1. I can have one mic send its input sound to two different applications for recording at the same time
  2. I can have audio (as an internet input) streamed from the web to my PC recorded in one or more applications

But I can’t have two different audio sources (such as mic input and audio streamed from internet) recorded into one application at the same time (mixed).

My goal here is to talk on Skype and record both audio and video to a high quality.

I can do such recording in Skype with a very cheap mixing if I use my “room” as a mixer, where I have the remote person’s audio streamed to my PC (via Skype) and broadcast on my speakers in my room, and I also talk at same time in the “room” to my mic. Pulse audio will feed the mic input to both my record program and also to Skype. The mic detects and inputs to my record program my voice and the speaker sound (of the remote person talking) and so the “room” acts as a mixer. Of course all extraneous sound in the room is also recorded, so this is not ideal. And it have to be very careful of feedback, which is tricky to avoid.

I suspect I need a ‘mixer application’ that can accept input from multiple sources. This I have not figured out.

I may have stumbled across the answer to my own question … but I need to read this when I’m awake, …and not like now when I’m 1/2 asleep !

There is an interesting article here: [SOLVED] ALSA and PulseAudio - recording multiple input devices?](http://www.linuxquestions.org/questions/linux-software-2/alsa-and-pulseaudio-recording-multiple-input-devices-877614/) in post#4.

and for Skype there is an interesting blog post here: Stebalien: How to record one’s linux computer with pulseaudio

where a solution is to get both monitor and microphone input into one sink, and then record it. … Thinking about that is currently putting me to sleep ! :frowning:

I note they also have a tutorial for this here:

//youtu.be/oJADNOY615Y

I think I have Pulse audio working such that I can record ANY audio that is streamed to my PC with NO special application needed other than Pulse. This is IMHO important. One should be able to ‘control’ their PC and NOT have control decided by some external audio streaming supplier.

Following the above posts of mine (and the work of others referenced in those posts) I have setup Pulse Audio on a test partition on my 64-bit openSUSE-11.4 KDE4 on an Intel Core i7 920 PC (with an Asus P6T Deluxe V2 motherboard). In the ‘pavucontrol’ print outs one will see below typically 3 audio devices:

  1. my physical motherboard Surround Sound 5.1 system
  2. my physical USB webcam microphone
  3. a ‘null’ device (an audio sink) I created in pulse so as to be able to mix recorded/captured audio

Note I also have installed the applications ‘pavucontrol’ and ‘pulseaudio-utils’ which may or may not be installed by default depending on one’s openSUSE desktop selection.

**Pulse Audio Volume Control Setup: **

One thing about pulse audio, it appears to be configured from “right to left” , which is IMHO more the Japanese/Chinese way, than the North American/European way I am used to (which is “left to right”). Once I wrapped my head around that difference, I found this easier. I know – silly of me. But silly things can stump me!

This is the Configuration menu from pavucontrol. Note my two physical devices:
http://thumbnails39.imagebam.com/13327/742b8a133265088.jpg](http://www.imagebam.com/image/742b8a133265088)

This is the Input Devices menu from pavucontrol. Note I have 2 microphones (motherboard and webcam). Note the “monitor” of the 5.1 surround sound as an ‘input’. This is INCREDIBLY useful for being able to monitor all audio that comes into one’s PC’s audio system. Note also here the “null” device, which is the audio sink. This is very useful for manipulating the audio.
http://thumbnails28.imagebam.com/13327/69254d133265092.jpg](http://www.imagebam.com/image/69254d133265092)

I created that “null device” with the command:

pactl load-module module-null-sink sink_name=something

one can use any arbitrary name instead of ‘something’. But that name is important for tracking the audio/null-device sink.

This is the Output Devices menu from pavucontrol. Note only 2 devices, the 5.1 surround which is my 5.1 surround sound speaker system, and also note a “Null Output” which is the “null device” I created. The microphones are NOT listed because they are “input” devices.
http://thumbnails37.imagebam.com/13327/8d06b0133265096.jpg](http://www.imagebam.com/image/8d06b0133265096)

… the next post has the information that I had the most difficult time in understanding with puse audio …

Below is the Recording menu from pavucontrol. Note here there are 3 “applications” recording audio.
http://thumbnails32.imagebam.com/13329/f380f4133282573.jpg](http://www.imagebam.com/image/f380f4133282573)

Look at that image above. The 3rd application (the lowest shown in the image) is “ffmpeg” (listed as an ALSA plug-in). In this example, I was using ffmpeg to record my desktop with the command:

ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1920x1200 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.avi 

Note in that ffmpeg command I have “pulse” selected instead of a hardware device such as “hw:0,0” or something else. This means ffmpeg uses pulse for its sound recording. And note (in the recording menu) that the pulse capture from ffmpeg is also being received from the “monitor of null output”.

Note the two loopback ‘applications’ (I say ‘application’ for lack of a better word – they are NOT really apps). I have one “loopback” set to “Internal Audio Analog Stereo” which is the front microphone on my computer. I have the other “loopback” set to “Monitor of Internal Audio Analog Surround-5.1”. This corresponds to any audio being handled by my motherboard’s sound system (in this case it is a youtube video being played in firefox !! - that will be clear on the ‘playback’ menu).

Note these “loopbacks” were created by sending twice the following command:

pactl load-module module-loopback sink=something 

Note I had to use the same ‘name’ for the sink (ie ‘something’) which I previously arbitrarily picked. I created 2 loopbacks, so that I had one loopback for my front microphone and one for my sound card on my PC. If I had wanted to include my webcam mic (so to mix its recorded audio also), I would have had to add a 3rd loopback and hence would have had to send that command a third time.

Below is the “Playback” menu from pavucontrol.
http://thumbnails10.imagebam.com/13327/34a777133265102.jpg](http://www.imagebam.com/image/34a777133265102)
At the top is System Sounds. I don’t have anything to say here. Just ignore this for this example.

Next is “loopback of the Internal Audio Analog Stero” which is my Front Microphone. It is playing audio from the mic to the “null output” (and NOT to the speakers).

Next is “loopback” of the Interal Audio Analog Surround 5.1 which is all audio going through my motherboard. It is playing audio from the motherboard to the “null output” (and NOT to the speakers).

Next is ALSA plug-in (firefox) which is the application firefox that I have playing a youtube video !! It is playing audio from this application and sending it to the “Internal Audio Analog Surround 5.1” which means I can hear the audio from Firefox.

** SUMMARY.**

So, what does all that mean ?

I think it means any audio recorded by my Front Mic (with me talking), or any going through my motherboard audio is sent to the ‘null device’ audio sink. That includes any audio from firefox which is playing a youtube video. The recording is ALSO being done by ffmpeg, which is receiving the audio from pulse which in turn is receiving the audio from the “audio sink” null-device. With both microphone and firefox youtube going to the null, this ensures both youtube audio and microphone audio is recorded into the ffmpeg output.avi file.

Also then any audio from Firefox is also sent to my speakers, such that I can hear Firefox playing the youtube video, while I am recording.

Hence when I playback output.avi, I hear both myself talking in the mic, and youtube video.

So why do this ?

Because if one replaces “firefox” with “skype” I can record the video chat/conversation of a family member/loved one. That’s very nice to have such a recording for an expatriate far from home.

There is also a basic ‘principle’ for some of us, where ANY audio that goes through our computer we want to be able to record. In this case I’m recording BOTH any video and any audio that goes through my computer. And the audio recording side is helped thanks to pulse audio.

** NOTE.**

If the above reads to be confusing, its because its still possibly a bit fuzzy in my mind, and I don’t have a firm enough grip on this to explain in more simple English.

My apologies.

I want to give help but i do not know many for multimedia. My specialty is programming and developing. If my help is useful for you, I have alsamixer installed, I thing that maybe this help you. You want this mixer for LXDE??
I still search for that. Sorry if my results are not complete but I do my best to find something.

stamostolias.** I have solved this. I posted my solution above! **

One can mark this thread ‘solved’. If you read my last 2 posts you will see I have solved it and provided the solution in DEPTH/DETAIL. Possibly too much detail for you. Sorry.

It is ok. I am glad that this problem has solved. Now I see the solution because I was looking for solution. There is not to sorry about this.

oldcpu wrote:

> If the above reads to be confusing, its because its still possibly a
> bit fuzzy in my mind, and I don’t have a firm enough grip on this to
> explain in more simple English.

Having your whole learning process described makes a world of difference -
thanks for taking the time. I’ve been beating my head against a wall with a
church setup with multiple sources and this looks like what I’ve been trying
to do so your descriptions of the intermediate steps should make extending
it to fit should work - finally!


Will Honea

I updated the above link. Somehow I managed to get confused and had another image than the 'recording’image.

Further to my above post, I noted …

and I noted …

The above commands would need to be sent every time one boots. Of course IF one has determined that this is a configuration that they want to keep permanently, then one can then make those changes permanent by editing the appropriate pulse audio configuration file (and if made permanent the commands would not need to be sent). This is explained in the references that I provided (from where I learned how to do this). … ie …

  1. open /etc/pulse/default.pa, and uncomment the line:
load-module module-null-sink 

.

  1. … actually in this case one must give the sink a name, so change the line into:

load-module module-null-sink sink_name=something

where ‘something’ is an arbitrary name. Pick your own here.
.

  1. add two more (identical) loopback sinks to the default.pa file for the audio sink ‘something’
load-module module-loopback latency_msec=5 sink=something 


load-module module-loopback latency_msec=5 sink=something

I don’t know if the ‘latency_msec=5’ is necessary. Possibly remove or tune that as appropriate after some testing. And again I have 2 loopbacks, one for audio passing through motherboard and one for audio coming from my Front Mic. If one wanted to add another Mic (such as webcam mic) would could add another identical loopback module load entry.

Then reboot and test.

I’m thinking I may blog about this … but in the mean time, just to keep this thread up to date, I note that ‘ffmpeg’ has changed since this article, and that the ‘vpre lossless_ulrafast’ has been depreciated and no longer works. Instead one needs to use ’ -preset ultrafast’ … ie something like:


ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1920x1200 -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads 0 output.avi 

Note the file size from the above 1920 x 1200 capture will be MASSIVE and one will likely want to use other software to compress / reduce it in size some more.

So with the code above, I can capture what I’m doing on my desktop? If I put in 1280 X 1024 (that’s my monitor’s res.) will the file size be as massive?
How do you tell the command to stop capturing?

As massive ? Probably not. But still pretty big.

I use <CTRL><C> which is not very elegant.

Its also possible to capture a smaller area on your screen that 1280x1024. Say 800x600. I think the " -i :0.0 " specifies the upper left corner and if one plays with that value one can move the capture to a different location on the screen.