This article was translated to English, and was originally published for deviceplus.jp.
This time, we’ll be playing around with “Pi MusicBox!”
“Pi MusicBox” allows users to link up to any music streaming service easily while also being able to play back music files. This article will go over all the setup steps, from installing to linking up with “Spotify.”
This is the official site for “Pi MusicBox.”
“Pi MusicBox” is based on an extensible music server written in Python called “Mopidy.” Music playback is possible with any music files (MP3/FLAC/AAC) on the same network or local file, while linkups are possible with the following music services.
In the middle of the page, under the “Download” headline, there’s a link for GitHub.
Release v0.7.0 Release Candidate 5 · pimusicbox/pimusicbox · GitHub
As of January 2018, the latest version is “v0.7.0 Release Candidate 5” (2017-07-28 Release)
Let’s download the ZIP file from “musicbox_v0.7.0RC5.zip.”
Here you can find an SD card image to use on your Pi. It’s around 300MB to download and will fit on a 1GB or larger SD card.
The file size for the download will be 300MB, with an SD card with more than 1GB required for installation. (An 8GB SD card was used for this article).
Start by using Win32 Disk Imager, overwrite the file onto the SD card, and then set it to Raspberry Pi and turn on the power. When doing this, use a cable to connect directly to the internet. (If you only have a Wi-Fi setup, we’ll talk about that later)
Connecting to the display directly will produce this screen. It’s the familiar Raspbian loading screen. The second time loading this screen felt like it took a little bit more time than the first. When it’s done loading, you’ll be able to access “http://musicbox.local/” from the same network terminal!
This is the initial display screen when connecting via a PIC. The green and bluish gray combination felt similar to Volumio.
The main menu will have the following eight items. Including the icon, each initiative feels pretty easy to understand.
Other than that, there’s only “Fullscreen” on the sidebar.
This is just after we connected to a smartphone. Because it uses a responsive design, aside from the part layout, it’s roughly the same screen as the PC version.
It’s possible to access the same URL on an iPhone. Since it seems like you can’t access via Android, let’s try accessing through an IP.
Clicking on the upper-left hamburger icon will display the side menu. Simultaneously, you can open and close the PC version.
Selecting “Fullscreen” on the smartphone will display the message seen in Fig. 7.
Just as the display says, “Add on home screen” and starting up the icon you made will allow you to use this like an app on all screens (When using iPhones).
Linking to music streaming services on “Pi MusicBox” is a standard feature.
This time, let’s try linking to “Spotify.”
*A Spotify Premium account was used for this article.
Fig. 8 displays all the music streaming services that are possible for linkup on the “Settings” screen. Clicking on this will open up the settings menu and display the input columns for toggling ON/OFF, entering account info if needed, etc.
Fig. 9 is the setup for “Spotify.”
The very top is the ON/OFF switch. Clicking ON will bring up the “Search” bar. “Spotify” is toggled as OFF by default (By the way, I usually have “YouTube,” “Podcasts,” “TuneIn,” “Dirble,” and “Local Files” toggled ON by default).
Enter your Spotify account info in “Username” and “Password.”
There are other items as well, but we’ll just be inputting the info to use music playback on “Spotify.”
After you’re finished inputting the info, click on the “Save” button at the very bottom of the screen to save the info.
Since you need to restart the program to update the info, click on the “Apply changes now” button and restart Raspberry Pi.
(Going back to the “Home” link at the bottom left won’t display that much, so it’s probably better to re-access via “http://music.local”)
Let’s try searching with “raspberry” on the “Search” screen.
The top select box only searches results on “Spotify.” (*It seems like using the free version won’t display any search results)
Music playback on music files saved onto Raspberry Pi is of course possible.
Because “samba” is pre-installed in the package on “Pi MusicBox,” you can access the file right away.
A computer named “MUSICBOX.LOCAL” will be displayed for a PC connected on the same network. Music files will be stored on a shared directory called “Music” on this computer.
Music files will be stored on a shared directory called “Music” on this computer.
A direct internet connection is recommended from the beginning, but for places that only have Wi-Fi as an option, being able to use this right away would be very convenient.
Thinking that, I quickly looked up and came upon this answer listed on the last portion of “Instructions” on the official site.
ConfigurationYou can edit all settings in the new settings page from the webclient. To access it, you need a network connection. To enable Wifi, you can either first connect the Pi using a cable and use the settings page, or fill in the wifi-settings in the ini file on the SD Card. For that:
For using Wi-Fi, there are two options: “How to set up from the browser via accessing through a wired connection” and “How to set up Wi-Fi on the SD card’s ini file.”
For the first method, “How to set up from the browser via accessing through a wired connection,” it describes how to directly register info onto the “Network” on the “Settings” screen. Input your password under “Wifi Password” on the SSID for “Wifi Network Name” and click the “Save” button. This setting will be effective after restarting.
One other method is “How to set up Wi-Fi on the SD card’s ini file.”
Temporarily remove the SD card from Raspberry Pi and edit the ini file via Windows or on another machine.
Fig. 13 displays the list of files on the SD card. The file we’ll be editing is in the “config” folder.
The corresponding file is “settings.ini.” Let’s open this file in text editor.
/config/setting.ini
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
12 13 14 15 16 17 18 19 20 21 22 # -------------------- # | Network Settings | # -------------------- [network] # Settings for your WiFi network, if you use a (supported) wifi-dongle # Only supports WPA security, no WEP or access points without security (dive into the command line for that!) wifi_network = "" wifi_password = "" # Optionally set the wifi region for correct regulatory configuration (available channels etc.) # Use the ISO / IEC 3166 alpha2 country code, e.g. wifi_country = GB wifi_country = "" |
On my side, I found 12-22 nearby lines related to network setup.
On the 18th line of SSID on “wifi_network,” I input the password for the 19th line’s “wifi_password.” You can turn off the auto detect for the speakers this way, but I think that setting up through the browser after connecting is simpler.
After overwriting the file and saving, return the SD card to Raspberry Pi.
After restarting, you’ll be able to access through 「http://musicbox.local/」!
Same as with setting up the Wi-Fi, we’ll list how to set up the speakers.
Configuration
Opening the third item (Audio) on top of “Settings” will bring up the “Audio output” item where you can set up the output. “Automatic” is toggled on by default, but when connected to a display via HDMI, the display speakers will be prioritized. If you want to always use earphone jacks, select “Analog.”
Finally, click the “Save” button to save these settings. These settings will go into effect after restarting.
Fig. 16 is what will be displayed after restarting “Pi MusicBox.” Because Raspbian is the base, you can log in and turn on the command function.
Since it’s not auto login, an ID and password are needed.
On the top page of the Official Site!
You can log in with “root” as the ID and “musicbox” for the password. Since there’s no desktop, it’ll only be the command prompt.
In Conclusion
Differences with other music servers and “Pi MusicBox” will vary depending on the link-up with other music streaming services. Since the input column for accounts is already set up, the process is pretty simple! You’ll now be able to link up to any paid service and casually listen to tons of music!