為什麼aplay 無法播放4 或6 聲道聲音,而speaker-test 卻可以?

為什麼aplay 無法播放4 或6 聲道聲音,而speaker-test 卻可以?

我目前正在嘗試設定 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"
    }
}

相關內容