Alsa

為什麼aplay在speaker-test的時候不能播放4或6聲道的聲音?

  • October 3, 2013

我目前正在嘗試設置 Soundblaster 卡(CA106 晶片組)以輸出到 4 個通道。

我將 4 個揚聲器插入模擬輸出(使用插頭)。

當我使用該speaker-test實用程序測試 pseakers 時,它執行良好,但每當我嘗試使用實用程序播放 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 個揚聲器。

.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"
   }
}

引用自:https://unix.stackexchange.com/questions/93395