Okay, so today I messed around with something called “gray zone coughing.” It’s not as fancy as it sounds, trust me. Basically, it’s about trying to figure out if a cough sound is, well, a real cough or something else. Maybe it’s just someone clearing their throat, or a weird noise in the background.
The Idea
The whole thing started when I was thinking about those apps that supposedly detect sickness from your cough. I was like, “How the heck do they even know it’s a cough in the first place?” So, I got it in my head to try and build something, a very, very basic version, myself.

Getting Started (and Getting Stuck)
First, I needed some cough sounds. Easy enough, I found some free audio files online. And I also grabbed some other random sounds, like throat clearing, doors slamming, you know, the usual stuff that could trick the system.
Then came the hard part. I’m no sound engineer. I barely know what a “spectrogram” is, but I Googled it. Turns out, it’s like a visual fingerprint of a sound. So, I used some Python libraries (Librosa and some others) to turn my audio files into these spectrogram things. I spent a good chunk of time just staring at these colorful squiggly lines, trying to see any differences between the coughs and the not-coughs.
- Downloaded cough sounds and other noises.
- Learned about spectrograms.
- Used Python libraries to make them.
Trying to Make Sense of it All
My first super-genius plan was to just look at the average “brightness” of the spectrograms. You know, like, is the cough image generally brighter than, say, the door slam? Nope. That didn’t work at all. Some coughs were dim, some were bright. Total mess.
Then I tried looking at specific frequency ranges, because I read somewhere that coughs have certain characteristics in the frequency domain. I picked some ranges that seemed promising, and calculated the average energy in those areas. Still…not great. I was getting some separation, but it was far from perfect. It felt like I was groping in the dark
A Tiny Bit of Progress (Maybe?)
After a lot of trial and error (and I mean a lot), I stumbled upon something that kinda-sorta worked. I noticed that coughs often had a sharp, sudden burst of energy, followed by a quick decay. So, I wrote some code to look for that pattern – a rapid increase in energy, followed by a decrease, within a specific time window.
This…worked better. It wasn’t perfect, but it was definitely better than my previous attempts. My super-simple program could now tell the difference between a cough and, say, a door slam, with maybe 60-70% accuracy. I celebrated with the coffes.

The Takeaway
This whole “gray zone coughing” thing is way harder than I thought. I mean, I barely scratched the surface, and I already hit a wall of complexity. It showed me that even something that seems simple, like identifying a cough, can be a real challenge. Real-world audio is messy, and there’s so much variation. I can only imagine how much work goes into those professional cough-detecting apps! And My little experiment showed me just how tricky it is to work with sound.
For sure I will learn more about it, and update it here!