2つの独立したオーディオ出力デバイスと1つのソースを使用します。アルザス

2つの独立したオーディオ出力デバイスと1つのソースを使用します。アルザス

HiFi Berry DACとRaspberry PI 3Bのオンボードオーディオの両方を試してみました。所望の結果を得るために、pcmルーティングと2 pcm dmixを使用してalsaを設定しました。スピーカーテストでは、両方のdmixデバイスが正しく機能していることがわかりましたが、ルーティングデバイスを使用しようとすると、次のエラーで失敗します。

# speaker-test -D plug:dualout

speaker-test 1.1.8

Playback device is plug:dualout
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib pcm.c:2434:(snd_pcm_open_conf) type is not defined
Playback open error: -2,No such file or directory

これは私の現在asound.confです。

# cat /etc/asound.conf 
pcm.headphones {
  type hw
  card 0
}

ctl.headphones {
  type hw
  card 0
}

pcm.lineout {
  type hw
  card 1
}

ctl.lineout {
  type hw
  card 1
}

pcm.headphonesDmix {
  type dmix
  ipc_key 1024
  slave {
    pcm "headphones"
    channels 2
  }
  bindings {
    0 0
    1 1
  }
}

pcm.lineoutDmix {
  type dmix
  ipc_key 2048
  slave {
    pcm "lineout"
    channels 2
  }
  bindings {
    0 0
    1 1
  }
}

pcm.dualout {
  type route
  slave.pcm {
    slaves.a.pcm "headphonesDmix"
    slaves.b.pcm "lineoutDmix"
    slaves.a.channels 2
    slaves.b.channels 2

    bindings.0.slave a
    bindings.0.channel 0
    bindings.1.slave a
    bindings.1.channel 1
    bindings.0.slave b
    bindings.0.channel 0
    bindings.1.slave b
    bindings.1.channel 1
  }
  ttable.0.0 1
  ttable.1.1 1
}

pcm.!default {
  type plug
  slave {
    pcm "dualout"
  }
}

ctl.!default {
  type hw
  card 1
}

alsa-infoの出力

# alsa-info
ALSA Information Script v 0.4.65
--------------------------------

This script visits the following commands/files to collect diagnostic
information about your ALSA installation and sound related hardware.

  dmesg
  lspci
  aplay
  amixer
  alsactl
  rpm, dpkg
  /proc/asound/
  /sys/class/sound/
  ~/.asoundrc (etc.)

See '/usr/sbin/alsa-info --help' for command line options.

pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
cat: /tmp/alsa-info.Qjk8uwmTxC/acpidevicestatus.tmp: No such file or directory
cat: '/sys/module/snd_soc_hifiberry_dacplus/parameters/*': No such file or directory
Automatically upload ALSA information to www.alsa-project.org? [y/N] : n

Your ALSA information is in /tmp/alsa-info.txt.YVpm767lnw

# cat /tmp/alsa-info.txt.YVpm767lnw 
upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.4.65
!!################################

!!Script ran on: Fri Jan 22 19:08:17 UTC 2021


!!Linux Distribution
!!------------------

ID_LIKE=debian


!!DMI Information
!!---------------

Manufacturer:      
Product Name:      
Product Version:   
Firmware Version:  
System SKU:        
Board Vendor:      
Board Name:        


!!ACPI Device Status Information
!!---------------



!!Kernel Information
!!------------------

Kernel release:    5.4.83-v7+
Operating System:  GNU/Linux
Architecture:      armv7l
Processor:         unknown
SMP Enabled:       Yes


!!ALSA Version
!!------------

Driver version:     k5.4.83-v7+
Library version:    1.1.8
Utilities version:  1.1.8


!!Loaded ALSA modules
!!-------------------

snd_bcm2835
snd_soc_hifiberry_dacplus


!!Sound Servers on this system
!!----------------------------

No sound servers found.


!!Soundcards recognised by ALSA
!!-----------------------------

 0 [Headphones     ]: bcm2835_headphonbcm2835 Headphones - bcm2835 Headphones
                      bcm2835 Headphones
 1 [sndrpihifiberry]: HifiberryDacp - snd_rpi_hifiberry_dacplus
                      snd_rpi_hifiberry_dacplus


!!PCI Soundcards installed in the system
!!--------------------------------------



!!Modprobe options (Sound related)
!!--------------------------------

snd_pcsp: index=-2
snd_usb_audio: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
snd_bcm2835: enable_compat_alsa=0
snd_bcm2835: enable_hdmi=1


!!Loaded sound module options
!!---------------------------

!!Module: snd_bcm2835
    enable_compat_alsa : N
    enable_hdmi : Y
    enable_headphones : Y
    force_bulk : N

!!Module: snd_soc_hifiberry_dacplus
    * : 


!!ALSA Device nodes
!!-----------------

crw-rw----+ 1 root audio 116,  0 Jan 22 19:19 /dev/snd/controlC0
crw-rw----+ 1 root audio 116, 32 Jan 22 19:19 /dev/snd/controlC1
crw-rw----+ 1 root audio 116, 16 Jan 22 19:19 /dev/snd/pcmC0D0p
crw-rw----+ 1 root audio 116, 48 Jan 22 19:19 /dev/snd/pcmC1D0p
crw-rw----+ 1 root audio 116,  1 Jan 22 19:19 /dev/snd/seq
crw-rw----+ 1 root audio 116, 33 Jan 22 19:19 /dev/snd/timer

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root  80 Jan 22 19:19 .
drwxr-xr-x 3 root root 180 Jan 22 19:19 ..
lrwxrwxrwx 1 root root  12 Jan 22 19:19 platform-bcm2835_audio -> ../controlC0
lrwxrwxrwx 1 root root  12 Jan 22 19:19 platform-soc:sound -> ../controlC1


!!ALSA configuration files
!!------------------------

!!System wide config file (/etc/asound.conf)

pcm.headphones {
  type hw
  card 0
}

ctl.headphones {
  type hw
  card 0
}

pcm.lineout {
  type hw
  card 1
}

ctl.lineout {
  type hw
  card 1
}

pcm.headphonesDmix {
  type dmix
  ipc_key 1024
  slave {
    pcm "headphones"
    channels 2
  }
  bindings {
    0 0
    1 1
  }
}

pcm.lineoutDmix {
  type dmix
  ipc_key 2048
  slave {
    pcm "lineout"
    channels 2
  }
  bindings {
    0 0
    1 1
  }
}

pcm.dualout {
  type route
  slave.pcm {
    slaves.a.pcm "headphonesDmix"
    slaves.b.pcm "lineoutDmix"
    slaves.a.channels 2
    slaves.b.channels 2

    bindings.0.slave a
    bindings.0.channel 0
    bindings.1.slave a
    bindings.1.channel 1
    bindings.0.slave b
    bindings.0.channel 0
    bindings.1.slave b
    bindings.1.channel 1
  }
  ttable.0.0 1
  ttable.1.1 1
}

pcm.!default {
  type plug
  slave {
    pcm "dualout"
  }
}

ctl.!default {
  type hw
  card 1
}

    


!!Aplay/Arecord output
!!--------------------

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0 [HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****

!!Amixer output
!!-------------

!!-------Mixer controls for card Headphones

Card hw:0 'Headphones'/'bcm2835 Headphones'
  Mixer name    : 'Broadcom Mixer'
  Components    : ''
  Controls      : 2
  Simple ctrls  : 1
Simple mixer control 'Headphone',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback -10239 - 400
  Mono: Playback 400 [100%] [4.00dB] [on]

!!-------Mixer controls for card sndrpihifiberry

Card hw:1 'sndrpihifiberry'/'snd_rpi_hifiberry_dacplus'
  Mixer name    : ''
  Components    : ''
  Controls      : 20
  Simple ctrls  : 19
Simple mixer control 'DSP Program',0
  Capabilities: enum
  Items: 'FIR interpolation with de-emphasis' 'Low latency IIR with de-emphasis' 'High attenuation with de-emphasis' 'Fixed process flow' 'Ringing-less low latency FIR'
  Item0: 'FIR interpolation with de-emphasis'
Simple mixer control 'Analogue',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 1
  Mono:
  Front Left: Playback 1 [100%] [0.00dB]
  Front Right: Playback 1 [100%] [0.00dB]
Simple mixer control 'Analogue Playback Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 1
  Front Left: 1 [100%] [0.80dB]
  Front Right: 1 [100%] [0.80dB]
Simple mixer control 'Auto Mute',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'Auto Mute Mono',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Auto Mute Time Left',0
  Capabilities: enum
  Items: '21ms' '106ms' '213ms' '533ms' '1.07s' '2.13s' '5.33s' '10.66s'
  Item0: '21ms'
Simple mixer control 'Auto Mute Time Right',0
  Capabilities: enum
  Items: '21ms' '106ms' '213ms' '533ms' '1.07s' '2.13s' '5.33s' '10.66s'
  Item0: '21ms'
Simple mixer control 'Clock Missing Period',0
  Capabilities: enum
  Items: '1s' '2s' '3s' '4s' '5s' '6s' '7s' '8s'
  Item0: '1s'
Simple mixer control 'Deemphasis',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Digital',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 207
  Mono:
  Front Left: Playback 207 [100%] [0.00dB] [on]
  Front Right: Playback 207 [100%] [0.00dB] [on]
Simple mixer control 'Max Overclock DAC',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 40
  Mono: 0 [0%]
Simple mixer control 'Max Overclock DSP',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 40
  Mono: 0 [0%]
Simple mixer control 'Max Overclock PLL',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 20
  Mono: 0 [0%]
Simple mixer control 'Volume Ramp Down Emergency Rate',0
  Capabilities: enum
  Items: '1 sample/update' '2 samples/update' '4 samples/update' 'Immediate'
  Item0: '1 sample/update'
Simple mixer control 'Volume Ramp Down Emergency Step',0
  Capabilities: enum
  Items: '4dB/step' '2dB/step' '1dB/step' '0.5dB/step'
  Item0: '4dB/step'
Simple mixer control 'Volume Ramp Down Rate',0
  Capabilities: enum
  Items: '1 sample/update' '2 samples/update' '4 samples/update' 'Immediate'
  Item0: '1 sample/update'
Simple mixer control 'Volume Ramp Down Step',0
  Capabilities: enum
  Items: '4dB/step' '2dB/step' '1dB/step' '0.5dB/step'
  Item0: '1dB/step'
Simple mixer control 'Volume Ramp Up Rate',0
  Capabilities: enum
  Items: '1 sample/update' '2 samples/update' '4 samples/update' 'Immediate'
  Item0: '1 sample/update'
Simple mixer control 'Volume Ramp Up Step',0
  Capabilities: enum
  Items: '4dB/step' '2dB/step' '1dB/step' '0.5dB/step'
  Item0: '1dB/step'


!!Alsactl output
!!--------------

--startcollapse--
state.Headphones {
    control.1 {
        iface MIXER
        name 'Headphone Playback Volume'
        value 400
        comment {
            access 'read write'
            type INTEGER
            count 1
            range '-10239 - 400'
            dbmin -9999999
            dbmax 400
            dbvalue.0 400
        }
    }
    control.2 {
        iface MIXER
        name 'Headphone Playback Switch'
        value true
        comment {
            access 'read write'
            type BOOLEAN
            count 1
        }
    }
}
state.sndrpihifiberry {
    control.1 {
        iface MIXER
        name 'Digital Playback Volume'
        value.0 207
        value.1 207
        comment {
            access 'read write'
            type INTEGER
            count 2
            range '0 - 207'
            dbmin -9999999
            dbmax 0
            dbvalue.0 0
            dbvalue.1 0
        }
    }
    control.2 {
        iface MIXER
        name 'Analogue Playback Volume'
        value.0 1
        value.1 1
        comment {
            access 'read write'
            type INTEGER
            count 2
            range '0 - 1'
            dbmin -600
            dbmax 0
            dbvalue.0 0
            dbvalue.1 0
        }
    }
    control.3 {
        iface MIXER
        name 'Analogue Playback Boost Volume'
        value.0 1
        value.1 1
        comment {
            access 'read write'
            type INTEGER
            count 2
            range '0 - 1'
            dbmin 0
            dbmax 80
            dbvalue.0 80
            dbvalue.1 80
        }
    }
    control.4 {
        iface MIXER
        name 'Digital Playback Switch'
        value.0 true
        value.1 true
        comment {
            access 'read write'
            type BOOLEAN
            count 2
        }
    }
    control.5 {
        iface MIXER
        name 'Deemphasis Switch'
        value true
        comment {
            access 'read write'
            type BOOLEAN
            count 1
        }
    }
    control.6 {
        iface MIXER
        name 'DSP Program'
        value 'FIR interpolation with de-emphasis'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 'FIR interpolation with de-emphasis'
            item.1 'Low latency IIR with de-emphasis'
            item.2 'High attenuation with de-emphasis'
            item.3 'Fixed process flow'
            item.4 'Ringing-less low latency FIR'
        }
    }
    control.7 {
        iface MIXER
        name 'Clock Missing Period'
        value '1s'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 '1s'
            item.1 '2s'
            item.2 '3s'
            item.3 '4s'
            item.4 '5s'
            item.5 '6s'
            item.6 '7s'
            item.7 '8s'
        }
    }
    control.8 {
        iface MIXER
        name 'Auto Mute Time Left'
        value '21ms'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 '21ms'
            item.1 '106ms'
            item.2 '213ms'
            item.3 '533ms'
            item.4 '1.07s'
            item.5 '2.13s'
            item.6 '5.33s'
            item.7 '10.66s'
        }
    }
    control.9 {
        iface MIXER
        name 'Auto Mute Time Right'
        value '21ms'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 '21ms'
            item.1 '106ms'
            item.2 '213ms'
            item.3 '533ms'
            item.4 '1.07s'
            item.5 '2.13s'
            item.6 '5.33s'
            item.7 '10.66s'
        }
    }
    control.10 {
        iface MIXER
        name 'Auto Mute Mono Switch'
        value true
        comment {
            access 'read write'
            type BOOLEAN
            count 1
        }
    }
    control.11 {
        iface MIXER
        name 'Auto Mute Switch'
        value.0 true
        value.1 true
        comment {
            access 'read write'
            type BOOLEAN
            count 2
        }
    }
    control.12 {
        iface MIXER
        name 'Volume Ramp Down Rate'
        value '1 sample/update'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 '1 sample/update'
            item.1 '2 samples/update'
            item.2 '4 samples/update'
            item.3 Immediate
        }
    }
    control.13 {
        iface MIXER
        name 'Volume Ramp Down Step'
        value '1dB/step'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 '4dB/step'
            item.1 '2dB/step'
            item.2 '1dB/step'
            item.3 '0.5dB/step'
        }
    }
    control.14 {
        iface MIXER
        name 'Volume Ramp Up Rate'
        value '1 sample/update'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 '1 sample/update'
            item.1 '2 samples/update'
            item.2 '4 samples/update'
            item.3 Immediate
        }
    }
    control.15 {
        iface MIXER
        name 'Volume Ramp Up Step'
        value '1dB/step'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 '4dB/step'
            item.1 '2dB/step'
            item.2 '1dB/step'
            item.3 '0.5dB/step'
        }
    }
    control.16 {
        iface MIXER
        name 'Volume Ramp Down Emergency Rate'
        value '1 sample/update'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 '1 sample/update'
            item.1 '2 samples/update'
            item.2 '4 samples/update'
            item.3 Immediate
        }
    }
    control.17 {
        iface MIXER
        name 'Volume Ramp Down Emergency Step'
        value '4dB/step'
        comment {
            access 'read write'
            type ENUMERATED
            count 1
            item.0 '4dB/step'
            item.1 '2dB/step'
            item.2 '1dB/step'
            item.3 '0.5dB/step'
        }
    }
    control.18 {
        iface MIXER
        name 'Max Overclock PLL'
        value 0
        comment {
            access 'read write'
            type INTEGER
            count 1
            range '0 - 20'
        }
    }
    control.19 {
        iface MIXER
        name 'Max Overclock DSP'
        value 0
        comment {
            access 'read write'
            type INTEGER
            count 1
            range '0 - 40'
        }
    }
    control.20 {
        iface MIXER
        name 'Max Overclock DAC'
        value 0
        comment {
            access 'read write'
            type INTEGER
            count 1
            range '0 - 40'
        }
    }
}
--endcollapse--


