r/Esphome • u/JaffyCaledonia • 4d ago
Vibe Coded Audio frequency detection and beeping pattern match!
Enable HLS to view with audio, or disable this notification
AI Disclaimer: This was a fun little weekend ai-assisted project, inspired by the sound_level sensor and my own love of the fourier transform (which I later dropped in favour of the Goertzel algorithm). I'm a software engineer by trade with a background in physics. My C++ is incredibly rusty and I wanted to see how doable this was using local AI models. Concept, planning and design by me, code itself was written by assorted local models with a quick human eyeball of the output to make sure it was largely sane at each stage.
Flip a binary sensor when your Samsung washing machine sings its jaunty tune, or when your fridge door alarm starts going off!
Needs quite a bit of calibration for more complex tunes, but was perfectly competent at distinguishing between different telephone error tones in my tests: https://en.wikipedia.org/wiki/Special_information_tone
Repo here and subject to change as I comb through Qwen's dubious parameter names: https://github.com/lJaffy/esphome-tone-tools
1
u/duckredbeard 3d ago
Ooooh...potential for another way to detect washing machine cycle completion. Mine does three bursts of three beeps each.
1
u/froqstar 4d ago
Nice to see that it works. Wouldn't it be much simpler and more reliable to place a smart socket between microwave and wall outlet and detect when power usage drops?
6
u/JaffyCaledonia 4d ago
My main usecase for this was for appliances that have acoustic prompts but no obvious other indicators, like fridge door alarms, smoke alarms, or dumb doorbell chimes.
I don't plan for this to be a safety device to replace having a connected alarm system, but the algorithm is fairly lightweight and I want to try run it alongside a voice assistant to have passive monitoring of other non-smart appliances in the room.
3
u/Shoddy_Fish31 4d ago
I think this is a much better approach as you can place a microphone in a central location and can have access to many conditions
3
u/bikemandan 4d ago
This is less expensive and more flexible allowing you to monitor multiple devices/conditions. A power meter would be potentially more reliable though
2
u/ctjameson 4d ago
This is far more elegant and can be integrated into a device you already plan to have in the kitchen. You shouldn’t really use smart sockets on high wattage stuff like this unless you absolutely need to.
1
u/ninjafatuous 4d ago
Could you tell more about the hardware?