Problems using loopback module and plugins to capture playback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I've spent a bit of time trying to figure out how to capture the
output of my main sound card and make it available as a capture
device.
To this I'm loading the snd-aloop module to make the "hw:Loopback"
device available and then I'm using the following .asoundrc
configuration file

##########Begin .asoundrc

pcm.both
{
	type route
	slave.pcm
	{
		type multi
		slaves.a.pcm dmix
		slaves.b.pcm "hw:Loopback,0,0"
		slaves.a.channels 2
		slaves.b.channels 2

		#Create 4 channels each for each slave's channels
		bindings.0.slave a
		bindings.0.channel 0

		bindings.1.slave a
		bindings.1.channel 1

		bindings.2.slave b
		bindings.2.channel 0

		bindings.3.slave b
		bindings.3.channel 1
	}

	#Transfer table (ttable.<input channel>.<slave channel> <volume>)
	ttable.0.0 1; #Copy left input to slave "a" left channel
	ttable.0.2 1; #Copy left input to slave "b" left channel
	ttable.1.1 1; #Copy right input to slave "a" right channel
	ttable.1.3 1; #Copy right input to slave "b" right channel
}

#PCM for capturing output to sound card.
pcm.syscapture
{
	type plug
	slave.pcm "hw:Loopback,1,0"
}


pcm.usb
{
    type hw
    card U0x46d0x9a4
}
pcm.!default
{
    type asym
    playback.pcm
    {
        type plug
        slave.pcm "plug:both"
    }

    #This is so my webcam microphone is used as the default microphone
    capture.pcm
    {
        type plug
        slave.pcm "usb"
    }
}

##########End .asoundrc

Essentially I'm using the route plugin for send the left and right
channels to slaves "a" and "b". Slave "a" is just dmix so that I can
hear the output of my sound card as normal. Given the above
configuration it seems slave "a" is correctly receiving audio as I can
play music and have it come out of my sound card as normal.

Slave "b" is the Loopback device and this is where I'm having
problems. I've tried capturing audio from "syscapture" (i.e.
"hw:Loopback,1,0") and I hear nothing! For example I'll try this...

$  arecord -D syscapture record.wav
Recording WAVE 'record.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono

then in another terminal
$ aplay temp.wav
Playing WAVE 'temp.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono

then I check record.wav and there is just silence.

Does anyone know what's wrong? I also noted that "$ aplay -D both
temp.wav" doesn't work and complains about the sample rate (but -D
plug:both works). Why is this the case?

I did also try this just to test the loop back device and that seems broken...
$ arecord -D hw:Loopback,1,0 -f S16_LE record.wav
Recording WAVE 'record.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

then in another terminal
$ aplay -D hw:Loopback,0,0 temp.wav

this causes arecord (in the first terminal) to then output...
arecord: pcm_read:1828: read error: File descriptor in bad state

and then it exits.
What have I done wrong?

Thanks,
Dan Liew.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user


[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux