DEV Community

darkmage
darkmage

Posted on

Instant Whitenoise

I sleep with whitenoise every night.

There's a lot of great whitenoise audio on Youtube.

Don't wanna waste bandwidth, right?

Use youtube-dl to download just the audio!

  1. Install youtube-dl.
pip3 install youtube-dl
  1. Use youtube-dl to download just the .m4a audio file.
youtube-dl --no-check-certificate --add-metadata -ic -f 140 1KaOrSuWZeM
  1. Use ffplay from ffmpeg to play the file!
ffplay whitenoise.m4a

I was about to check if brew has mplayer available...looks like it is!

libcaca is a requirement...I haven't played with that in many years! Glad to see it is still around.

Watching mplayer install right now...ffplay seemed slow to start, but then again I had literally never even heard of the program until 5 minutes ago, let alone used it.

mplayer started quickly...huzzah!

Now I can go to sleep and post this blog/write-up thingy in the morning!

Though, as I am about to do the footer, I had an idea...

What about doing the whole white-noise generation in Python, and 'printing' out the audio, rather, playing it live! What about that?

First quick google yields this:

SIMPLE WHITE NOISE GENERATOR USING STANDARD PYTHON IN LINUX. (PYTHON RECIPE)

The code doesn't work on my machine, as I have no /dev/dsp, but it is the right idea...open some audio device and generate a random wave or signal to play. That is basically what "white noise" is...static, or just a bunch of chaos manifested in audio-form.

I've long suffered with insomnia. If I had it my way, I'd either never sleep, or I'd sleep all the time. The whole shut-down and start-up process is REALLY annoying, and I'd rather do without either. Like, right now, it is almost 4am...I have like 4-students later today, and am only going to get about 5-hours of sleep. First-world problems, right? Thing is, I spend like an hour of my morning decongesting sinus fluid and spinning my brain up because of my inability to magically leap out of bed and into action like "normal" people do.

I also struggle to put myself down. I take melatonin to combat caffeine consumption and I've used flux for years as well.

Realistically, I need 36-hour days, where I am asleep for 12, and awake for 24.

I've always wanted to experiment with my own calendar system. It is times like now where I can realistically accomplish the most, and yet it is also the time where I should be sleeping.

36-hour days would afford me 4 "days" in a "7-24hr-day" week.

A lot of this thought-process is the result of bottleneck analysis in my own processes.

I enjoy sleeping, and resting in general...but, it does take time, time that I could be spent doing good work, building things, and sharpening my skills.

I enjoy writing, blogging, coding, creating, and tearing things apart...it all takes time...

I enjoy my students, but the money...well, that is a rant for another blog and vlog that I will also do soon.

This is the beginning of some greater things on the way.

I know I'm tired lol. This started off as a simple piece on how to get your own white noise going and conserve on your bandwidth, and ended up being a rant about the state of my life and the direction that I want it to head in.

This feeling that I have now...this time of night...

I miss it.

This is really "me" and "where I am at".

Here is to manifesting dreams into reality! Cheers, and pleasant dreams, fellow coders.


If you need a Computer Science tutor, code reviewer, or just someone to pair program with, hit me up

Top comments (2)

Collapse
 
michaeltharrington profile image
Michael Tharrington • Edited

Hey @steve_chance, you might dig this - mynoise.net/NoiseMachines/rainNois... I sleep using this noisemaker almost every night.

And thanks @therealdarkmage I'm bookmarking this for later. I really want to build myself a white noise machine in Python at some point... or at least borrow sounds from somebody else's and loop it! :-)

Collapse
 
therealdarkmage profile image
darkmage

Tinnitus for me comes and goes but is definitely a contributing factor to the insomnia. Whitenoise sounds a bit like rain to me when my head is beneath a pillow