Adding streaming internet radio to an old cabinet radio/phono/eight-track
So this came home with us.

It’s a 1970’s phonograph, AM/FM radio, and eight track tape player. The tape player can record eight-track tapes.
Well, in theory it can. In practice, the radio worked, the phono sounded terrible, and the tape player didn’t work at all.
A new needle fixed the phono. Awesome. Three out of four functions. But the eight-track was in awful shape. It doesn’t switch tracks, it doesn’t play. The capstan is entirely missing the rubber friction drive that moves the tape.
So I did what any good geek would do: I operated and spliced in a Beaglebone, so it plays streaming internet radio.
First hurdle. It’s cold, and my basement, where the only ethernet cable lives, is really cold. I’m also lazy. So I used a cat5 cable from the beaglebone to my laptop, set up port forwarding on my laptop, and then I could ssh into the beaglebone via the usb cable, and do software upgrades via apt-get through the cat5 and then across the wireless network.
On bbb:
ifconfig eth0 192.168.7.2
ifconfig add default gw 192.168.7.1
On laptop, start with an ifconfig and look at the output. There should be two eth[x] entries, one of which will include the 192.168.7.2 entry. That’s actually the usb. So you want to configure the other one, which is the hardware associated with the port where the cat5 cable lives. For this example I’m presuming it’s eth1, and your wireless connection is wlan0.
sudo ifconfig eth1 192.168.7.1
sudo iptables –table nat –append POSTROUTING –out-interface eth1 -j MASQUERADE
sudo iptables –append FORWARD –in-interface wlan0 -j ACCEPT
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
If you’re using xubuntu (or apparently a few other distros) that last line won’t work because for whatever reason ‘>’ doesn’t inherit sudo permissions. So you have to punt:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
Now you can start work on the bbb.
apt-get update
apt-get upgrade
apt-get install alsa-base alsa-utils
Mine already had all the alsa stuff installed. A bunch of programs didn’t successfully upgrade, like apache and dbus, which I need to look into later, but I don’t actually use any of those for this project so I don’t care. [note 1]
Second hurdle: setting up audio. The Mad Scientist Hut.
I’m using a USB soundcard. This requires disabling HDMI, which I’m not using at all, so the soundcard can manage the sound.
Then go to /etc/modprobe.d/alsa-base.conf and edit it to change the index on snd-usb-audio from -2 to 0.
Reboot the bbb with your usb soundcard plugged in.
For me, this resulted in being able to play music. I needed some music to play and a player.
apt-get install mpg321
wget http://www.noiseaddicts.com/samples/145
(you might want to change your working directory to /home/debian before doing that, rather than sticking an mp3 in /etc/modprobe.d)
and then you can mpg321 1456.mp3 and hear some noise.
mpg321 will also accept url’s, so:
mpg321 http://ice.somafm.com/indiepop
I used a Syba usb soundcard. It works beautifully.
[note 1]
For some reason, on current beaglebones led_aging.sh is a screwed-up file, and prevents apt-get update from working correctly on half a dozen packages.
From here: https://groups.google.com/forum/#!t
do this:
Replace the existing /etc/init.d/led_aging.sh script with:
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: led_aging.sh
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start LED aging
# Description: Starts LED aging (whatever that is)
### END INIT INFO
x=$(/bin/ps -ef | /bin/grep “[l]ed_acc”)
if [ ! -n “$x” -a -x /usr/bin/led_acc ]; then
/usr/bin/led_acc &
fi
So for this example, blinker.service
It should look like this:
[Unit]
Description=blinker
ConditionPathExists=|/home/debian/progra
[Service]
ExecStart=/home/debian/programming/pytho
SyslogIdentifier=blinker
Restart=always
[Install]
WantedBy=multi-user.target
Then go to /etc/systemd/system/multi-user.target.wa
ln -s /lib/systemd/system/blinker.service /etc/systemd/system/multi-user.target.wa
The file itself, if it’s python, must begin with #!/usr/bin/python (or wherever you have python installed) and be executable.
Then, systemctl –system daemon-reload
and systemctl start blinker.service
and your program should start immediately and also start every time you boot the beaglebone.
If your program is dependent on other services before it starts, you can add those under the [unit] group, like:
ConditionPathExists=|/home/debian/progra
After=network.target
That way it will wait until the network is up before running — which, in the case of what I’m building, is nice, because it’s streaming internet radio.
https://www.youtube.com/watch?v=A1WFRC_