Noise generation for sleep

random trip report
My ex-wife said that my breathing (not snoring, mind you - just breathing) kept her awake at night. She refused to wear earplugs, so we looked for some kind of noise generator.

You can get clock radios and other electronic gizmos that make 'nature sounds'. These all have chirpy bird sounds and 10-second cycles; they're completely intolerable. You can also buy analog devices (basically fans) for a lot of money (~$100). These have limited control for volume and none for frequency.

Tune a radio to noise between stations? Doesn't work - they all have muting circuits these days. I thought about building an electronic noise generator, but my skills aren't good. I'm a software guy; I can make audio CDs. But a CD is only 80 minutes; you can play it on repeat but then you get 10 seconds of silence. You could get 2 CD players and offset them; kludge.

As a stop-gap measure, we started running a small fan at night. This produced noise with a lot of low frequencies, and it kept me awake. Part of my brain interpreted the low frequencies as a truck that was about to run over the tent in which I was sleeping. I had to wear earplugs (uncomfortable).

We finally came up with a good solution. My stepfather Paul bought us a cheap ($50, Target) boom box that can play MP3 files on CD-ROM. I wrote a program that generates band-limited noise, in the form of a WAV file, converted this to MP3, burned a CD-ROM, and play it every night in the boom box. Works like a charm. With the MP3 compression, a disk can hold 16+ hours.

NOTE: the boom box turned out to have a skipping problem. Instead, I'm now using a Philips portable CD player, hooked up to a pair of amplified computer speakers.

My program (the source code is here) lets you control the center frequency and width of the bandpass filter. I used a band 500 Hz wide centered at 4 KHz; this is a nice hiss that my brain ignores after a few seconds. But you can try other parameters.

The key to getting a nice long MP3 file: generate the WAV files with 8-bit samples, in mono, at a low sampling rate. I used BladeEnc for MP3 encoding, and the lowest sampling rate it accepts is 32K. With these parameters, a 16-hour WAV file is 1.8 GB (you need to stay under 2 GB since most OSs don't handle big files), and the resulting MP3 file is 450 MB, which fits nicely onto a CD-ROM.

If you want a free copy of my noise CD-ROM, just let me know.

Copyright 2024 © David P. Anderson