Home automation isn’t all that new. It is just more evolved. Many years ago, a TV product appeared called the Clapper. If you haven’t heard of it, it was basically a sound-operated AC switch. You plug, say, a lamp into the device and the clapper into the wall and you can then turn the lamp on or off by clapping. If you somehow missed these — and you can still get them, apparently — have a look at the 1984 commercial in the video below. [Ash] decided to forego ordering one on Amazon and instead built her own using a Raspberry Pi.
[Ash’s] prototype uses an LED and could — in theory — drive anything. If you wanted to make a real Clapper replacement you’d need a relay or some other kind of AC switch suitable for the load. The actual clap detection software is from [nikhiljohn10] and simply waits for two loud noises. No fancy machine learning to differentiate between a clap and a cat knocking over a vase. Just a threshold and some timing.
Many of the projects we see which pulse lights to music use the MSGEQ7 chip to perform hardware processing on the audio signal. But since [Zolmeister] is using a computer to play his tunes he took a different route. His Linux box uses PulseAudio to handle sound. This allows him to record from the audio playback which provides an internal source for the pyAudio package. His Python script saves snippets of the streaming audio to .wav files. I then normalizes the volume level and uses the amplitude to set a PWM value before deleting the sample and moving onto the next. These values are pushed to the Arduino at 115200 baud to achieve the results seen in the video after the break.
The fine folks at Midnight Research Labs have put together a new toy for you to play with. It’s a Python script that makes your WiFi hardware behave more like a theremin. Based on the pyaudio library it monitors the signal strength of the AP you’re connected to and changes the tone accordingly. There’s a sample embedded above (direct link). If you have a second interface, you can use it to modulate the volume. It’s an interesting trick, but they say that there’s enough latency that it would be hard to play actual music with it.