6

How to play entrance music on your Raspberry Pi

 2 years ago
source link: https://www.raspberrypi.org/blog/how-to-play-entrance-music-on-your-raspberry-pi/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to play entrance music on your Raspberry Pi

Imagine walking through a doorway, and your entrance music begins playing. You’re a pro wrestler, or perhaps a character in a 1940’s hardboiled crime drama? Or the Queen, who no doubt gets to hear the national anthem on a regular basis.

Ty and Gig Builds have a tonne of cool Raspberry Pi projects on their YouTube channel, but we especially liked this one. Why? Because it’s the perfect device to welcome everyone to Raspberry Pi Towers each day. At least, once the time comes to leave our home offices and head back to Pi Towers.

Check out Ty and Gig’s build video

How does it work?

A Python script running on a Raspberry Pi continuously searches for nearby Bluetooth devices in a ‘known’ list. It uses the Bluetooth MAC address of each detected phone in range to determine which entrance music its owner wants. All ‘known’ device owners have already nominated a chosen track, which is stored on the Raspberry Pi, and when it recognises one from its list, the Raspberry Pi plays the owner’s chosen audio file.

Watch Ty and Gig make an entrance to their own songs

Raspberry Pi uses the Bluez stack to communicate over Bluetooth, it’s this service that lets the Raspberry Pi talk to your phone. Ty admits this was the fiddliest part of the build, but he explains it all very clearly, step-by-step, from this point in the video. A sound card, connected via USB, lets Raspberry Pi output audio through a big speaker. But you could also make the sound play through an HDMI TV.

Build your own

entrance music loopIt’s all made clear in the build video

Wanna walk into the house with your own entrance music playing? Here’s the github repo with everything you’ll need. A Raspberry Pi 4 powers this project, but any of our boards with Bluetooth support would work.

You’re also going to need a separate sound card and here’s the one used in this build.

What would your entrance music be?

Some suggestions from the soon-to-return to Raspberry Pi Towers team:

Rob from The MagPi magazine would pick Homer’s entrance music in this

  • Back in Black, AC/DC
  • Here You Come Again, Dolly Parton
  • Paint It, Black, The Rolling Stones
  • The Imperial March, John Williams
  • Tiptoe Through the Tulips, Tiny Tim (yes, someone really picked this)

Comment with your entrance tune of choice.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK