I'm trying to make a computer application which will look at the volume that Spotify and discord are outputting, and balance it accordingly so that I can hear my friends, but when they're not talking, my music is louder.
This is for a windows 10 computer, I've used pycaw to get the master volume as well as modify the master volume; however, I could not find an option to get the current volume being outputted.
from __future__ import print_function
from pycaw.pycaw import AudioUtilities, ISimpleAudioVolume, IAudioEndpointVolume, IAudioEndpointVolumeCallback
def main():
sessions = AudioUtilities.GetAllSessions()
for session in sessions:
volume = session._ctl.QueryInterface(ISimpleAudioVolume)
if session.Process and session.Process.name() == "Discord.exe":
print("volume.GetMasterVolume(): %s" % volume.GetMasterVolume())
if __name__ == "__main__":
main()
By doing this, I can get the maximum volume for discord (for example 1.0). However, I want to get the level of audio discord is currently outputting (for example 0.3). What would I need to replace
volume.GetMasterVolume()
to achieve this? Thanks.
from Is there a way for me to see how much volume an application is outputting?
No comments:
Post a Comment