在Python中调整OSX系统音频音量
我想通过 python 脚本调整 OSX 中的系统音量。 这个关于实现键盘快捷键的问题告诉我如何在 applescript 中做到这一点,但我真的很想从我的 python 脚本中做到这一点,而不使用 os.system、popen 等。理想情况下,我想使用一些像这样的 python 代码慢慢增加音量:
set_volume(0)
for i in range(50):
set_volume(i*2)
time.sleep(1)
I would like to adjust the system audio volume in OSX from a python script. This question about implementing keyboard shortcuts tells me how to do it in applescript, but I'd really like to do it from my python script without using os.system, popen, etc. Ideally I'd like to ramp up the volume slowly with some python code like this:
set_volume(0)
for i in range(50):
set_volume(i*2)
time.sleep(1)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 appscript 控制 StandardAdditions 脚本添加
设置音量
命令:Use appscript to control the StandardAdditions scripting addition
set volume
command: