歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> 聆聽自由的聲音----Linux下聲卡驅動軟件ALSA的安裝與配置

聆聽自由的聲音----Linux下聲卡驅動軟件ALSA的安裝與配置

日期:2017/2/27 9:21:11   编辑:更多Linux
  幾年以來,盡管Linux憑借開放、自由的特性和強大的性能,在全球服務器市場上所向披靡,占據越來越多的市場份額,但是若作為桌面軟件,Linux的多媒體特性一直不能讓人非常滿意。比如,Linux系統自帶的聲卡驅動程序能夠支持的聲卡很少。絕大多數市場上流行的聲卡產品都難以得到系統的支持。   這種情況正在迅速轉變。許多廠商看到大勢所趨,積極參加驅動程序的開發工作。一些組織和個人也開始一展身手,做了很多有益的探索。   今天介紹的這套軟件是一套聲卡驅動程序包---ALSA, 全稱是Advanced Linux Sound Architecture。它是GNU大旗下的軟件之一。顧名思義,它可以在Linux下面驅動聲卡設備。  它可以支持大多數流行的聲卡。模塊化架構。支持全雙工,數字音頻等聲卡特性。   在http://www.alsa-project.org所屬的FTP站點可以下載最新的軟件包。如果你有興趣和足夠的能力,也可以加入開發隊伍。向全世界展現聰明才智。   下面詳細介紹ALSA的全部安裝配置過程和注意事項,還會給出支持的聲卡列表。   安裝前請你對照列表,檢查自己的聲卡是否被支持。以免白忙一場。 一:硬件及其軟件環境要求。   作者的硬件環境:賽揚366 CPU/微星6199va主板/128MB kingmax內存/10.2GB金鑽2硬盤/8X CDROM/WINFast L2300顯卡/雅馬哈724芯片的聲卡   硬盤分區和操作系統軟件:Windows98+Windows2000+BluePoint1.0(藍點中文Linux,與Redhat 完全兼容)。使用LILO啟動器。   ALSA對Linux軟件環境的要求:沒有要求特別的Linux版本,但是要求內核版本在2.2.x之上。如果你的Linux系統內核低於此版本,請重新編譯新的核心。BluePoint1.0的內核版本是2.2.13。 二:下載軟件。   ALSA目前最新版本是0.5.9b,文件全名是alsa-driver-0.5.9b.tar.bz2。采用的新的bz2壓縮格式,占用空間更小。除了它之外,正常操作還需要下面的軟件包: alsa-utils-0.5.9a.tar.bz2----------實用程序包 alsa-lib-0.5.9.tar.bz2-------------編譯實用程序需要的庫文件   如果你是使用Windows操作系統下載的軟件,那麼需要把它拷貝到Linux系統裡面。   首先請使用root用戶登錄並開始安裝過程。 1:在Linux裡面裝載含有此文件的Windows分區, 輸入命令: “mount -t vfat /dev/hadx /win98 ”其中hdax中的“x”是Win98硬盤分區號碼。如果對此有任何疑問,請請教其他熟悉的朋友。 2:進入下載的目錄,把alsa-driver-0.5.9b.tar.bz2和其它兩個文件拷貝到一子目錄中, 輸入命令: “cp alsa-driver-0.5.9* /root” 3:解壓縮文件。 輸入命令: “bzip2 -dv alsa-driver-0.5.9b.tar.bz2” 此時用“ls”命令查看,當前目錄裡面只有alsa-driver-0.5.9b.tar,說明bzip壓縮已經解除。 輸入命令: “tar vfx alsa-driver-0.5.9b.tar”   程序自動生成一個名為---alsa-driver-0.5.9b的子目錄。   對其它兩個軟件包重復此步驟,解開壓縮。使用“ls”命令查看,就會發現相應的目錄了。   如果你對命令行不夠熟悉,可以查看幫助信息和書籍。也可以啟動X-Window窗口環境,在文件管理程序裡面選擇相應壓縮文件,然後在文件菜單裡面選擇解壓縮命令就可以了。


