I am working on a auto set volume skill, that sets volume after how mch noice is in the room.
I got a prototype working on a picroft whith google voice kit. But when testing on mark_1 i ran into problems.
The skill reads mic thresh from os.path.join(get_ipc_directory(), “mic_level”) meaning /ramdisk/mycroft/ipc/mic_level. And then desides if volume should be set high or low.
But on picroft the file has this when no noice in room
Energy: cur=2 thresh=3.7810089716306976
on mark_1 the file has this when no noice in room
Energy: cur=551 thresh=747.0783252534047
So how to make the deside what is no noice and not?
I read the line in the file, and split it to get meter_thresh and then if it is low set volume low and high set volume high. But when thresh can be different on different devises I cant figure out how to make the code so i accounts for that.
parts = line.split("=") meter_thresh = float(parts[-1]) meter_cur = float(parts[-2].split(" ")) if meter_thresh > 5: volume = 75 if meter_thresh < 5: volume = 35 self.log.info(volume) self.mixer.setvolume(volume)
Any good ideas are apriciated.
My skill can be found at GitHub here https://github.com/andlo/auto-set-volume-skill
Notise: the skill is working, but needs much more love and error handling as well as settings and voicecommands. But it Does auto set volume