-
Notifications
You must be signed in to change notification settings - Fork 1
Examples
Fábián Varga edited this page Jul 24, 2022
·
1 revision
- First start off with
>>> import CoreAudio
>>> CoreAudio.init() # The module must always be initialised before you can use it properly.
True
- We can check whether the module is initialised like this:
>>> CoreAudio.ready()
True
Note: This is not required, just check what the init() function returned.
- Now, we can get the current volume level (in %)
>>> CoreAudio.getVolume()
17 # Current system volume level is set to 17%
- Now let's change it!
>>> CoreAudio.setVolume(10) # Set system volume to 10%`
True # Operation successful`
- We can also check if the output is muted;
>>> CoreAudio.getMute()
False # No it's not muted
- Let's change that!
>>> CoreAudio.setMute(True)
True # Operation successful
Side note: You can also use CoreAudio.mute() and CoreAudio.unmute(), which are aliases to CoreAudio.setMute(True) and CoreAudio.setMute(False)