!!All Loaded Modules
!!------------------

8021q
backlight
bcm2835_codec
bcm2835_isp
bcm2835_mmal_vchiq
bcm2835_v4l2
bluetooth
bnep
brcmfmac
brcmutil
btbcm
cfg80211
clk_hifiberry_dacpro
cmac
ecc
ecdh_generic
fixed
garp
hci_uart
i2c_bcm2835
input_polldev
ip_tables
ipv6
joydev
libsha256
llc
mc
raspberrypi_hwmon
raspberrypi_ts
regmap_i2c
rfkill
rpi_backlight
sha256_generic
snd
snd_bcm2835
snd_compress
snd_pcm
snd_pcm_dmaengine
snd_soc_bcm2835_i2s
snd_soc_core
snd_soc_hifiberry_dacplus
snd_soc_pcm512x
snd_soc_pcm512x_i2c
snd_timer
stp
uio
uio_pdrv_genirq
v4l2_mem2mem
vc_sm_cma
videobuf2_common
videobuf2_dma_contig
videobuf2_memops
videobuf2_v4l2
videobuf2_vmalloc
videodev
x_tables


!!ALSA/HDA dmesg
!!--------------

[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 240555
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=800 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyS0,115200 console=tty1 root=PARTUUID=6c586e13-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles logo.nologo vt.global_cursor_default=0
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
--
[    6.359946] videodev: Linux video capture interface: v2.00
[    6.394714] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[    6.442322] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
--
[    6.518353] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    6.708013] snd-rpi-hifiberry-dacplus soc:sound: ASoC: failed to init link HiFiBerry DAC+: -517
[    6.742868] snd-rpi-hifiberry-dacplus soc:sound: ASoC: failed to init link HiFiBerry DAC+: -517
[    6.808548] input: raspberrypi-ts as /devices/platform/soc/soc:firmware/soc:firmware:touchscreen/input/input0
[    6.810037] snd-rpi-hifiberry-dacplus soc:sound: ASoC: failed to init link HiFiBerry DAC+: -517
[    7.117404] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    7.294399] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    7.414779] snd-rpi-hifiberry-dacplus soc:sound: ASoC: failed to init link HiFiBerry DAC+: -517
[    7.415491] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
--
[    7.421810] usbcore: registered new interface driver brcmfmac
[    7.426330] snd-rpi-hifiberry-dacplus soc:sound: ASoC: failed to init link HiFiBerry DAC+: -517
[    7.452141] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt failed with error -2
--
[    7.671399] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 22 2019 01:59:28 version 7.45.98.94 (r723000 CY) FWID 01-3b33decd
[    8.633347] snd-rpi-hifiberry-dacplus soc:sound: pcm512x-hifi <-> 3f203000.i2s mapping ok


!!Packages installed
!!--------------------

ii  alsa-utils                     1.1.8-2                             armhf        Utilities for configuring and using ALSA

カード0はオンボード「ヘッドフォン」です。

カード1はHiFiベリーカードです。

関連情報