pulsemixer-cli和curses pulseaudio混音器
pulsemixer的Python项目详细描述
脉冲施密器
Pulseaudio的cli和curses混音器
要求
Python
>;=3.3PulseAudio
>;=1.0
安装
Python
>;=3.3PulseAudio
>;=1.0pulsemixer是一个自给自足的单文件python应用程序,不需要任何额外的库。您只需手动下载pulsemixer,执行chmod +x ./pulsemixer
,然后将其放在您想要的任何位置。
下面是一些更方便的安装Pulsemixer的方法:
卷曲
curl https://raw.githubusercontent.com/GeorgeFilipkin/pulsemixer/master/pulsemixer > pulsemixer && chmod +x ./pulsemixer
点
pip install pulsemixer
交互模式
如果未给出参数(除了--color
和--server
),则使用交互模式
交互式控件:
j k ↑ ↓ Navigation
h l ← → Change volume
H L Shift← Shift→ Change volume by 10
1 2 3 .. 8 9 0 Set volume to 10%-100%
m Mute/Unmute
Space Lock/Unlock channels
Enter Context menu
F1 F2 F3 Change modes
Tab Shift Tab Next/Previous mode
Mouse click Select device or mode
Mouse wheel Volume change
Esc q Quit
通过上下文菜单可以set-default-sink
,set-default-source
,move-sink-input
,move-source-output
,suspend-sink
,suspend-source
,set-sink-port
,set-source-port
,kill-client
,kill-sink-input
,kill-source-output
,set-card-profile
有关这些功能的详细信息,请参见man pactl
cli
Usage of pulsemixer:
-h, --help show this help message and exit
-v, --version print version
-l, --list list everything
--list-sources list sources
--list-sinks list sinks
--id ID specify ID, default sink is used if no ID specified
--get-volume get volume for ID
--set-volume n set volume for ID
--set-volume-all n:n set volume for ID, for every channel
--change-volume +-n change volume for ID
--max-volume n set volume to n if volume is higher than n
--get-mute get mute for ID
--mute mute ID
--unmute unmute ID
--toggle-mute toggle mute for ID
--server choose the server to connect to
--color n 0 no color, 1 color currently selected, 2 full-color
--no-mouse disable mouse support
--create-config generate configuration file
cli示例
Pulsemixer遵循PulseAudio的术语:
- 接收器-输出设备
- 源-输入设备
- 接收器输入-连接到输出设备的流,即接收器的输入
- 源输出-连接到输入设备的流,即源的输出。
$ pulsemixer --list Sink: ID: sink-1, Name: Built-in Stereo, Mute: 0, Channels: 2, Volumes: ['60%', '60%'], Default Sink: ID: sink-3, Name: HDMI Audio (HDMI 2), Mute: 0, Channels: 2, Volumes: ['50%', '50%'] Sink input: ID: sink-input-663, Name: Firefox, Mute: 0, Channels: 2, Volumes: ['60%', '60%'] Sink input: ID: sink-input-686, Name: mocp, Mute: 0, Channels: 2, Volumes: ['60%', '60%'] Source: ID: source-1, Name: HDMI Audio (HDMI 2), Mute: 0, Channels: 2, Volumes: ['100%', '100%'] Source: ID: source-2, Name: Built-in Stereo, Mute: 0, Channels: 2, Volumes: ['40%', '40%'], Default Source output: ID: source-output-7, Name: arecord, Mute: 0, Channels: 1, Volumes: ['40%]
默认接收器的打印音量,减少5,打印新音量:
$ pulsemixer --get-volume --change-volume -5 --get-volume 60605555
切换source-1
的静音,打印静音状态:
$ pulsemixer --id source-1 --toggle-mute --get-mute
1
将sink-input-663
的音量设置为50,然后将sink-3
的音量设置为10(左声道)和30(右声道):
$ pulsemixer --id sink-input-663 --set-volume 50 --id sink-3 --set-volume-all 10:30
将sink-input-686
的音量增加10,但不要超过100:
$ pulsemixer --id sink-input-686 --change-volume +10 --max-volume 100
配置
可选。
配置文件不会自动创建。从这里复制粘贴
;; Goes into ~/.config/pulsemixer.cfg, $XDG_CONFIG_HOME respected;; Everything that starts with "#" or ";" is a comment;; For the option to take effect simply uncomment it[general]step=1step-big=10; server = [keys];; To bind "special keys" such as arrows see "Key constant" table in;; https://docs.python.org/3/library/curses.html#constants; up = k, KEY_UP, KEY_PPAGE; down = j, KEY_DOWN, KEY_NPAGE; left = h, KEY_LEFT; right = l, KEY_RIGHT; left-big = H, KEY_SLEFT; right-big = L, KEY_SRIGHT; top = g, KEY_HOME; bottom = G, KEY_END; mode1 = KEY_F1; mode2 = KEY_F2; mode3 = KEY_F3; next-mode = KEY_TAB; prev-mode = KEY_BTAB; mute = m; lock = ' ' ; 'space', quotes are stripped; quit = q, KEY_ESC[ui]; hide-unavailable-profiles = no; hide-unavailable-ports = no; color = 2 ; same as --color, 0 no color, 1 color currently selected, 2 full-color; mouse = yes[style];; Pulsemixer will use these characters to draw interface;; Single characters only; bar-top-left = ┌; bar-left-mono = ╶; bar-top-right = ┐; bar-right-mono = ╴; bar-bottom-left = └; bar-bottom-right = ┘; bar-on = ▮; bar-off = -; arrow = ' '; arrow-focused = ─; arrow-locked = ─; default-stream = *; info-locked = L; info-unlocked = U; info-muted = M ; ?; info-unmuted = M ; ?[renames];; Changes stream names in interactive mode, regular expression are supported;; https://docs.python.org/3/library/re.html#regular-expression-syntax; 'default name example' = 'new name'; '(?i)built-in .* audio' = 'Audio Controller'; 'AudioIPC Server' = 'Firefox'
仍然支持旧的环境变量PULSEMIXER_BAR_STYLE
。
在(例如)zsh中更改音量条的外观而不创建配置文件:
exportPULSEMIXER_BAR_STYLE="╭╶╮╴╰╯◆· ──"
另请参见
python-pulse-control-Python高级接口和PulseAudio的基于ctypes的绑定