I let AI build a tool to help me figure out what was waking me up at night

181 points - yesterday at 9:04 PM

Source

Comments

babblingfish yesterday at 10:25 PM
Hey, OP, consider sleeping with ear plugs. They're scientifically proven to reduce night time awakenings due to audio disturbances. [1]

[1] https://academic.oup.com/sleep/advance-article/doi/10.1093/s...

pizzly yesterday at 9:56 PM
This is really cool. We did a similar thing around 2 years ago but didn't use AI in that case. Just used a phone to record a few nights sleeping. Then a python script. I manually listened for some time in order to find the threshold amplitude (where all sounds would be ignored below and tracked above). Generated a graph that should the spikes of interest. Clicked on the spikes which went to the timestamp in the audio and listened. Not super scientific I know.

Two observations. 1. Often you wake up after a loud noise but like 5 minutes later with no memory of it. 2. even if you don't wake up from the noise your breathing changes, more likely to talk in sleep and shuffle more. So even if you not waking up your quality of sleep is disrupted.

Our case had some random construction like noise in the early morning, lasted around 10 seconds and disappeared. However, we noted even ordinary sounds we didn't think was loud was effecting our sleep.

Solution for that place was earplugs and a loud fan to generate white noise.

nevi-me yesterday at 9:53 PM
That CO2 concentration looks unhealthy, I wonder to what extent it's affecting your sleep quality (as opposed to waking you up).

> Measure before you fix

In my case, I got a few IKEA CO2 sensors, and after leaving them in the bedrooms for a few days, we found that leaving an outside window slightly open + the bedroom door open, kept the CO2 levels below 600PPM at night.

We're 1000ft/300m away from a motorway, but fortunately the noise pollution isn't bad. So ventilating (even as it's getting cold) turned out to be a simple fix. I hadn't thought of collecting sleep data from our devices, but maybe I'll get an AI to do that, so I can correlate our sleep quality with the environment.

jamisteven today at 8:52 AM
All that work and you could have just bought a white noise machine on amazon for 25 bucks and been done, why?!
aucisson_masque today at 8:37 AM
Sidenote but still, I put ear plugs for 5 years already. It doesn't hurt, you don't feel anything, but it helps tremendously to stay asleep. Better than trying to fix your environment.

I even heard of people going to sleep with airpods pro in their ear.

Now that it's fixed tho my body decided I would need to pee every night about 2 hours after I went to bed... La vieillesse est un naufrage.

jmspring today at 12:58 AM
Interesting. I may need to add some sensors.

I spend time in two places. San Juan Islands WA and Santa Cruz, CA.

On island, nights are too quiet. During the day, a float plane a mile away sounds like it is next door.

In Santa Cruz, the house is on a major street. Busses, ambulances all sorts of yahoos.

I sleep better quiet. But I sleep even better when settled - mind not going, etc.

I generally don’t sleep well at all. The biggest factor is - has my brain settled. Background and noise don’t matter.

rob74 today at 8:33 AM
Each night is laid out like tracks in a music editor: one for sleep stages, one for heart rate and HRV, a few for the sensor events, and one for the noise events with the audio loaded in.

As an avid reader of aircraft accident reports (ok, more reader of blog posts and watcher of YouTube videos based on those reports - yeah, people have strange hobbies), it reminds me more of flight data recorder graphs - the first FDRs actually inscribed the graphs with needles on metal foil (https://aviation.stackexchange.com/questions/59289/was-the-f...), which is of course no longer the case, but the presentation has been kept.

dmos62 today at 6:16 AM
Environment management is important, but internal relaxation skills and similar are as important. Consider doing body scans, various visualizations, breathing exercises when going to bed: I found a 20mn guided exercise I liked (it was yoga nidra) and in a few months it transformed me from a "horrible sleeper" into someone who actually enjoys sleep.
ludwigvan today at 8:20 AM
I sometimes use SimplyNoise to have brown noise for sleeping or filter out distracting sounds in the office.

Also, iOS has background (white noise etc) sounds built-in: https://support.apple.com/en-us/109346 Android has something similar too?

We also installed triple-layered windows for sound insulation, but I believe it degraded the quality of the air, so sometimes have to open the windows for a few minutes before sleep to get fresh air.

phainopepla2 yesterday at 9:38 PM
I'm surprised that AI didn't tell him that the most likely cause of regularly waking up around 3 am is a cortisol spike. Try some breathing exercises or some other type of stress relief throughout the day, and you might sleep better.

In my case, thinking too much about the causes of bad sleep actually contributed to making sleep worse, so if this guy is anything like me then this whole project could be hurting his sleep rather than helping.

lo_fye today at 12:38 AM
You let it? It really wanted to, but you kept denying it until you finally gave in and let it?
codazoda yesterday at 9:47 PM
This reminds me of a weird story...

I went to work at a BBB office once. They turned all their computers off at night and every morning they were back on. It was just "normal" for them.

I can't even remember what problem I was troubleshooting. At the time I was working on IVR systems.

Anwayz, I was working late in their office. Everyone had turned off their computers and went home. At exactly Midnight, every computer in the office turned back on.

I walked around the office looking at desks wondering what had happened. On one persons desk was an alarm clock with a very quiet alarm buzzing. I checked the clock and it was set for midnight (probably a default). About two minutes later it turned off automatically.

I turned off computers and re-set the alarm to go off a few minutes later.

When that alarm clock went off it somehow caused either draw or feedback in the wiring that caused all the computers to turn back on. At the time I wondered if it had something to do with wake on lan.

In any case, I suggested that person take their alarm clock home.

locao today at 3:34 AM
I don't need this to know what wakes me up during the night: my wife pushes the door and THEN turns the doorknob. A simple conversation was no good. My MIL said on her experience deep conversations would not help either. At least it didn't help for 15 years.
odysseus today at 5:39 AM
Wouldn’t it be easier to just train a camera with continuous recording at your bed?

Then correlate the time you woke up in your sleep log with the camera footage.

jonhohle today at 2:08 AM
> a flash of lightning following the boom

That’s not how lightning and thunder work.

pvtmert today at 6:40 AM
I opened the article thinking that it's about the on-call scenario (paging). Something like, I got paged in the middle of the night and let the remediation/mitigation to the agent...

Which makes a lot of sense. Especially non-Tier-1 services.

  Note: Having previously worked at Amazon, certain shifts can be really busy. Busy as in 30-40 pages/incidents over the course of the shift. I sometimes wake up to a "ghost" page, although I left my position earlier this year...
lbrito yesterday at 9:45 PM
Plot twist: the existential dread of an AI-ified world where "AI" is the answer to everything was what was waking him.
amelius yesterday at 9:52 PM
I was under the impression that the pattern "I have a problem -> let's ask AI" is frowned upon here.
vaulstein today at 5:52 AM
Don't get me wrong but this seems like a first world problem which even I have experienced after my life has got easier. When I was younger, I used to live at a very noisy location and used to sleep like a baby. Also, would late workouts help to aid a better sleep? Tired body falls asleep?
ssgodderidge today at 1:05 AM
Hey OP, would love to know more about your thoughts on Garmin you reference at the bottom? Why would they be any better/worse than Coros?

> *= I do not like Garmin, I think they're a fraudulent company systematically breaching consumer rights and I'm looking for alternatives. Already converted multiple people to Coros.

tppiotrowski yesterday at 9:48 PM
Related project I did in 2014 tried to do this. I was a web developer so used the web audio APIs to trigger a recording when the decibel level exceeded a certain value. I was living in a big tent in my friends back yard in Sydney at the time and was convinced it was airplanes coming into SYD that were waking me up at 4am but never really captured conclusive evidence because my laptop battery couldn't make it through the night :)
Sxubas today at 1:58 AM
OP, I would encourage you to take a sleep test. While it seems to be correlated with sound, it sounds (pun not intended) way too similar to my OSA symptoms
dev360 yesterday at 9:34 PM
My mom would love this one :) .. she told me recently about a long-running chat gpt session that she's had for over a week, where she was going back and forth trying to figure out the source of some strange sound in the building.
blitzar today at 7:24 AM
How did they filter out the snoring and talking in their sleep?
bad_username yesterday at 9:53 PM
> I get the sleep data from my Garmin* watch. Every watch and ring calculates sleep slightly differently, and to be honest, I don't fully trust any of them on the exact sleep stage I was in at any given second.

I love my Garmin, but it's one of the worst smart watches to track sleep with. It consistently ranks poorly in tests that stack it up against pro sleep equipment, and from my experience it struggles to even detect sleep times properly. That 3:32 event that the watch said has pulled you out of deep sleep may not have been real.

nephihaha today at 9:14 AM
3am is a common time to wake up or be half awake. This is the old "witching hour" (not midnight) when most people claim to sight "ghosts" or "aliens" in their room, and/or suffer sleep paralysis.

Then there is the two sleep theory that suggests we are not supposed to sleep in single block. In more traditional environments, people got up to stoke the fire at this point. I know some folk that get up to urinate or have a drink. I used to turn the radio on for a bit.

bigfry today at 7:29 AM
What about using a white noise machine? I blast mine next to my head when I sleep, and I never wake up in the middle of the night anymore.
ElFitz today at 4:45 AM
Sounds like "observability, for sleep".

It’s funny how many things can boil down to "rich distributed traces" and events / logs.

kmm yesterday at 9:58 PM
I like the temperate graph halfway down the page. It looks like two decaying exponentials alternating every ~40 minutes, with the downward one steeper than the upward one. It's a neat visualization of hysteresis, where the thermostat presumably has a different temperature threshold for turning off or turning on (or perhaps there's a minimum time between state switches). Without the scale it's hard to know for sure.
timzaman today at 3:32 AM
You want to just start by addressing the >3000 CO2 ppm
vzaliva yesterday at 10:24 PM
We may be entering the age of "disposable software" (some people politely call it "on-demand software"). Until recently, coding was a highly specialised skill and was relatively expensive. So writing custom code for personal whimsy was a luxury only software developers could afford. Not anymore.
radar1310 today at 3:04 AM
All he had to do is buy a sound machine for $60and problem would be solved. So simple but he made overly complicated.
ajkjk today at 2:00 AM
I'm much more interested in the app and what they learned than anything to do with AI. Leave that part out, imo.
jryb today at 2:54 AM
This could easily be sleep apnea
nekooooo yesterday at 9:43 PM
what a waste of technology. you could have had a pen and graph paper hooked up to an microphone 100 years ago and looked for the spikes in the time set.
throw310822 today at 2:06 AM
The thing this guy should have done with AI is asking it: "how can I record sounds at night and check them back later?" And the AI would have told him to just download any recording app (for a kind of specific one I suggest snoreclock). End of the story.
usernametaken29 yesterday at 9:35 PM
My sleep was not good so I installed panelling and now I sleep better. There you go. Saved you 8 hours and using AI
ziml77 yesterday at 9:31 PM
Why use a generated image in that weird dirty yellow style when you have a real screenshot to show?
foo-bar-baz529 yesterday at 10:26 PM
This seems quite over engineered. They could’ve just left their phone recording overnight and done much simpler analysis on the big file. Maybe leverage LLM to write a 20-line python script, at most
kube-system yesterday at 10:15 PM
What is the front end built with? It looks nice.
sciencesama yesterday at 9:52 PM
long time back i had this sense orb that did something similar and it was night sounds made me wake up !
toss1 today at 2:31 AM
>>*= I do not like Garmin, I think they're a fraudulent company systematically breaching consumer rights and I'm looking for alternatives. Already converted multiple people to Coros.

Slightly off the main topic, but I can strongly second that recommendation for Coros gear!

No relation other than a very happy Coros user (Pace Pro). They make an excellent series of sport & health monitoring watches and bike gear, best GPS I've ever seen producing the most accurate run/bike tracks I've ever seen (using 5 GNSS systems: GPS, Galileo, QZSS, etc.), very reasonable pricing compared to the competition, continuous useful updates, and just a great overall approach to health and technology.

Ylpertnodi today at 1:47 AM
I sleep terriibly. It got 'better', when i worked out i have a 'day', of around 32-36 hours. So, to people kon a regular 24 hour day, I'm tired at the wrong times and wide awake over aboit two of their sleep cycles. Damned annoying, as I've gone out when i should have stayed in - but everyone is out and awake, and viceversa. I've learned to say 'no' to invites I know I won't make. 8 hour working days, suck. For long creative bursts, it's great, though.
gverrilla today at 2:21 AM
Have you tried sleeping without a watch?
accidentpr0ne today at 1:40 AM
Did you really need to build an ai app to figure out that doors, dishes, and motorcycles wake you up?
sneak yesterday at 10:15 PM
Earplugs also solve this problem with many fewer tokens.
curtisblaine yesterday at 10:02 PM
This is cool, but a simple circular buffer audio recorder connected to stdin would have been sufficient. The recorder records continuously on a circular buffer that stores the last 5 minutes, and whenever OP wakes up, he can press any key on the keyboard to dump the current 5 minutes on storage, with the timestamp as file name. False positives are much less possible, and the whole system can just be a small CLI program.
accidentpr0ne today at 1:39 AM
Dude used ai to determine that slamming a door, moving dishes, or driving a motorcycle near this bedroom woke him up. Revolutionary stuff.
xyst today at 3:02 AM
This person wasted an entire weekend, spent a shit ton time with LLM and contributed to CO2 emissions, water table depletion just to come to the conclusion that he needs to wear fucking ear plugs or use a white noise maker?

Anybody living in a mid to large city or urban area could have told you that. What a waste of resources.

fud101 today at 2:35 AM
This is another dumb AI project idea which i would have done at some point too if I didn't know better. It's one of those things where doctors will just go ahead with the fix even if they haven't evaluated the exact diagnosis, since the fix will probably be the same regardless. The human mind wants certainty though so I get it, but the fix doesn't need to be preceded by a pinpointing of the exact cause.
cyanydeez yesterday at 9:38 PM
hint: your watch is probably lying to you and you're following a normal bifurcated sleep pattern.

AI is melting your real world understanding: https://www.sleepfoundation.org/how-sleep-works/biphasic-sle...

Ozzie-D today at 9:59 AM
[dead]
_dain_ yesterday at 9:36 PM
This is cool don't get me wrong, but surely overcomplicated? Why not just record audio to disk the whole night then eyeball the waveform for loudness spikes? If you just don't connect it to any network at all, there's no data breach risk (or am I misunderstanding the justification for the noise-detection toggle thing?).

Also the AI-generated hero image looks vile.

hona_mind today at 6:04 AM
[flagged]
nikhilpareek13 today at 7:05 AM
[dead]
haltonlabs today at 6:04 AM
[flagged]
rexthonyy today at 7:58 AM
[flagged]
gebste today at 8:08 AM
[flagged]
WhoffAgents yesterday at 10:00 PM
[dead]
Jimmy0252 yesterday at 10:01 PM
[dead]