-
Notifications
You must be signed in to change notification settings - Fork 11
ScreamLock #33
Comments
I had responded to that issue, and I'll reiterate more in-depth here.
These are physical things on your system, or in the case of Bluetooth, devices connecting to your system. While right now I don't believe that detecting audio levels is all that important, I don't have a problem examining this when the project is in a more feature complete state. Currently, detections are done by running a program in a constant loop with a specified sleep at the end, and checking the return status of the program if it's not what the user wants. In order to implement audio level checking there would need to be a program constantly running and that's not something that is currently possible with how the project is setup. |
This would definitely be a cool feature to have, and I think it would be doable with a bit of work. |
One approach off the top of my head is to have a worker process that monitors the decibel levels (however that is done for the given platform), by sampling at regular intervals. When the main killer process wakes up and checks everything, it can query the worker for the audio history since it last checked. If the history exceeded the threashold, it then calls the normal exit routines. Another approach might be to register a callback for "kill the system" with the worker. As soon as it sees the audio level exceeded, it calls back, and the callback method handles the usual notification and shutdown. |
I labeled this "Custom Commands", as this'll be something that will be a lot easier to setup when custom commands are done. |
I believe that the following python code is able to achieve this. I have tested it and can confirm that it works on macOS and Windows. I've not had the time to test it on Linux. It is worth noting is that this will probably not work correctly if the script is sleeping. The program will not be able to capture the noise level if it's when the sleep is sleeping.
|
Shamelessly stolen from @PowerPress via github/usbkill:
Have the app monitor the decibels coming from the microphone and let the user set a threshold. If the threshold is passed shut down the PC. Example being prevented from touching your PC but by screaming or a loud noise would trigger the shutdown allowing a hands free system.
The text was updated successfully, but these errors were encountered: