2015-07-28

‎See also

← Older revision

Revision as of 05:45, 28 July 2015

(15 intermediate revisions by the same user not shown)

Line 33:

Line 33:

在本地登录(通过虚拟终端或登录管理器)的用户,都有权限播放音频并调整音量。要让远程登录的用户拥有这些权限,必须把用户[[Users and Groups (简体中文)#用户组管理|加入]] {{ic|audio}} 用户组。该组的成员可以直接访问声音设备,会导致某些程序独占音频输出(破坏软件混音),还可能影响用户快速切换和拖机(multiseat)。因此,除非真的有某些[https://wiki.ubuntu.com/Audio/TheAudioGroup 特殊需求],'''不建议'''把用户加入 {{ic|audio}} 用户组。

在本地登录(通过虚拟终端或登录管理器)的用户,都有权限播放音频并调整音量。要让远程登录的用户拥有这些权限,必须把用户[[Users and Groups (简体中文)#用户组管理|加入]] {{ic|audio}} 用户组。该组的成员可以直接访问声音设备,会导致某些程序独占音频输出(破坏软件混音),还可能影响用户快速切换和拖机(multiseat)。因此,除非真的有某些[https://wiki.ubuntu.com/Audio/TheAudioGroup 特殊需求],'''不建议'''把用户加入 {{ic|audio}} 用户组。



===
用户空间工具
===

+

===
用户权限 ===

+

+

一般情况下,本地用户有权限播放音频和改变音频的音质

+

+

为了允许远程用户使用ALSA,你必须选择将用户 [[Users and groups#Group management|添加]]  {{ic|audio}} 组。

+

+

{{note|Adding users to the {{ic|audio}} group allows direct access to devices. Keep in mind, that this allows applications to exclusively reserve output devices. This may break software mixing or fast-user-switching on multi-seat systems. Therefore, adding a user to the {{ic|audio}} group is '''not''' recommended by default; unless you specifically need to [https://wiki.ubuntu.com/Audio/TheAudioGroup].}}

+

+

=== ALSA 工具
===

从 [[Official repositories (简体中文)|官方仓库]] [[pacman|安装]]  {{Pkg|alsa-utils}} 软件包,其中包含的 {{ic|alsamixer}} 工具允许用户在控制台或终端中配置声音设备。

从 [[Official repositories (简体中文)|官方仓库]] [[pacman|安装]]  {{Pkg|alsa-utils}} 软件包,其中包含的 {{ic|alsamixer}} 工具允许用户在控制台或终端中配置声音设备。

如果你需要 [[#高质量重采样|高质量重采样]] 、 [[#Upmixing/Downmixing|软件模拟环绕立体声]] 和其他高级特性的话 ,请另外安装 {{Pkg|alsa-plugins}} 软件包。

如果你需要 [[#高质量重采样|高质量重采样]] 、 [[#Upmixing/Downmixing|软件模拟环绕立体声]] 和其他高级特性的话 ,请另外安装 {{Pkg|alsa-plugins}} 软件包。

+

=== OSS compatibility ===

如果你想让 OSS 应用程序与 dmix (软件混音)协同工作的话, 请额外安装 {{Pkg|alsa-oss}} 软件包。 请载入 {{ic|snd_seq_oss}}, {{ic|snd_pcm_oss}} 和 {{ic|snd_mixer_oss}} [[Kernel modules (简体中文)|核心模块]] 来启用 OSS 模拟模块。

如果你想让 OSS 应用程序与 dmix (软件混音)协同工作的话, 请额外安装 {{Pkg|alsa-oss}} 软件包。 请载入 {{ic|snd_seq_oss}}, {{ic|snd_pcm_oss}} 和 {{ic|snd_mixer_oss}} [[Kernel modules (简体中文)|核心模块]] 来启用 OSS 模拟模块。

+

+

=== ALSA 和 Systemd ===

+

+

The {{Pkg|alsa-utils}} package comes with [[systemd]] unit configuration files {{ic|alsa-restore.service}} and {{ic|alsa-store.service}} by default.

+

+

These are automatically installed and activated during installation. Therefore, there is no further action needed. Though, you can check their status using {{ic|systemctl}}.

+

+

{{note|For reference, ALSA stores its settings in {{ic|/var/lib/alsa/asound.state}}}}

==解除各声道的静音==

==解除各声道的静音==

Line 67:

Line 84:

* 华硕Asus上网本在xfce4等桌面环境设置请参考[[Asus Eee PC]]}}

* 华硕Asus上网本在xfce4等桌面环境设置请参考[[Asus Eee PC]]}}

+

===测试你改变的设置===

接下来,测试声卡是否工作:

接下来,测试声卡是否工作:

Line 75:

Line 93:

$ speaker-test -c 8

$ speaker-test -c 8



如果没有正常工作,请继续阅读 [[#配置]] 以及 [[#疑难解答]]
部分。

+

If audio is being outputted to the wrong device, try manually specifying it with the  argument {{ic|-D}}.

+

+

$ speaker-test -D default -c 8

+

+

{{ic|-D}} accepts PCM channel names as values, which can be retrieved by running the following:

+

+

{{hc|<nowiki>$ aplay -L | grep :CARD</nowiki>|2=

+

default:CARD=PCH  # 'default' is the PCM channel name

+

sysdefault:CARD=PCH

+

front:CARD=PCH,DEV=0

+

surround21:CARD=PCH,DEV=0

+

surround40:CARD=PCH,DEV=0

+

surround41:CARD=PCH,DEV=0

+

surround50:CARD=PCH,DEV=0

+

surround51:CARD=PCH,DEV=0

+

surround71:CARD=PCH,DEV=0

+

}}

+

+

如果没有正常工作,请继续阅读 [[#配置]] 以及 [[#疑难解答]]
部分。和 [[ALSA/Troubleshooting]] 页面。

+

{{pkg|alsa-utils}} 软件包提供了两个配置 alsa 的服务:{{ic|alsa-restore.service}} 和 {{ic|alsa-store.service}}。它们分别在开机和关机时自动运行。

{{pkg|alsa-utils}} 软件包提供了两个配置 alsa 的服务:{{ic|alsa-restore.service}} 和 {{ic|alsa-store.service}}。它们分别在开机和关机时自动运行。

+

=== Additional notes ===

+

+

* If your system has more than one soundcard, then you can switch between them by pressing {{ic|F6}}

+

+

* Some cards need to have digital output muted or disabled in order to hear analog sound. For the Soundblaster Audigy LS mute the channel labeled {{ic|IEC958}}.

+

+

* Some machines, (like the Thinkpad T61), have a {{ic|Speaker}} channel which must be unmuted and adjusted as well.

+

+

* Some machines, (like the Dell E6400) may also require the {{ic|Front}} and {{ic|Headphone}} channels to be unmuted and adjusted.

+

+

* If your volume adjustments seem to be lost after you reboot, try running alsamixer as root.

== 配置 ==

== 配置 ==

Line 220:

Line 268:

===设置默认声卡===

===设置默认声卡===



+

{{Expansion|Explain the difference between a "card" and a "device." {{ic|amixer --help}} suggests the two are not synonymous}}

如果发现开机时声卡次序会发生变化,可以在通过 {{ic|/etc/modprobe.d}} 中的 {{ic|.conf}} 文件(比如 {{ic|/etc/modprobe.d/alsa-base.conf}})手动设置次序。

如果发现开机时声卡次序会发生变化,可以在通过 {{ic|/etc/modprobe.d}} 中的 {{ic|.conf}} 文件(比如 {{ic|/etc/modprobe.d/alsa-base.conf}})手动设置次序。

比如,要让 mia 声卡成为 #0、Intel HDA 声卡成为 #1:

比如,要让 mia 声卡成为 #0、Intel HDA 声卡成为 #1:

Line 302:

Line 350:

{{note|请注意默认地址类型。}}

{{note|请注意默认地址类型。}}



====
Alternative method
====

+

====
另外一种方式
====



+

{{提示|This process can be partly automated using {{AUR|asoundconf}} from the [[Arch User Repository]].}}

首先,运行 {{ic|aplay -l}},获取声卡的声卡ID和设备ID:

首先,运行 {{ic|aplay -l}},获取声卡的声卡ID和设备ID:

Line 322:

Line 370:

</nowiki>}}

</nowiki>}}

+

{{Warning|Simply setting a {{ic|type hw}} as default card is equivalent to addressing hardware directly, which leaves the device unavailable to other applications. This method is only recommended if it is a part of a more sophisticated setup {{ic|~/.asoundrc}} or if user deliberately wants to address sound card directly (digital output through {{ic|eic958}} or dedicated music server for example).}}

拿输出中的最后一项来说,这个声卡的声卡ID为2,设备ID为0。若要把这块声卡作为默认声卡,可以把下列配置添加到系统级别的 {{ic|/etc/asound.conf}} 或用户级别的 {{ic|~/.asoundrc}} 文件。如果文件不存在,可以手动创建。其中的各个ID,请根据实际情况调整:

拿输出中的最后一项来说,这个声卡的声卡ID为2,设备ID为0。若要把这块声卡作为默认声卡,可以把下列配置添加到系统级别的 {{ic|/etc/asound.conf}} 或用户级别的 {{ic|~/.asoundrc}} 文件。如果文件不存在,可以手动创建。其中的各个ID,请根据实际情况调整:

{{bc|

{{bc|

Line 357:

Line 406:

Audio

Audio

}}

}}

+

+

Alternatively use ''cat'', which might return unused devices:

+

{{hc|$ cat /proc/asound/card*/id|

+

PCH

+

ThinkPadEC

+

}}

+

{{Note|这种方法在有多个相同(alsa)名字的声卡的时候很可能会出现问题。}}

{{Note|这种方法在有多个相同(alsa)名字的声卡的时候很可能会出现问题。}}

Line 415:

Line 471:

===启用 SPDIF 输出===

===启用 SPDIF 输出===



+

[[wikipedia:S/PDIF|S/PDIF]] is a digital audio interface often used to connect a computer to a digital amplifier (such as a home theatre with 5.1/7.1 surround sound).

+

{{note|With some soundcards this disables analog sound output  (eg. Audigy2).}}

* 在 {{ic|~/.xinitrc}} 中加入下面一行:

* 在 {{ic|~/.xinitrc}} 中加入下面一行:

amixer -c 0 cset name='IEC958 Playback Switch' on

amixer -c 0 cset name='IEC958 Playback Switch' on

Line 623:

Line 680:

==疑难解答==

==疑难解答==

+

+

=== Hot-plugging a USB sound card ===

+

+

See [http://alsa.opensrc.org/Udev Writing Udev rules for ALSA].

+

+

=== Simultaneous output ===

+

+

You might want to play music via external speakers connected via mini jack and internal speakers simultaneously. This can be done by unmuting '''Auto-Mute''' item using {{ic|alsamixer}} or {{ic|amixer}}:

+

$ amixer sset "Auto-Mute" unmute

+

+

and then unmuting other required items, such as '''Headphones''', '''Speaker''', '''Bass Speaker'''...

+

{{Note|If you have a crackling sound through headphones connector (mini-jack) after, see [[ALSA/Troubleshooting#Crackling_sound_through_mini-jack_.28headphones_connector.29|here]].}}

+

+

=== Keyboard volume control ===

+

+

Map the following commands to your volume keys: {{ic|XF86AudioRaiseVolume}}, {{ic|XF86AudioLowerVolume}}, {{ic|XF86AudioMute}}

+

+

To raise the volume:

+

amixer set Master 5%+

+

+

To lower the volume:

+

amixer set Master 5%-

+

+

To toggle mute/unmute of the volume:

+

amixer set Master toggle

+

=== Audigy 2 ZS 不发出声音 ===

=== Audigy 2 ZS 不发出声音 ===

Show more