三:安裝驅動文件。 1:打開內核中的聲卡支持。 絕大多數情況下,此步驟可以忽略,因為基本所有Linux發行版本內核默認狀態都是支持聲卡設備的。 2:運行腳本。 輸入命令: “./configure” 如果你的聲卡屬於ISA即插即用類型,請輸入下面的命令: “./configure --with-isapnp=yes” 輸入命令: “make install” 注意此步驟操作時間較長,請耐心等候。如果一切正常,程序最後會提示模塊編譯成功!並且警告聲卡默認的狀態是靜音,需要使用“amixer”等實用程序調節音量。 “amixer”等命令正是alsa-utils-0.5.9a.tar.bz2附帶的,需要編譯才能使用。 如果make命令不能執行,那麼你需要找出Linux安裝盤,把有關開發編譯的文件包安裝進系統。具體操作請參考軟件手冊。 輸入命令: “./snddevices” 腳本程序會在“/dev“目錄自動創建有關聲卡設備。 四:安裝庫文件和實用程序。 由於“amixer”等程序需要找到對應的庫文件才能編譯,所以需要首先安裝alsa-lib-0.5.9.tar.bz2。 進入相應的子目錄alsa-lib-0.5.9, 輸入命令: “./configure” 輸入命令: “make install” 這兩步做好後,回到上層目錄,進入alsa-utils-0.5.9a子目錄, 輸入命令: “./configure” 輸入命令: “make install” 注意,如果上面步驟中“./configure”出錯,恐怕你需要使用“-prefix”參數來指定路徑。 如:在安裝庫文件時嘗試使用“./configure -prefix=/usr/include/linux” 在安裝實用程序時嘗試“./configure -prefix=/usr/include/sys” 五:編輯/etc/modules.conf文件。 這一步恐怕是最困難的一步了。不過下面給出范例,一般只要按照各自系統情況改動就可以了。 1:建立modules.conf文件。 因為系統裡面有一個演示文件,所以只要復制一份,重新修改即可 輸入命令: “cp modules.conf.sample modules.conf” 2:修改modules.conf。 使用任何一種文本編輯器,如VI,打開此文件,在最下面加入下列內容: “ #ALSA portion alias char-major-116 snd #注釋:ALSA使用的主設備號碼 alias snd-card-0 snd-card-ymfpci #snd-card-0是系統裡面第一個聲卡設備,如果系統有兩個以上聲卡, #可以使用snd-card-1 snd-card-2等方法映射 # snd-card-ymfpci是聲卡設備名稱. #OSS /free portion----因為ALSA需要內核中OSS SoundCore和其它設備的支持 alias char-major-14 soundcore #系統中soundcore的主設備號碼 alias sound-slot-0 snd-card-0 #第一個聲卡對應的插槽 #下面是聲卡驅動模塊,sound-service-0指第一塊聲卡,如果系統裡面只有一塊,原封不動#拷貝即可.否則按照此格式加入其它聲卡驅動模塊 #card #1 alias sound-service-0-0 snd-mixer-oss alias sound-service-0-1 snd-seq-oss alias sound-service-0-3 snd-pcm-oss alias sound-service-0-8 snd-seq-oss alias sound-service-0-12 snd-pcm-oss #ISA聲卡還需要指定IRQ/IO地址,因為市場上已經很少,在此不再探討。有需要可以查 #看此軟件的相關說明。 ” 六:系統測試和聲卡設備調整。 1:編輯好/etc/modules.conf文件後,需要使用系統程序測試模塊是否可以正常加載。 輸入命令: “modprobe snd-card-ymfpci”

系統直接進入提示符狀態,表明加載正常。不過,如果你搞不清到底加載什麼模塊,可以去/lib/modules/2.2.13/misc下面去查看,可加載聲卡模塊都在裡面。憑借模塊名字就可以知道自己需要什麼文件了。 2:調節音量。 輸入命令: “amixer” 命令提示如下: “ Capabilities: volume Channels: Front-Left Front-Right Limits: min = 0, max = 16383 Front-Left: 0 [0%] [on] [---] Front-Right: 0 [0%] [on] [---] Group ‘ADC Record‘,0 Capabilities: volume Channels: Front-Left Front-Right Limits: min = 0, max = 16383 Front-Left: 0 [0%] [on] [---] Front-Right: 0 [0%] [on] [---] Group ‘Capture Volume‘,0 Capabilities: volume Channels: Front-Left Front-Right Limits: min = 0, max = 16383 Front-Left: 0 [0%] [on] [---] Front-Right: 0 [0%] [on] [---] Group ‘Input Gain‘,0 Capabilities: volume mute jointly-mute Channels: Front-Left Front-Right Limits: min = 0, max = 15 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---] Group ‘Master Mono‘,0 Capabilities: volume mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---] Group ‘Master‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---] Group ‘Aux‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---] Group ‘Video‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---] Group ‘CD‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---] Group ‘Line‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---] Group ‘MIC‘,0 Capabilities: volume mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 0 [0%] [mute] [capture] Front-Right: 0 [0%] [mute] [capture] Group ‘Phone‘,0 Capabilities: volume mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---] Group ‘PC Speaker‘,0 Capabilities: volume mute Channels: Front-Left Front-Right Limits: min = 0, max = 15 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---] Group ‘PCM‘,0 Capabilities: volume mute jointly-mute Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 0 [0%] [mute] [---] Front-Right: 0 [0%] [mute] [---]

”   這表明聲卡驅動默認狀態是靜音,所以需要使用程序調節合適的音量。   本來使用“amixer”命令可以手工指定參數,進行音量調整。不過,為了不至於把跟隨此文一直到現在,大腦可能一直糊裡糊塗的朋友們嚇跑,可以嘗試使用下面的辦法,非常方便。 輸入命令: “alsamixer” 你是否看到一個圖形界面?按F1可以察看幫助信息。注意每個豎條都代表你的聲卡特性。使用 上下左右 光標鍵,可以很容易的調節每種特性的音量。上下光標調數量,比如,我把他們都調到了“74”,左右光標切換豎條。調好之後,按“ESC”鍵退出。 再輸入命令: “amixer“ “Group ‘SPDIF Record‘,0 Capabilities: volume Channels: Front-Left Front-Right Limits: min = 0, max = 16383 Front-Left: 12136 [74%] [on] [---] Front-Right: 12136 [74%] [on] [---] Group ‘ADC Record‘,0 Capabilities: volume Channels: Front-Left Front-Right Limits: min = 0, max = 16383 Front-Left: 12136 [74%] [on] [---] Front-Right: 12136 [74%] [on] [---] Group ‘Capture Volume‘,0 Capabilities: volume Channels: Front-Left Front-Right Limits: min = 0, max = 16383 Front-Left: 12136 [74%] [on] [---] Front-Right: 12136 [74%] [on] [---] Group ‘Input Gain‘,0 Capabilities: volume mute jointly-mute Channels: Front-Left Front-Right Limits: min = 0, max = 15 Front-Left: 11 [73%] [mute] [---] Front-Right: 11 [73%] [mute] [---] Group ‘Master Mono‘,0 Capabilities: volume mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 23 [74%] [mute] [---] Front-Right: 23 [74%] [mute] [---] Group ‘Master‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 23 [74%] [mute] [---] Front-Right: 23 [74%] [mute] [---] Group ‘Aux‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 23 [74%] [mute] [---] Front-Right: 23 [74%] [mute] [---] Group ‘Video‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 23 [74%] [mute] [---] Front-Right: 23 [74%] [mute] [---] Group ‘CD‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 23 [74%] [mute] [---] Front-Right: 23 [74%] [mute] [---] Group ‘Line‘,0 Capabilities: volume mute jointly-mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 23 [74%] [mute] [---] Front-Right: 23 [74%] [mute] [---] Group ‘MIC‘,0 Capabilities: volume mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 23 [74%] [mute] [capture] Front-Right: 23 [74%] [mute] [capture] Group ‘Phone‘,0 Capabilities: volume mute capture exclusive-capture Capture exclusive group: 1 Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 23 [74%] [mute] [---] Front-Right: 23 [74%] [mute] [---] Group ‘PC Speaker‘,0 Capabilities: volume mute Channels: Front-Left Front-Right Limits: min = 0, max = 15 Front-Left: 11 [73%] [mute] [---] Front-Right: 11 [73%] [mute] [---] Group ‘PCM‘,0 Capabilities: volume mute jointly-mute Channels: Front-Left Front-Right Limits: min = 0, max = 31 Front-Left: 23 [74%] [mute] [---] Front-Right: 23 [74%] [mute] [---]”

你會發現你的調整已經起作用了。 3:存儲配置參數。 因為剛才的調整不是永久性的,下次重新啟動時,又成了靜音狀態。所以,需要把參數存儲起來。 輸入命令: “ alsactl store ” 程序自動的建立了配置文件---“/etc/asound.conf“。如果對修改後的配置不滿意,可以使用: “alsactl restore”恢復。 七:聆聽自由的聲音。 到此,所有的安裝過程全部結束了。由於每個人的系統配置各異,所以作者無法預料到所有的情況。有任何問題請平心靜氣,仔細研究、思考。解決不了歡迎上網討論。要知道,這樣你的Linux使用水平會迅速提高。一步到位的安裝雖然簡單,但是少了DIY的樂趣。 感謝你有如此耐心,現在啟動X Window,打開mp3播放器,盡情享受美妙音樂的樂趣吧! 作者:TopMan 2000/8/31 附錄:支持的聲卡列表 1:聲卡列表: ========================================================== 聲卡類型: AMD InterWave 聲卡類型: Gravis UltraSound Plug & Play 聲卡類型: Dynasonic 3-D 聲卡類型: STB Sound Rage 32 聲卡類型: UltraSound 32-Pro (STB) 聲卡類型: MED3210 聲卡類型: Gravis UltraSound MAX 聲卡類型: Gravis UltraSound Extreme 聲卡類型: Gravis UltraSound Classic/ACE 聲卡類型: ESS AudioDrive ESx688 聲卡類型: SoundBlaster 1.0/2.0/Pro 聲卡類型: SoundBlaster 16/AWE 聲卡類型: Yamaha OPL3-SA2/SA3 聲卡類型: Yamaha PCI YMF72x, YMF74x & YMF75x 聲卡類型: OAK Mozart 聲卡類型: S3 SonicVibes PCI 聲卡類型: Schubert 32 PCI (PINE) 聲卡類型: Ensoniq AudioPCI (ES1370,ES1371) 聲卡類型: SoundBlaster PCI 64 聲卡類型: SoundBlaster PCI 128 聲卡類型: Cirrus Logic / Crystal SemicondUCtors CS4232/CS4232A 聲卡類型: Cirrus Logic / Crystal Semiconductors CS4235/CS4236/CS4236B/CS4237B/CS4238B/CS4239 聲卡類型: Turtle Beach Malibu 聲卡類型: Cirrus Logic / Crystal Semiconductors CS4610/CS4612/CS4615/CS4280 聲卡類型: ESS Solo-1 ES1938 聲卡類型: ESS ES18XX 聲卡類型: OPTi 82C9xx 聲卡類型: Audio 16 Pro EPC-SOUN9301 (82C930 based) 聲卡類型: EXPertColor MED-3931 v2.0 (82C931 based) 聲卡類型: ExpertMedia Sound 16 MED-1600 (82C928 based - AD1848) 聲卡類型: Mozart S601206-G (OTI601 based - CS4231) 聲卡類型: Sound Player S-928 (82C928 based - AD1848) 聲卡類型: Trident 4DWave DX/NX 聲卡類型: Best Union Miss Melody 4DWave PCI 聲卡類型: HIS 4DWave PCI 聲卡類型: Warpspeed ONSpeed 4DWave PCI 聲卡類型: AzTech PCI 64-Q3D 聲卡類型: Addonics SV 750 聲卡類型: CHIC True Sound 4Dwave 聲卡類型: Shark Predator4D-PCI 聲卡類型: Jaton SonicWave 4D 聲卡類型: Hoontech SoundTrack Digital 4DWave NX 聲卡類型: ForteMedia FM801 聲卡類型: DT-0398 聲卡類型: SGI Indy (HAL2) 聲卡類型: Turtle Beach WaveFront 聲卡類型: Tropez Plus (Tropez+) 聲卡類型: Tropez 聲卡類型: Maui (models with CS4232; others use OPTi 16 which is not handled) 聲卡類型: C-Media CMI8330 聲卡類型: C-Media CMI8338/8738 聲卡類型: Avance Logic ALS100/ALS120 聲卡類型: Diamond Technologies DT-0197H 聲卡類型: Aztech Sound Galaxy 聲卡類型: MOTU MidiTimePiece AV multiport MIDI interface 聲卡類型: EMU10K1 聲卡類型: Sound Blaster Live! 聲卡類型: Sound Blaster PCI 512 聲卡類型: E-mu APS 聲卡類型: RME Digi9652 (Hammerfall, Hammerfall light) 聲卡類型: Intel i810/i820/i830/i840/MX440 聲卡類型: ESS Maestro 1/2/2E 聲卡類型: VIA 82C686A (South Bridge)

如果你的聲卡不再此列,請下載最新版本的軟件。 來源:ENET



Copyright © Linux教程網 All Rights Reserved