bquinlan: (Default)
[personal profile] bquinlan
I like having some sort of masking sounds to cover background noise when I sleep. White noise is the classic answer, but I prefer repetitive natural sounds like rain or a bubbling brook. There are plenty of devices made for this specific purpose, but I've found them to be mediocre, at best, and badly overpriced. So when my last one broke I decided to replace it with a better, and less expensive, solution.

I bought an inexpensive digital music player, replaced the firmware with free open source software, purchased a "nature sound" MP3 track, and edited it into a loop using more free open source software. Total cost was around $30, plus an hour of my time to replace the firmware and edit the track. No real technical expertise was required.

Researching how to make this work did take a bit more time, but even that wasn't more than a few hours. I found out that there are two barriers to just putting an appropriate MP3 on "repeat" and going to sleep.

  1. Very few digital music players can play a gapless loop. There is a pause at the end of the track where all sound stops before it starts again.

  2. Unmodified digital music tracks will produce a loud "pop" if they are played as a gapless loop. The "pop" is not something you would be likely to sleep through.

Getting a Gapless Player

The first problem can be solved by purchasing one of the few gapless players, but they tend to be expensive. Also, I found out that not all of the players that advertise themselves as gapless really are.

A less expensive solution is to buy one of the many low- to mid-level players that is supported by the free open source RockBox firmware. There is a list of supported devices on the site, along with detailed instructions for how to install RockBox on each type of player. The process is simple and quick.

RockBox provides gapless looping. If you use this device for anything other than sleeping you may come to appreciate the host of other features that RockBox offers as well. There are full RockBox user manuals, tailored to each specific supported device, on the site.

I bought a SanDisk Sansa Clip player on sale locally for $25. Installing the RockBox firmware on it took about fifteen minutes.

Looping a Track

The second problem of looping a track, starts with finding a track that you want to listen to while falling asleep. I searched for MP3 tracks on Amazon using keywords like "nature sounds sleep". There are plenty of high-quality tracks of this kind available.

I settled on "Mountain Stream" as recorded by Joe Baker from his Sounds of Nature series. It runs for more than an hour, so repeated looping is not going to be perceptible to anyone without a photographic (or phonographic) memory. "Mountain Stream" cost me $0.99.

To loop the track I needed some kind of audio editing software. A friend who does sound engineering recommended a free open source package called Audacity. It is available for Windows, Mac OS, and Linux. I downloaded and installed Audacity on my system. While it is capable of doing a whole lot more than I needed, it was still fairly simple to use.

Now for a few bits of technical stuff.

The structure of the MP3 file format makes it very difficult to create loops. It is much simpler to convert an MP3 into another format that does not have the same problems. The Ogg Vorbis format does not and it is widely supported among digital players. So the first thing I did with Audacity was to convert "Mountain Stream" from MP3 to Ogg Vorbis. I just loaded the MP3 file, selected "Export", and specified Ogg Vorbis. Then I loaded up the new file I had exported for editing.

Most audio files contain stereo sound. Audacity showed me the waveforms of the two tracks as they cycled up and down across their center lines. To create a loop that does not "pop" I needed to edit both tracks so that they began and ended on the center line.

I listened to the beginning of the track to get past any fading in affects, since I wanted the volume to be relatively constant throughout the loop. Once there, I scanned forward until I found a place where both waveforms came near to crossing their center lines at the same time. I used my mouse to pull them the rest of the way to their center lines. Then I deleted everything before that point.

UPDATE: I discovered there is a simpler way to handle the issue above. If you click on a waveform and hit the "Z" key Audacity will automatically find the nearest "zero crossing" for you.

With the beginning looped, I skipped to near the end and repeated the process. I found my end point before the fade out, centered both waveforms, and deleted everything after that point. That gave me an audio loop that would not make any inappropriate noise when it repeated.

Figuring out how to use Audacity to do all this probably took me half an hour. Liberal use of the "help" functions kept it from being too painful. And once I figured out how to loop "Mountain Stream" I was able to loop a few other tracks very quickly.


The final piece of this solution is speakers. I have a nice stereo in my bedroom for listening to music from my phone, so I just used that. Otherwise, the clock/radio on my nightstand has an audio input that would work reasonably well. If you can't use either of those options, you can always buy an inexpensive set of digital player speakers.


At this point I loaded my edited version of "Mountain Stream" onto the Sansa Clip, hooked it up to some speakers, set it to repeat, and hit "Play". Happiness!

The results were far better than any of the "sound machine" devices I've tried. Most of them produce sound quality far inferior to even a low-end digital player. Worse yet, most of them use very short loops, often less than fifteen seconds. That becomes painfully distracting after I've listened for a few minutes and actually keeps me awake.

My new Clip-based setup produces excellent sound quality. The tracks I have purchased all run fifteen minutes or longer, mostly much longer, which eliminates any awareness that they are loops. And having learned how to do the editing, I can turn any track I want into a loop in just a few minutes. All for around half the price of a mid-level "sound machine" and closer to 10% of what the high-end versions sell for.

As an added bonus, the same device and setup that let me play my sleep loops will also play anything else I want. I can load the player up with regular music for when I don't want to sleep.

Date: 2011-04-24 08:30 pm (UTC)
dragonfly: stained glass dragonfly in iridescent colors (Default)
From: [personal profile] dragonfly
You've forged some important paths for the rest of us to follow, here! I remember when you first told me about this.
Page generated Apr. 22nd, 2019 12:59 pm
Powered by Dreamwidth Studios