Show HN: Open a browser by clapping twice (inspired by Iron Man)

1 day ago 5

Open Chrome (or any file/app) by simply clapping twice — just like Tony Stark.

🔸Open a presentation slide and chrome by clapping twice (two_claps_open.py)

demo1.mp4

🔸Activate a voice assistant agent by clapping twice (agent_on_clap.py)

demo2.mp4

To figure out what a clap "looks like" in terms of sound, I first recorded a sample clap and ran a Fourier transform on it to check the frequency content. From the analysis, most of the energy from the clap is concentrated around 1.4kHz to 1.8kHz. Based on this, I set up a bandpass filter to isolate only that range and ignore irrelevant noise. After filtering, I used peak detection to recognize when a clap happens in real time. (see figure below) Once two peaks (claps) are detected with some minimum spacing, the system launches Chrome (or any command you define).

fig

🗂️ requirements-core.txt (for two_claps_open.py)
numpy pyaudio scipy pywin32
🗂️ requirements-agent.txt (for agent_on_clap.py)
PyAudio pygame SpeechRecognition dotenv gTTS langchain langchain-core langchain-google scipy

💡 Don’t forget to set your Google API key in a .env file. Google offers a free tier for API usage.

Read Entire Article