I have a 25 years old Technics hifi system that still works fine, and I gave it a new life by replacing the CD player and cassette player modules with a Raspberry Pi.
Each component of the hifi has a mains input and a mains plug that is used to power the next component. The element where the main power lead goes in is the radio component, which has a remote control receiver, a watch and a timer, and will power on the rest of the system when turned on by its power button, the remote control, or the alarm function.
I disconnected the cassette and cd player modules, and plugged the Raspberry Pi phone charger/power supply in the free plug behind the amplifier module, at the end of the (now very short) power lead chain.
I also connected the audio output of the Raspberry Pi to the CD input of my stereo. The advantage of CD over AUX is that the remote control buttons for switching audio sources don't cover the AUX inputs.
alsamixer I adjusted the output volume to match that of the radio
component, so that I can switch between the two without surprising jumps in
volume. I used
alsactl store to save the mixer levels.
Now when I turn the hifi on I also turn the Raspberry Pi on, and when I turn the hifi off, I also cut power from the Raspberry Pi.
Operating system install instructions:
- I downloaded a Raspbian Jessie Lite image
- I put it on an SD card
- I created an empty
sshfile on the boot partition
- I put the SD card on the Raspberry Pi and turned on the stereo.
sudo raspi-configto change the hostname, the password, and to enlarge the root partition to include all the rest of the space available in the SD card.
Music Player Daemon
This is the set up of the music player part, with mpd.
apt install mpd
The configuration file is
/etc/mpd.conf. The changes I made are:
Make mpd accessible from my local network:
Make mpd discoverable:
Allow anyone who visits me to control the playlist, and only me to run admin functions:
name "My ALSA Device"
device "hw:0,0" # optional
If at some point I'll decide to use other audio software on the system, I'll probably want to play via pulseaudio.
Sending music to the stereo
I made a little script to sync the music directory on my laptop with
rsync -avz --filter=". sync-stereo.filter" --copy-links --prune-empty-dirs --delete ./ pi@stereo:/var/lib/mpd/music
ssh pi@stereo "chmod u=rwX,go=rX -R /var/lib/mpd/music"
It uses this
sync-stereo.filter rules file for rsync:
$ mpc -h stereo status
UltraCat - Unexpected Little Happenings
[playing] #15/22 0:03/4:06 (1%)
volume: 80% repeat: off random: on single: off consume: off
On my phone I installed M.A.L.P. and now I have a remote control for mpd.
In its settings, I made a profile for home where I just had to set the hostname for the stereo and the admin password.
On my laptop I installed cantata, set the hostname and password in the preferences, and had the client ready.
Now I can take the remote control of my hi-fi, turn it on, and after a while mpd will resume playing the song that was playing when I last shut it down.
I also have realtime player status on my phone and on my laptop, and can control music from either at any time. Friends who visit me can do that as well.
Everything was rather straightforward, well documented and easy to replicate. The hardware is cheap and very easy to come by.