Content of the material
IntroductionA lot of people have older and probably still great, high-quality audio systems that no longer get used, simply because they’re inconvenient. We’ve decided to address that with this very simple project we're calling balenaSound. We will show you how to build your own audio receiver which connects to the auxiliary(AUX) input of any audio device to give it modern streaming functionality. You’ll then be able to stream music to your audio setup from your phone, tablet, or laptop using Bluetooth, Airplay, or Spotify Connect.All you need is a Raspberry Pi and a little bit of time. We’ve done all the hard work by configuring Bluetooth & the other services, and setting everything up in a repeatable format to get you up and running with minimal effort. It’s the perfect introduction if you’ve never tried a project like this before.We’re going to guide you through setting up the Raspberry Pi, deploying the balenaSound project code onto it and then show you how to connect your audio system and get started with streaming.
Multi-roomSince version 2.0, balenaSound supports multiple, synchronized devices allowing you to build your own DIY Sonos or custom multi-room audio system. If you’ve only got one device, that still works great and as it did before. Now, you can simply flash another SD card with the same image and that device will play the same audio as your first device completely seamlessly.As long as your devices are connected to the same WiFi network, they will automatically discover each other and synchronize audio output.
Log Messages and Custom Tags
The CastDebugLogger API allows you to create log messages that appear on the receiver debug overlay with different colors. The following log methods are available, listed in order from highest to lowest priority:
For each log method, the first parameter is a custom tag. This can be any identifying string that you find meaningful. The
CastDebugLogger uses tags to filter the logs. Usage of tags is explained in detail further below. The second parameter is the log message.
To show logs in action, add logs to your
You can control which messages appear on the debug overlay by setting the log level in
loggerLevelByTags for each custom tag. For example, enabling a custom tag with log level
BUG will display all messages added with error, warn, info, and debug log messages. Enabling a custom tag with
WARNING level will only display error and warn log messages.
loggerLevelByTags config is optional. If a custom tag is not configured for its logger level, all log messages will display on the debug overlay.
Add the following code below the
CORE event logger:
Add the following code to
index.html in the header:
Add the following code to
<body> before the <
receiver.js, to provide the receiver SDK with space to bring-up the default receiver UI which is shipping with the script you have just added.
Now, we need to initialize the SDK in
js/receiver.js, consisting of:
- acquiring a reference to
CastReceiverContext, your primary entry point to the whole Receiver SDK
- storing a reference to the
PlayerManager, the object handling playback and providing you with all the hooks you need to plug-in your own custom logic
- initializing the SDK by calling
Add the following to
Connect your speakersMost Hi-Fi systems and powered speakers will include an auxiliary (AUX) input for connecting things such as your newly-created balenaSound device. To do this you’ll need to ensure you have the right cables. The audio output on the Raspberry Pi (and the PHAT DAC) is a 3.5mm stereo audio jack, and most AUX inputs are going to be either the same or perhaps more commonly a phono/RCA input, which are the individual red and white connectors. Therefore you’re going to need a cable to work with your setup. The AmazonBasics range is a good place to start looking, the cables are good quality without costing too much.
- Yogesh Tiwari on MBIST verification: Best practices & challenges
- John Dunn on Autotransformers – Part 2
- rastrahouse on Location-tracking services: Hits to accompany the misses
- Brian park on Autotransformers – Part 2
- Peter Evans on Goodbye to analog LDOs?