When my daughter was very small we often used an iPad playing a 10 hour long YouTube video that was simply a repeating track of ocean sounds. Eventually I downloaded the mp3 of the sounds and set up an old android phone to play the track on a constant loop. I connected this mp3 player to an old set of computer speakers and put the whole system under my daughter’s bed. This worked great until I looked at the phone one day and the case was cracked open because the battery had doubled in size.

My first thought was to try to buy a simple mp3 player on Amazon. I haven’t tried to buy an mp3 player in about a decade but I thought I should be able to get one for under $10. Unfortunately it seems like nobody manufactures a simple enough mp3 player. It’s easy to find a $25 player with a nice LCD screen, but not a $10 knock-off equivalent of an iPod Shuffle.

Discouraged by what I didn’t find on Amazon, I decided to grab an old Raspberry Pi and see how hard it would be to turn it into a simple mp3 player that will loop one file forever. It ended up being easier than I thought and I had it done in less time than a Prime delivery.

Steps to create a Raspberry Pi white noise machine

I installed Rasberry Pi OS and configured it to my liking. I installed omxplayer which has the ability to play an mp3 on a loop.

sudo apt-get install omxplayer

I downloaded a 1-minute long mp3 of ocean sounds. I duplicated the ocean sound mp3 until I had a 30-minute long file. This was accomplished simply using the cat command to repeatedly double the length of the file:

cat ocean_sounds_1m.mp3 ocean_sounds_1m.mp3 > ocean_sounds_2m.mp3
cat ocean_sounds_2m.mp3 ocean_sounds_2m.mp3 > ocean_sounds_4m.mp3
cat ocean_sounds_16m.mp3 ocean_sounds_16m.mp3 > ocean_sounds_32m.mp3

I tested omxplayer’s looping functionality with the following command:

omxplayer --adev local --loop ocean_sounds_32m.mp3

Once that all worked, I created a systemd service to keep omxplayer running in the background. The service file is saved in /etc/systemd/system/ocean.service and looks like this:


ExecStart=/usr/bin/omxplayer -o local --loop /home/pi/ocean_sounds_32m.mp3


Then I just enabled and started the service and I was in business.

sudo systemctl daemon-reload
sudo systemctl enable ocean
sudo systemctl start ocean

Now my daughter has her white noise machine back and this one doesn’t have an explodable battery.