如何用python3控制音量? [英] how to control volume with python3?

查看:546
本文介绍了如何用python3控制音量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个闹钟程序,以便早上起床.我希望它播放的声音尽可能大,因此需要将音量提高到100%. 我还问了如何使用python更改音量?. @macmoonshine建议我使用"AppleScript".这对我来说很好并且有用,但是它仅适用于python2(python3上的错误)和(不确定)仅适用于苹果.如何编写无需使用AppleScript即可控制python3音量的程序? 多谢您的帮助(;

I wanted to write an alarm program, for waking up in mornings. I want it to play sound as loud as possible, so it needs to raise up volume to 100%. I also asked how to change volume with python?. @macmoonshine suggest me to use 'AppleScript'. it was good and worked for me, but it works only on python2(error on python3) and(not sure) only works for apple. how can I write a program that can control volume in python3 without using AppleScript? I'd appreciate your help(;

推荐答案

只需使用所需的代码和python2代码中的os.startfile('Path to ur file')os.system('python2 path-to-file')创建一个python2文件,就这么简单.

Just make a python2 file with the required code and os.startfile('Path to ur file') or os.system('python2 path-to-file') from your python2 code, its simple as that.

这篇关于如何用python3控制音量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