How to control the volume of windows microphone with python?

problem description

use python to control the microphone volume of the windows system. The startup program automatically adjusts the microphone volume to 50%.

to use python to do a function similar to QQ recording detection, I have seen that Pyaudio, can achieve recording function. Then we found that win32.api, can finally control the sound of the loudspeaker.

related codes

import win32api
WM_APPCOMMAND = 0x319

APPCOMMAND_VOLUME_MAX = 0x0a
APPCOMMAND_VOLUME_MIN = 0x09

maximum volume
win32api.SendMessage (- 1, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_MAX * 0x10000)

minimum volume
win32api.SendMessage (- 1, WM_APPCOMMAND, 0x30292, APPCOMMAND_VOLUME_MIN * 0x10000)

I want to adjust the volume of the microphone.

Jul.27,2021

APPCOMMAND_MICROPHONE_VOLUME_DOWN
25
increase the microphone volume.

from: https://docs.microsoft.com/zh.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea91bd-47ced.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea91bd-47ced.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?