Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Cloud-Player/radio

Repository files navigation

Build Status JS Angular PY Tornado

cloud-player radio

by Nicolas Drebenstedt and Alexander Zarges

abstract

These days, music streaming is ubiquitous and consumers can access millions of songs and artists. But having so many choices, often leaves us undecided what to listen to. Recommendation engines try to solve this problem but tend to push people into a filter bubble. Looking back a century, broadcast radio has always provided a variety of music to listen to, curated by humans – not AI. We want to combine the unlimited choices of streaming music services with the charm of hand-picked music stations. With cloud-radio everyone can be radio host and broadcast to the world. Cloud-radio will be built on top of cloud-player, a multi-provider streaming app, and allow users to create public radio stations, which others can discover and listen to in realtime. To preserve the analogue flair of radio receivers, we want to build a portable listening device with a super simple haptic UI: A volume control and a rotary tuner to switch stations.

Imgur

project

There is a short presentation on the project in this repository called presentation.pdf.

The codebase is comprised of several parts:

  • src/cloudplayer/iokit contains generic io components and the event loop
  • src/cloudplayer/radio extends these components to implement the radio engine
  • src/web/app contains the headless angular-based player application

The radio also relies on these two other repositories:

hardware

To build a portable cloud-player radio we used the following hardware. However, with some modification, most components could easily be switched out.

wire up

Wire up the Raspberry with the components according to the fritzing schematic.

setup

  • download raspbian lite to your computer
curl -L https://downloads.raspberrypi.org/raspbian_lite_latest | tar -xf - -C ~/
  • flash raspbian onto sd card (if using a Mac, check out etcher)
  • place an empty file called ssh on the raspbian boot partion
cd /Volumes/boot
touch ssh
  • create a file named wpa_supplicant.conf and insert your wifi credentials
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
    ssid="YOUR_NETWORK_NAME"
    psk="YOUR_PASSWORD"
    key_mgmt=WPA-PSK
}
  • plug sd card into raspberry and connect power and ethernet
  • find out ip adress of raspberry, e.g. by using your router's gui
  • ssh into your pi using that ip, the user pi and the password raspberry
ssh pi@RASPBERRY_IP
  • now configure your pi
sudo raspi-config
  • change your user password to something other that the default

  • set your locale to en_US.UTF-8 (hint: use spacebar to de/select)

  • under Interfacing Options enable the SPI kernel module

  • update your raspbian software

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install \
chromium-browser \
git \
libjpeg9 \
libjpeg9-dev \
supervisor \
python-alsaaudio \
python3-pillow \
python3-pip \
python3-dev \
python3-venv
sudo usermod -a -G spi,gpio pi

configure miniamp

  • the miniamp sound driver needs to be enabled manually
  • open /boot/config.txt to remove the line
dtparam=audio=on
  • and add the line
dtoverlay=hifiberry-dac

configure alsa

cloudplayer engine

The cloudplayer engine runs an event loop to handle the raspberry io interface and communicate physical user input to the headless player and the display.

install

python3 -m venv --upgrade --copies .
bin/pip install -e .

develop

bin/radio

headless player

The cloudplayer headless player runs inside a chromium browser and handles media playback. It is hosted on a remote server to allow OTA updates.

install

cd src/web
npm install

develop

npm start

configure supervisor

  • the supervisor manages application starts on reboot
  • copy the supervisor.conf to /etc/supervisor/conf.d/cloudplayer.conf
  • and adjust the installation directories

done

  • reboot your raspberry and - after authentication - it should start playing music