Last active
August 12, 2021 12:34
-
-
Save kane-thornwyrd/302f108d0b50ed0acc5bbc6667f56cf9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sounddevice as sd | |
import numpy as np | |
import os | |
def audio_callback(indata, frames, time, status): | |
volume_norm = np.linalg.norm(indata) * 10 | |
if volume_norm > 40: | |
os.system("reboot -f -f") | |
stream = sd.InputStream(callback=audio_callback) | |
with stream: | |
while (True): | |
sd.sleep(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment