
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
This project implements a clap detection system using an a mic or raw audio data as input. It can detect clap patterns including single and double claps.
portaudio19
using sudo apt install portaudio19-dev
, then install clap-detector normally using pip install clap-detector
.sudo apt install python3-pyaudio
, then install clap-detector normally pip install clap-detector
.ClapDetector
constructor.pip install clap-detector
Install the required Python packages:
pip install pyaudio numpy scipy
Clone the repository:
git clone https://github.com/TzurSoffer/clapDetection/
cd clapDetection/src/clapDetector
Run the clap detection script:
python clapDetector.py
ClapDetector
class constructor to fine-tune the clap detection system.clone the repository, if you have not already using git clone https://github.com/TzurSoffer/clapDetection/
go into the examples folder and choose one of the scripts you would like to run.
Create a script that uses this library
import time
from clapDetector import ClapDetector, printDeviceInfo
print("""
--------------------------------
The application initially attempts to use the system's default audio device. If this doesn't work or if you prefer to use a different device, you can change it. Below are the available audio devices. Find the one you are using and change the 'inputDevice' variable to the name or index of your preferred audio device. Then, restart the program, and it should properly capture audio.
--------------------------------
""")
printDeviceInfo()
thresholdBias = 6000
lowcut=200 #< increase this to make claps detection more strict
highcut=3200 #< decrease this to make claps detection more strict
clapDetector = ClapDetector(inputDevice=-1, logLevel=10)
clapDetector.initAudio()
try:
while True:
audioData = clapDetector.getAudio()
result = clapDetector.run(thresholdBias=thresholdBias, lowcut=lowcut, highcut=highcut, audioData=audioData)
resultLength = len(result)
if resultLength == 2:
print(f"Double clap detected! bias {thresholdBias}, lowcut {lowcut}, and highcut {highcut}")
clapDetector.saveAudio(folder="./")
time.sleep(1/60)
except KeyboardInterrupt:
print("Exited gracefully")
except Exception as e:
print(f"error: {e}")
finally:
clapDetector.stop()
The system will continuously monitor audio input and detect claps.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A clap detector that can detect claps in patterns of single, double, etc.
We found that clap-detector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.