macOS下命令行 切换Mac的声音输出设备和控制音量大小
如何快速切换Mac的声音输出设备,可以直接点菜单栏的图标,或者按住Option键【一般按这个会有意外惊喜,比如按住Wi-Fi的图标之类的】,然后选择就可以了
对于键盘党来说可能觉得不够效果 ,所以我检索了下,有开源的方式可以实现,安装switchaudio-osx
Switch Audio Outputs with a Keyboard Shortcut on OS X
A command-line utility to switch the audio source on Mac OS X.
https://github.com/deweller/switchaudio-osx
http://apetronix.com/switch-audio-outputs-with-a-keyboard-shortcut-on-os-x/
➜ ~ brew install switchaudio-osx
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/switchaudio-osx-1.0.0.catalina
######################################################################## 100.0%
==> Pouring switchaudio-osx-1.0.0.catalina.bottle.2.tar.gz
/usr/local/Cellar/switchaudio-osx/1.0.0: 8 files, 62.4KB
关于帮助:
Usage-----AudioSwitcher [-a] [-c] [-t type] [-n] -s device_name - **-a** : shows all devices - **-c** : shows current device - **-t** _type_ : device type (input/output/system). Defaults to output. - **-n** : cycles the audio device to the next one - **-s** _device_name_ : ts the audio device to the given device by name
比如我的设备如下:
➜ ~ SwitchAudioSource -a
External Microphone (input)
MacBook Pro Microphone (input)
External Headphones (output)
MacBook Pro Speakers (output)
当前连接的设备
➜ ~ SwitchAudioSource -a -c
MacBook Pro Speakers
切换到我的有线耳机上
➜ ~ SwitchAudioSource -a -c -s "External Headphones"
output audio device t to "External Headphones"
切换到我的Macbook Pro本上
➜ ~ SwitchAudioSource -a -c -s "MacBook Pro Speakers"
output audio device t to "MacBook Pro Speakers"
当然可以通过设置alias来快速切换
➜~ cat .zshrc|tail -n 4#➜~ SwitchAudioSource -a -c -s "External Headphones"#➜~ SwitchAudioSource -a -c -s "MacBook Pro Speakers"alias erji="/usr/local/bin/SwitchAudioSource -a -c -s "External Headphones""alias mac="/usr/local/bin/SwitchAudioSource -a -c -s "MacBook Pro Speakers""
顺带看下如何通过命令行来控制音量大小:
Change Mac System Volume➜ ~ neofetch 'c. lex@Mac ,xNMM. ------- .OMMMMo OS: macOS Catalina 10.15.7 19H2 x86_64 OMMM0, Host: MacBookPro15,1 .;loddo:' loolloddol;. Kernel: 19.6.0 cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 4 days, 17 hours, 30 mins .KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 144 (brew) XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: zsh 5.7.1;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 1680x1050:MMMMMMMMMMMMMMMMMMMMMMMM: DE: Aqua.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Quartz Compositor kMMMMMMMMMMMMMMMMMMMMMMMMWd. WM Theme: Blue (Dark) .XMMMMMMMMMMMMMMMMMMMMMMMMMMk Terminal: iTerm2 .XMMMMMMMMMMMMMMMMMMMMMMMMK. Terminal Font: MesloLGSForPowerline-BoldItalic 17 kMMMMMMMMMMMMMMMMMMMMMMd CPU: Intel i7-8850H (12) @ 2.60GHz ;KMMMMMMMWXXWMMMMMMMk. GPU: Intel UHD Graphics 630, Radeon Pro 560X .cooc,. .,coo:. Memory: 25360MiB / 32768MiB设置音量大小方式如下:可以不用sudo的t Volume 3 - 10➜ ~ sudo osascript -e "t Volume 3"➜ ~ sudo osascript -e "t volume output volume 30"➜ ~ sudo osascript -e "t volume output volume 50➜ ~ osascript -e "get volume ttings"output volume:30, input volume:50, alert volume:100, output muted:fal➜ ~ osascript -e "t volume output volume 50"➜ ~ osascript -e "t volume output volume 60"设置静音开启和关闭➜ ~ osascript -e "t volume output muted true"➜ ~ osascript -e "t volume output muted fal"
反正是多一种方式。哈 就当学习了
本文发布于:2023-02-28 21:10:00,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/zhishi/a/1677732316101334.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:system volume(system volume information怎么删除).doc
本文 PDF 下载地址:system volume(system volume information怎么删除).pdf
留言与评论(共有 0 条评论) |