Recording audio while simultaneously playing

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

 



Hi,

I am trying to capture audio being played through ALSA on my Raspberry Pi.

I got the loopback device working (sending audio through it and
recording it on the other side):

```
maurus@raspy:~$ aplay -D loopback a2002011001-e02.wav
Playing WAVE 'a2002011001-e02.wav' : Signed 16 bit Little Endian, Rate
44100 Hz, Stereo
^CAborted by signal Interrupt...

maurus@raspy:~$ arecord -D loopback -f S16_LE -r 44100 -c 2 out.wav
Recording WAVE 'out.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
^CAborted by signal Interrupt...

maurus@raspy:~$ aplay -D tv out.wav
Playing WAVE 'out.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
^CAborted by signal Interrupt...
```

However when trying to play audio through a multi device, I get the
following error:

```
maurus@raspy:~$ aplay -D monitor a2002011001-e02.wav
Playing WAVE 'a2002011001-e02.wav' : Signed 16 bit Little Endian, Rate
44100 Hz, Stereo
aplay: pcm_params.c:170: snd1_pcm_hw_param_get_min: Assertion
`!snd_interval_empty(i)' failed.
Aborted by signal Aborted...
```

This is my config:

```
pcm.tv {
        type plug
        slave.pcm "plughw:CARD=ALSA,DEV=1"
}

pcm.loopback {
        type plug
        slave.pcm {
                type asym
                playback.pcm {
                        type dmix
                        ipc_key 1234
                        slave.pcm "hw:CARD=Loopback0,DEV=0"
                }
                capture.pcm {
                        type dsnoop
                        ipc_key 1235
                        slave.pcm "hw:CARD=Loopback0,DEV=1"
                }
        }
}

pcm.monitor {
        type plug
        slave.pcm {
                type multi
                slaves {
                        a { pcm "tv"; channels 2 }
                        b { pcm "loopback"; channels 2 }
                }
                bindings {
                        0 { slave a; channel 0 }
                        1 { slave a; channel 1 }
                        2 { slave b; channel 0 }
                        3 { slave b; channel 1 }
                }
                master 0
        }
        route_policy "duplicate"
#       ttable {
#               [1.0 0.0 1.0 0.0]   # left  -> a.left,  b.left
#               [0.0 1.0 0.0 1.0]   # right -> a.right, b.right
#       }
}
```

And this is my environment:

```
maurus@raspy:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily
maurus@raspy:~$ apt-cache show alsa-base | fgrep Version
Version: 1.0.25+dfsg-0ubuntu5
maurus@raspy:~$ uname -a
Linux raspy 4.1.15-v7+ #830 SMP Tue Dec 15 17:02:45 GMT 2015 armv7l
armv7l armv7l GNU/Linux
maurus@raspy:~$ lsmod|fgrep snd
snd_aloop              12632  0
snd_bcm2835            19739  0
snd_pcm                75040  2 snd_bcm2835,snd_aloop
snd_timer              18668  1 snd_pcm
snd                    52620  4 snd_bcm2835,snd_aloop,snd_timer,snd_pcm
maurus@raspy:~$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
tv
loopback
monitor
default
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
dmix:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample mixing device
dmix:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample snooping device
hw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Hardware device with all software conversions
sysdefault:CARD=Loopback0
    Loopback, Loopback PCM
    Default Audio Device
front:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    Front speakers
surround21:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
dmix:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    Direct sample mixing device
dmix:CARD=Loopback0,DEV=1
    Loopback, Loopback PCM
    Direct sample mixing device
dsnoop:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    Direct sample snooping device
dsnoop:CARD=Loopback0,DEV=1
    Loopback, Loopback PCM
    Direct sample snooping device
hw:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    Direct hardware device without any conversions
hw:CARD=Loopback0,DEV=1
    Loopback, Loopback PCM
    Direct hardware device without any conversions
plughw:CARD=Loopback0,DEV=0
    Loopback, Loopback PCM
    Hardware device with all software conversions
plughw:CARD=Loopback0,DEV=1
    Loopback, Loopback PCM
    Hardware device with all software conversions
```

Does anyone have any clue how to get this config working?


Thanks,

--
Maurus Cuelenaere

------------------------------------------------------------------------------
_______________________________________________
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