24 comments

  • codazoda 1 hour ago
    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.

    • manuisin 49 minutes ago
      you could’ve been a great start of a horror movie.
  • babblingfish 40 minutes ago
    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...

    • showmypost 3 minutes ago
      I have custom molded ones. They help a lot, however high pitched sudden noises still get through and wake me up. I never managed to sleep without earplugs since moving to this city. Not considering moving due to the quality of life (apart from the noise)
    • b3ing 19 minutes ago
      I would think earwax build up would increase with that
  • nevi-me 1 hour ago
    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.

    • showmypost 5 minutes ago
      The levels I have at night indeed are unhealthy, I’m still trying to find the best way to tackle this challenge..

      Most wakeups are from noise (I can see it in the data) but high CO2 levels can also make me a lighter sleeper.

      Not sure where you’re based but in Europe the priority is mostly on heat isolation, so air movement suffers. The US is better in that regard. There was a big thread on that topic on X the other week (Peter the indie hacker initiated it and there were some good recommendations in case you’re the owner of the flat)

    • jdsnape 38 minutes ago
      I also agree co2 levels are super important, but I’m wondering: in your situation isn’t air pollution from the motorway a concern? Not sure how to balance that one
      • megous 29 minutes ago
        3k+ is well into the headache / feel really bad range

        we rarely get over 1k here

    • Eric_WVGG 40 minutes ago
      plants plants plants. Most of these are dummy easy to care for, too. https://en.wikipedia.org/wiki/NASA_Clean_Air_Study#List_of_p...
      • showmypost 13 minutes ago
        You’d need a forest in your room to see a proper change. There was a whole discussion in the Indie hacking scene on X on that topic around 1-2 weeks ago

        Big fan of plants though, help me feel calm

      • jdsnape 37 minutes ago
        Plants are nice…but, from your link:

        “These results are not applicable to typical buildings, where outdoor-to-indoor air exchange already removes volatile organic compounds (VOCs) at a rate that could only be matched by the placement of 10–1000 plants/m2 of a building's floor space.[2]

        The results also failed to replicate in future studies”

  • pizzly 1 hour ago
    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.

    • showmypost 16 minutes ago
      You definitely went for a simpler solution!

      And thanks for sharing that comment, I can second your two observations

      For multiple months, I thought I’m waking up at night because I need to go to the bathroom so often (even checked for insulin resistance but markers were perfect). Interestingly enough, most of the times (not always) there are one or multiple louder sounds just before I wake up to go to the bathroom. Zero memory or conscious perception of the noise, still woke up and feeling like I need to go to the bathroom

  • foo-bar-baz529 38 minutes ago
    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
  • phainopepla2 1 hour ago
    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.

    • showmypost 1 hour ago
      I’m actually the author of the post and doing regular breathing exercises and some additional things. Pretty sure my cortisol levels at night are (currently) not an issue. Morning walks looking up into the sky also help me a lot. Falling asleep isn’t my issue

      I grew up in the country side and unfortunately, where I live now, double glassing isn’t a thing unless you live in a recently built house.

      That doesn’t nullify what you’re saying, obviously putting worries into sleep affects the sleep itself. Still thought it was an interesting project to build as I’m anyways cautious about noise and air pollution topics :)

      • phainopepla2 42 minutes ago
        If you're regularly waking around 3 (as opposed to random times throughout the night) you might want to reconsider cortisol as a possibility, at least as setting a baseline wakefulness that allows you to be easily woken up from a noise. There is a natural cortisol spike at that time, and that combined with elevated levels from background stress causes the same problem for many people who fall asleep without issues, myself included.
        • showmypost 28 minutes ago
          The 3am part was just a random picked time. But interesting to know, thanks for sharing! I had some stress related sleeping issues about a year ago, that’s why I started with proactively provoking morning cortisol spikes and preventing them in the evenings which definitely helped. At that time I went through some personal challenges, so it made sense
        • tpolm 30 minutes ago
          Second this

          Have the same pattern, issue is cortisol/stress, not sounds / etc that happen precisely at night

          Built simular things tonwhat Op did (thoug using Oura for sleep tracking, not Garmin)

          Result: no statistically significant variations in sounds, CO2 normal etc. Cortisol is what doctors/AI told me first

  • bad_username 1 hour ago
    > 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.

    • showmypost 35 minutes ago
      Totally agree with you, that’s why I wanted to check. I btw turned off the morning report long time ago, so it’s more about me checking the sleep stages after realizing that I feel without energy. Also my sleep outside the city is much better. In the end it turns out that most times it is real and an external noise woke me up. Not always, there are false positives and sometimes you just wake up (nightmare, stress, sickness, ..)
  • kmm 1 hour ago
    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.
    • showmypost 33 minutes ago
      Yes it’s the AC keeping the temperature. I have different targets set depending on season and time of night (cooler to fall asleep, warmer in the morning). Added this data because I already have it in Home Assistant and you never know what other crazy conclusions you can get from looking at the data :D
  • dev360 1 hour ago
    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.
  • tppiotrowski 1 hour ago
    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 :)
  • amelius 1 hour ago
    I was under the impression that the pattern "I have a problem -> let's ask AI" is frowned upon here.
    • showmypost 1 hour ago
      I’m also a little surprised about it. The reason I wrote this post was to send the message: I wouldn’t have done this if it wasn’t for the AI tooling
    • nevi-me 1 hour ago
      It seems fine if you express what you did without focusing on the code.

      It resonates well with what some people have been saying about building software for 1 person.

  • lbrito 1 hour ago
    Plot twist: the existential dread of an AI-ified world where "AI" is the answer to everything was what was waking him.
  • kube-system 49 minutes ago
    What is the front end built with? It looks nice.
    • baconhigh 41 minutes ago
      Not OP - but it's Ghost:

          <meta name="generator" content="Ghost 6.19">
  • ziml77 1 hour ago
    Why use a generated image in that weird dirty yellow style when you have a real screenshot to show?
  • nekooooo 1 hour ago
    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.
    • jijji 1 hour ago
      it could also be common sense.. you live in a noisy city and you are wondering what the noise is.... maybe it could be the city itself? how about sleep in a different smaller town and then ask yourself the same question, you'll probably get a different answer.
      • kube-system 50 minutes ago
        I'm not sure if things are really that simple, at least from my personal experience. I think the quality of noise and noise floor can make a difference
  • sciencesama 1 hour ago
    long time back i had this sense orb that did something similar and it was night sounds made me wake up !
  • usernametaken29 1 hour ago
    My sleep was not good so I installed panelling and now I sleep better. There you go. Saved you 8 hours and using AI
    • bovinegambler 1 hour ago
      Can you tell me more about this panelling?
      • showmypost 1 hour ago
        They’re called “MITTZON”, made for offices. Also great room separators. I’ve tested them for a few nights and they work surprisingly well.

        Otherwise making sure the windows are properly sealed is first resort. And if you’re living with other people (partner, flatmates, family) it also helps to check the doors

  • curtisblaine 1 hour ago
    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.
    • showmypost 42 minutes ago
      Not sure I understand how this would work. The whole point is that you often don’t realize that you even woke up. And not sure jumping to go to the computer to hit a key is the smoothest way to fall back asleep

      I spend most of my days in front of CLIs but here I really think a cli wouldn’t be the right tool for the job..

  • sneak 50 minutes ago
    Earplugs also solve this problem with many fewer tokens.
  • _dain_ 1 hour ago
    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.

    • showmypost 55 minutes ago
      Thx for the feedback about the hero image. I just removed it. (you weren’t the only one pointing it out)

      The intention was to have something less detailed than the screenshot in the post.

      About the other thing: yes this would have worked for a night or so. I wanted to be able to go back and forth between nights and compare. I also had concerns about the SD-card durability and storage capacity. Still, after an hour into letting the coding agent do its thing, I was impressed by the result, so more and more ideas popped into my head

      • _dain_ 28 minutes ago
        Makes sense. Hope you get better sleep!
  • cyanydeez 1 hour ago
    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...

    • showmypost 47 minutes ago
      Good article! Not agreeing with the statement before the link

      Also, not sure if you’ve taken the time to read the post but it clearly states that I’m not using AI to analyze the data. The point of posting this was a different one

      I’m happy because I can clearly hear what wakes me up at night. I knew I wake up from noise and now I can clearly see it in the data that I wake up right after door slams, noisy motorbikes, car horning, and dishes from the kitchen (own and neighbors)

      After taking action I now sleep better and don’t have those random wake-up moments.

  • WhoffAgents 1 hour ago
    [dead]
  • Jimmy0252 1 hour ago
    [dead]
  • vzaliva 41 minutes ago
    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.