我目前正在尝试设置 Soundblaster 卡(CA106 芯片组)以输出到 4 个通道。
我将 4 个扬声器插入模拟输出(使用插头)。
当我使用实用程序测试 pseakers 时,speaker-test
它工作得很好,但每当我尝试使用实用程序播放 4 通道(我自己构建)或任何多通道声音(从网络检索)时,aplay
我都无法让它工作。
以下是有关我的硬件设置的信息:
[root@server SurroundTestFiles]# aplay -L
default:CARD=CA0106
CA0106, CA0106
Default Audio Device
front:CARD=CA0106,DEV=0
CA0106, CA0106
Front speakers
rear:CARD=CA0106,DEV=0
CA0106, CA0106
Rear speakers
center_lfe:CARD=CA0106,DEV=0
CA0106, CA0106
Center and Subwoofer speakers
side:CARD=CA0106,DEV=0
CA0106, CA0106
Side speakers
surround40:CARD=CA0106,DEV=0
CA0106, CA0106
4.0 Surround output to Front and Rear speakers
surround41:CARD=CA0106,DEV=0
CA0106, CA0106
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=CA0106,DEV=0
CA0106, CA0106
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=CA0106,DEV=0
CA0106, CA0106
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=CA0106,DEV=0
CA0106, CA0106
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=CA0106,DEV=0
CA0106, CA0106
IEC958 (S/PDIF) Digital Audio Output
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=Intel
HDA Intel, AD198x Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=Intel,DEV=0
HDA Intel
HDMI Audio Output
[root@server SurroundTestFiles]# alsacard
0
[root@server SurroundTestFiles]# cat /proc/asound/cards
0 [CA0106 ]: CA0106 - CA0106
Audigy SE [SB0570] at 0xcce0 irq 169
1 [Intel ]: HDA-Intel - HDA Intel
HDA Intel at 0xf7ffc000 irq 82
这是我在两种情况下使用的命令(及其相应的输出)。
扬声器测试:
speaker-test -c 4 -D surround40:CA0106 -t wav
这会将正确的声音输出到正确的扬声器(4 个声道到 4 个扬声器)
以下是aplay
尝试使用同一虚拟设备 (surround40) 播放 4 通道声音时的输出:
[root@epr-servmcs-40 SurroundTestFiles]# aplay -v -D surround40:CA0106 -c 4 test-4-channels.wav
Playing WAVE 'test-4-channels.wav' : Signed 24 bit Little Endian in 3bytes, Rate 44100 Hz, Channels 4
aplay: set_params:954: Sample format non available
如果我尝试aplay
在不明确指定设备的情况下使用它,它只会在 2 个扬声器上播放声音,请参阅此测试的输出:
[root@epr-servmcs-40 SurroundTestFiles]# aplay -v -c 4 test-4-channels.wav
Playing WAVE 'test-4-channels.wav' : Signed 24 bit Little Endian in 3bytes, Rate 44100 Hz, Channels 4
Plug PCM: Route conversion PCM (sformat=S24_3LE)
Transformation table:
0 <- 0
1 <- 1
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S24_3LE
subformat : STD
channels : 4
rate : 44100
exact rate : 44100 (44100/1)
msbits : 24
buffer_size : 7526
period_size : 940
period_time : 21333
tstamp_mode : NONE
period_step : 1
avail_min : 940
period_event : 0
start_threshold : 7526
stop_threshold : 7526
silence_threshold: 0
silence_size : 0
boundary : 986447872
Slave: Rate conversion PCM (48000, sformat=S32_LE)
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S24_3LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 24
buffer_size : 7526
period_size : 940
period_time : 21333
tstamp_mode : NONE
period_step : 1
avail_min : 940
period_event : 0
start_threshold : 7526
stop_threshold : 7526
silence_threshold: 0
silence_size : 0
boundary : 986447872
Slave: Direct Stream Mixing PCM
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S32_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 32
buffer_size : 8192
period_size : 1024
period_time : 21333
tstamp_mode : NONE
period_step : 1
avail_min : 1024
period_event : 0
start_threshold : 8192
stop_threshold : 8192
silence_threshold: 0
silence_size : 0
boundary : 1073741824
Hardware PCM card 0 'CA0106' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S32_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 32
buffer_size : 8192
period_size : 1024
period_time : 21333
tstamp_mode : ENABLE
period_step : 1
avail_min : 1024
period_event : 0
start_threshold : 1
stop_threshold : 1073741824
silence_threshold: 0
silence_size : 1073741824
boundary : 1073741824
我的目标是强制(或允许)aplay
正确播放多声道声音(实际上只有 4 声道声音),我的意思是使用 4 个扬声器。
答案1
.wav 文件使用您的硬件不支持的示例格式。
使用设备名称plug:surround40:CA0106
启用自动样本格式转换。
要使其成为默认设备,请在/etc/asound.conf
您的 或 中使用类似的内容~/.asoundrc
:
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "surround40:CA0106"
}
capture.pcm {
type plug
slave.pcm "hw:CA0106"
}
}