So, being a classical music fan as is my wife, I created a way to stream wcpe via a Raspberry Pi 24×7 in our kitchen. Check it out!
- Raspberry Pi with internet
- Small Bluetooth or other 3.5mm USB powered small speaker
To stream wcpe, a classical music station, passing the following url to any various players in Linux will work:
$ mplayer http://audio-mp3.ibiblio.org:8000/wcpe.mp3
In this project I setup streaming this mp3 url as a systemd service on the pi.
1. Create a systemd unit
Create the following file:
…with these contents:
(Note: I’m using mplayer with –prefer-ipv4 to get around odd TWC IPv6 issues I’m having.)
[Unit] Description=wcpe audio streaming service After=syslog.target [Service] Type=simple User=pi Group=pi WorkingDirectory=/home/pi ExecStart=/usr/bin/mplayer --prefer-ipv4 http://audio-mp3.ibiblio.org:8000/wcpe.mp3 Restart=always RestartSec=5 StandardOutput=syslog StandardError=syslog [Install] WantedBy=multi-user.target
2. Start the service to make sure it works ok
$ sudo systemctl start wcpe
3. Enable at startup, if desired:
$ sudo systemctl enable wcpe
Check the status to see if there are any problems:
$ sudo systemctl status wcpe ● wcpe.service - wcpe audio streaming service Loaded: loaded (/etc/systemd/system/wcpe.service; enabled) Active: active (running) since Sun 2016-05-08 08:27:07 EDT; 3h 12min ago Main PID: 30382 (mplayer) CGroup: /system.slice/wcpe.service ├─30382 /usr/bin/mplayer --prefer-ipv4 http://audio-mp3.ibiblio.org:8000/wcpe.mp3 └─30386 /usr/bin/mplayer --prefer-ipv4 http://audio-mp3.ibiblio.org:8000/wcpe.mp3
There are a ton of super inexpensive small speakers on Amazon for say, $10. Any will do which have a 3.5mm jack or alternatively, bluetooth with a Raspberry Pi 3 (which has bluetooth). It is also probably a possibility to power the speaker via usb off the Pi, depending on the speaker.
The particular speaker I have in use has an off/on switch to turn off/on the stream.
This could be modified for any audio stream as desired. Cheers,