Linux音频问题
来源:互联网 发布:运营和美工哪个累 编辑:程序博客网 时间:2024/05/21 17:05
关键字: alsa, pulseaudio, gnome, gnome-volume, 右下角,喇叭,音量
alsactl, alsa-utils, pulseaudio-utils
一、音频调节工具
alsaunmute (alsa-utils) 是一个脚本,用于初始化ALSA声音设备。它调用了alsactl,并且以init为参数。它没有任何参数,直接就是:
$ alsaunmute它的内容如下:
#!/bin/shexec /sbin/alsactl \ -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf \ --initfile=/lib/alsa/init/00main \ init
alsactl 是alsa系统最重要的工具,它主要用于对alsa的声卡进行控制。它支持多块声卡,
如果你的声卡的功能不能在图形界面中进行控制,那么你就应该使用这个 alsactl 工具。
alsa最主要的三个用法如下:
1)alsactl store 命令将当前声卡的驱动程序状态保存到一个配置文件(默认是/etc/asound.state, 可以用 -f 来指定)中去;
2)alsactl restore 则从这个配置文件恢复原来的声卡驱动状态。
3)alsactl init 将声卡的状态初始化为默认状态。
二、配置文件语法
三、ALSA配置文件(/etc/asound.conf)的格式
# 从#开始的地方是注释# 把其他配置文件包含进来<filename># 简单赋值语句name [=] value [,|;]# 结构体赋值 (第一种风格)name [=] {name1 [=] value [,|;]...}# 结构体赋值 (第二种风格)name.name1 [=] value [,|;]# 数组赋值 (第一种风格)name [value0 [,|;]value1 [,|;]...]# 数组赋值 (第二种风格)name.0 [=] value0 [,|;]name.1 [=] value1 [,|;]# ******************************************************************************# 对服务器的定义server.NAME { host STR# host where the server is located (if map to local address # server is local, and then it may be started automatically) [socket STR]# PF_LOCAL socket name to listen/connect [port INT]# PF_INET port number to listen/connect}# PCM类型定义pcm_type.NAME { [lib STR]# 共享库文件 (默认 libasound.so) [openSTR]# 打开函数 (默认 _snd_pcm_NAME_open) [redirect {# 将这个PCM重定向到另一个PCM [filename STR]# 配置文件说明 name STR# PCM名称说明 }]}# PCM范围类型定义pcm_scope_type.NAME { [lib STR]# 共享库文件 (默认 libasound.so) [open STR]# 打开函数 (default _snd_pcm_scope_NAME_open)}# PCM 范围定义pcm_scope.NAME { type STR# Scope type ...}# 从属 PCM 定义pcm_slave.NAME { pcm STR# PCM name#or pcm { }# PCM definition format STR# Format channels INT# Channels rate INT# Rate period_time INT# Period time buffer_time INT# Buffer time etc.}# Hook arguments definitionhook_args.NAME { ...# Arbitrary arguments}# PCM hook typepcm_hook_type.NAME { [lib STR]# Library file (default libasound.so) [install STR]# Install function (default _snd_pcm_hook_NAME_install)}# PCM hook definitionpcm_hook.NAME { type STR# PCM Hook type (see pcm_hook_type) [args STR]# Arguments for install function (see hook_args) # or [args { }]# Arguments for install function}# PCM 定义pcm.NAME { type STR# Type [comment ANY]# Saved comments# PCM 类型: type hw # Kernel PCM card INT/STR# Card name or number [device] INT# Device number (default 0) [subdevice] INT# Subdevice number, -1 first available (default -1) mmap_emulation BOOL# enable mmap emulation for ro/wo devices type hooks # PCM with hooks slave STR# Slave name (see pcm_slave) # or slave {# Slave definition pcm STR# Slave PCM name # or pcm { }# Slave PCM definition } hooks { ID STR# Hook name (see pcm_hook) # or ID { }# Hook definition (see pcm_hook) } type plug# Format adjusted PCM slave STR# Slave name (see pcm_slave) # or slave {# Slave definition pcm STR# Slave PCM name # or pcm { }# Slave PCM definition [format STR]# Slave format (default nearest) or "unchanged" [channels INT]# Slave channels (default nearest) or "unchanged" [rate INT]# Slave rate (default nearest) or "unchanged" } route_policy STR# route policy for automatic ttable generation# STR can be 'default', 'average', 'copy', 'duplicate'# average: result is average of input channels# copy: only first channels are copied to destination# duplicate: duplicate first set of channels# default: copy policy, except for mono capture - sum ttable { # Transfer table (bidimensional compound of # cchannels * schannels numbers) CCHANNEL { SCHANNEL REAL# route value (0.0 ... 1.0) } } type copy# Copy conversion PCM slave STR# Slave name (see pcm_slave) # or slave {# Slave definition pcm STR# Slave PCM name # or pcm { }# Slave PCM definition } type linear# Linear format conversion PCM type adpcm# IMA-ADPCM format conversion PCM type alaw# A-Law format conversion PCM type mulaw# Mu-Law format conversion PCM slave STR# Slave name (see pcm_slave) # or slave {# Slave definition pcm STR# Slave PCM name # or pcm { }# Slave PCM definition format STR# Slave format } type rate# Rate conversion PCM slave STR# Slave name (see pcm_slave) # or slave {# Slave definition pcm STR# Slave PCM name # or pcm { }# Slave PCM definition [format STR]# Slave format (default client format) rate INT# Slave rate } type route# Attenuated static route PCM slave STR# Slave name (see pcm_slave) # or slave {# Slave definition pcm STR# Slave PCM name # or pcm { }# Slave PCM definition [format STR]# Slave format (default client format) [channels INT]# Slave channels (default client channels) } ttable { # Transfer table (bidimensional compound of # cchannels * schannels numbers) CCHANNEL { SCHANNEL REAL# route value (0.0 ... 1.0) } } type multi# Linked PCMs (exclusive access to selected channels) slaves {# Slaves definitions ID STR# Slave name for slave N (see pcm_slave) # or ID {# Slave definition for slave N pcm STR# Slave PCM name # or pcm { }# Slave PCM definition channels INT# Slave channels } } bindings {# Bindings table N {# Binding for client channel N slave STR# Slave key channel INT# Slave channel } } [master INT]# Define the master slave type file# File plugin slave STR# Slave name (see pcm_slave) # or slave {# Slave definition pcm STR# Slave PCM name # or pcm { }# Slave PCM definition } file STR# File name # or file INT# File descriptor [format STR]# File format (NYI) [perm INT]# File permission (default 0600) type meter# Meter PCM slave STR# Slave name (see pcm_slave) # or slave {# Slave definition or name pcm STR# Slave PCM name # or pcm { }# Slave PCM definition } [frequency INT]# Updates per second scopes {# Scopes ID STR# Scope name (see pcm_scope) # or ID { }# Scope definition (see pcm_scope) } type droute# Attenuated dynamic route PCM (NYI) slave STR# Slave name (see pcm_slave) # or slave {# Slave definition pcm STR# Slave PCM name # or pcm { }# Slave PCM definition [format STR]# Slave format (default client format) [channels INT]# Slave channels (default client channels) } ctl STR# Ctl name bindings {# Bindings table ID {# Binding entry cchannels {# Client channels C INT# Client channel } schannel {# Slave channels S INT# Slave channel } control STR# Control name of C * S (or C values: only if C == S) } } type null# Null endpoint plugin [time INT]# Time related or not (NYI) type shm# Shared memory client PCM server STR# Server name pcm STR# PCM name on server type share# Share PCM slave STR# Slave name (see pcm_slave) bindings {# Bindings table N INT# Slave channel for client channel N } type mix# Mix PCM slave STR# Slave name (see pcm_slave) bindings {# Bindings table N INT# Slave channel for client channel N } type ladspa# LADSPA plugin PCM slave STR# Slave name (see pcm_slave) path STR# Path or paths (delimited with ':') plugins | playback_plugins | capture_plugins { N {# Configuration for LADSPA plugin N id ## LADSPA plugin ID (for example 1043) label STR# LADSPA plugin label (for example 'delay_5s') filename STR# Full filename of .so library with LADPA plugin code policy STR# Policy can be 'none' or 'duplicate' input | output { bindings { C INT or STR # C - channel, INT - audio port index, STR - audio port name } controls { I INT or REAL # I - control port index, INT or REAL - control value } } } } type dmix# Direct mixing plugin slave STR# Slave name (see pcm_slave) ipc_key INT# Unique ipc key ipc_perm INT# ipc permissions (default 0600) ipc_gid INT# ipc gid (default -1 = disable) ipc_key_add_uid BOOL # Add current uid to ipc_key bindings {# Bindings table N INT# Slave channel for client channel N } type dsnoop# Direct snoop (split one capture stream to more) slave STR# Slave name (see pcm_slave) ipc_key INT# Unique ipc key ipc_perm INT# ipc permissions (default 0600) ipc_gid INT# ipc gid (default -1 = disable) ipc_key_add_uid BOOL # Add current uid to ipc_key bindings {# Bindings table N INT# Slave channel for client channel N } type dshare# Share channels from one stream slave STR# Slave name (see pcm_slave) ipc_key INT# Unique ipc key ipc_perm INT# ipc permissions (default 0600) ipc_gid INT# ipc gid (default -1 = disable) ipc_key_add_uid BOOL # Add current uid to ipc_key bindings {# Bindings table N INT# Slave channel for client channel N }}# CTL type definitionctl_type.NAME { [lib STR]# Library file (default libasound.so) [open STR]# Open function (default _snd_ctl_NAME_open)}# CTL definitionctl.NAME { type STR# Type [comment ANY]# Saved comments# CTL types type hw card STR/INT# Card name or number type shm# Shared memory client CTL server STR# Server name ctl STR# CTL name on server}# RAWMIDI type definitionrawmidi_type.NAME { [lib STR]# Library file (default libasound.so) [open STR]# Open function (default _snd_rawmidi_NAME_open)}# RAWMIDI definitionrawmidi.NAME { type STR# Type [comment ANY]# Saved comments# RAWMIDI types: type hw # Kernel RAWMIDI card INT/STR# Card name or number [device] INT# Device number (default 0) [subdevice] INT# Subdevice number, -1 first available (default -1)}# SEQ 类型定义seq_type.NAME { [lib STR]# Library file (default libasound.so) [open STR]# Open function (default _snd_seq_NAME_open)}# SEQ 定义seq.NAME { type STR# Type [comment ANY]# Saved comments# SEQ types: type hw # Kernel SEQ}# 别名DEF.NAME1 NAME2# DEF.NAME1 是 DEF.NAME2 的别名举例如下:pcm.trident {type hwcard 0device 0}pcm.ice1712 {type hwcard 1device 0}pcm.ice1712_spdif {type plugttable.0.8 1ttable.1.9 1slave.pcm ice1712}pcm_slave.rs {pcm tridentrate 44100}pcm.r {type rateslave rs}pcm.m {type meterslave.pcm plug:tridentfrequency 50scopes [{type level}]}pcm_scope_type.level {lib /home/abramo/scopes/scope-level.so} # an example command is 'aplay -D plug:ladspa <filename>'# otherwise, the ladspa plugin expects FLOAT type which# is very rarepcm.ladspa { type ladspa slave.pcm "plughw:0,0"; path "/home/perex/src/ladspa_sdk/plugins"; plugins [ { label delay_5s input { controls [ 0.8 0.2 ] } } ]}# an example command for dmix plugin to force 44100Hz mixing rate:# aplay -D"plug:'dmix:RATE=44100'" <filename># an example command for dmix plugin to force 44100Hz and hw:1,0 output device# aplay -Dplug:\'dmix:SLAVE=\"hw:1,0\",RATE=44100\' <filename># an example command for dmix plugin to force 32-bit signed little endian format# aplay -D"plug:'dmix:FORMAT=S32_LE'" <filename>
- Linux音频问题
- 漫谈Linux下的音频问题
- 漫谈Linux下的音频问题
- linux 音频
- Linux audio explained------揭开Linux音频问题的背后原因
- mpga音频转换问题
- win 7 音频问题
- ffmpeng 音频连接问题
- win8音频驱动问题
- 手机音频问题探讨
- iOS音频播放问题
- 音频问题测试解决
- mpeg2音频失真问题
- 音频播放问题
- win10音频问题
- Linux音频编程实例
- Linux下音频编程
- linux音频编程
- OpenSubdiv--皮克斯演示开源图形技术
- APP_Code下代码编译生成报找不到命名空间
- ASP.NET Web Service如何工作(1)
- ubuntu 用Awstats分析Apache日志
- 浏览器缓存初探
- Linux音频问题
- Servlet配置里面的多方式使用
- 屏幕元素
- log4j学习
- poj1113 - Wall
- weblogic中报javax.persistence.OneToMany.orphanRemoval()Z错
- POJ 3487 The Stable Marriage Problem(Gale-Shapley算法求稳定婚姻)
- linux 环境变量
- 软件项目管理与《拯救大兵瑞恩》