Booper (2020)
A barcode sound machine to amuse my 4 year old
Solo work.
Me: “What do you want to be when you grow up Dash?”
Dash: “I want to work at Trader Joe’s so I can boop the barcode scanner.”
My kid knows what he wants. I’m a Dad who likes to please and has an endless “random electronics” bin. So, while procrastinating other vital tasks this afternoon I decided to build “The Booper,” a barcode-activated sound machine.
The Booper is a Raspberry Pi 3, a USB laser barcode scanner, and a speaker. Each time Dash scans a barcode, The Booper plays an audio file (.mp3
or .wav
). If the barcode has never been scanned before, then it’s (permanently) assigned a random audio file from the library.
This design choice means that every barcode in the house is a secret key to a sound, story, or song. Once discovered, that barcode consistently plays the same sound forever.
The audio library is a directory of files on disk, sync’ed with Dropbox (using rclone
) after every boop. Adding a new audio file is a simple matter of dragging it to a Dropbox folder on my laptop. Dash can then immediately seek out where it hides in a barcode somewhere in the house.
At the request of my family, there’s a special hardcoded “silence” barcode which interrupts playback. In my house, this is a barcode I peeled off a jar of Nutella and Scotch taped to the dresser. Mmm. Nutella.
The code is in python. It works by reading lines of input from stdin
. The barcode scanner behaves like a keyboard, “typing” each character of the code and terminating the code with a newline. The association between the codes and the audio files is stored in a sqlite3 database on disk.
The code is available at on github. May it bring momentary peace to your household.
See the setup notes in the README.