如何用python3控制音量? [英] how to control volume with 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屋!