Stream audio from an analog turntable to Sonos speakers using a RaspberryPi

I recently got an old turntable and some records for free. Since I only have two Sonos speakers without analog inputs in my apartment, I needed a simple and cheap way of streaming the audio from the player to my speakers

Parts List

  • RaspberryPi 3
  • Behringer U-Control UFO202 USB Audio Interface
  • Stereo cinch cable


Install Icecast2

sudo apt update
sudo apt install icecast2
sudo nano /etc/icecast2/icecast.xml


<hostname>localhost</hostname> to your IP address, for example

Start and enable the icecast2 service

sudo systemctl start icecast2
sudo systemctl enable icecast2

You should now be able to access the icecast2 web UI at

Install Darkice

sudo apt install darkice
sudo nano /etc/darkice.cfg

Paste the following basic configuration:

duration        = 0
bufferSecs      = 5
reconnect       = yes
realtime        = yes
rtprio          = 3

device          = hw:1,0
sampleRate      = 44100
bitsPerSample   = 16
channel         = 2

bitrateMode     = cbr
format          = mp3
bitrate         = 320
server          = localhost                         
port            = 8000
password        = hackme
mountPoint      = listen.mp3
name            =
description     =
url             = http://localhost
genre           = music
public          = no
localDumpFile	= dump.mp3

If the alsa device hw:1,0 is not working, you can find the id of your USB audio interface using aplay -l

Install Sonosplay

sudo apt install git
git clone
cd sonosplay
pip3 install .

Write the control script
The following simple python script starts icecast2 and darkice and sends the mp3 stream to the Sonos speakers:

#!/usr/bin/env python3

import os
import time
import signal

# make sure that icecast2 is started
os.system('sudo systemctl start icecast2')

# wait 5s

# Start darkice in a new process
pid = os.fork()

if pid == 0:
  # Stream to sonos
  os.system('sonosplay --ip')
  os.system('sonosplay --ip')


You will have to change the IP addresses of your Sonos speakers.If you run the script using
python3 the music should start playing on your Sonos speakers.

Systemd Service

To run the script on system startup, you have to create the file stream.service in /etc/systemd/system:

Description=Sonos stream auditd.service

ExecStart=python3 /home/pi/


and enable it using sudo systemctl enable stream

Show Comments