This repository provides all the tools you need to convert your vinyl records into a high-quality digital audio stream, making your analog collection accessible across a wide range of digital platforms. At the heart of this setup is the Raspberry Pi, a small and affordable computer that serves as the streaming server.
I use a PHONO PP400 amplifier and a Behringer UCA202 capture device, but this method should work with every other Raspberry-compatible capture device and with any other amplifier.
-
Audio Capture: Your turntable's audio output is first routed through the PHONO PP400 amplifier, which prepares the analog signal for digital capture.
-
Digital Conversion: The amplified signal is then fed into the Behringer UCA202 capture device, where it's digitized and sent to the Raspberry Pi.
-
Streaming: On the Raspberry Pi, two critical software components come into play:
- Darkice: This live audio streamer captures the digital audio and encodes it into a streamable format.
- Icecast: This streaming media server takes the encoded audio from Darkice and broadcasts it, making it accessible to listeners over the internet.
-
Quick Start: For those eager to get started, a pre-configured Raspberry Pi image is available for download. Simply flash it onto a Micro SD card, insert the card into your Raspberry Pi, and you're ready to stream.
-
Manual Configuration: For users who prefer to fine-tune their setup, step-by-step instructions are provided for configuring Darkice and Icecast, as well as identifying and setting up your audio capture device.
After that, you will have a stream on your local network which you can access with multiple programs such as iTunes, VLC Player, or Chrome. From these programs, you can also stream your audio to multiple rooms using Google Chrome or AirPlay 2.
- Capture Device: Behringer UCA202
- Amplifier: PHONO PP400
- Server: Raspberry Pi 3 and Micro SD Card - (8GB is enough)
Ensure that you have the above-mentioned hardware components before proceeding with the setup.
Download the Raspberry Pi Imager from Raspberry Pi Software.
Also, download the preconfigured image for your project from GitHub: Download Image.
- Insert your Micro SD card into your computer.
- Open the Raspberry Pi Imager.
-
Choose OS: Select "Custom Image" in the dropdown menu. Select the Downloaded preconfigured image.
-
Choose Storage: Select your SD card as the storage destination.
-
Settings: Click on the Settings tab and input the following information:
- Hostname:
vinylstream
- User:
vinyluser
# Important: The username must be exactly the same. Also pay attention to uppercase and lowercase letters - Password:
setyourpassword
# Is no longer needed after the easy installation - Input your Wi-Fi information.
- Hostname:
-
Save these settings.
-
Click on "Write" and wait for the process to complete.
- Insert the Micro SD card into your Raspberry Pi.
- Connect the Raspberry Pi to a power source.
- Connect the capture card to the Pi.
Wait for 3-5 minutes, then try to open this page in your browser: http://vinylstream:8000/
That's it! You can now stream your music from http://vinylstream:8000/stream.mp3.
Press inside the iTunes (Music) App: ⌘U (Command U)
Then type in http://vinylstream:8000/stream.mp3
# Lists audio devices
arecord -l
Look for the output that identifies your Behringer UCA202. For example:
**** List of CAPTURE Hardware Devices ****
card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
Note down the card
and device
numbers as you will need them for configuration (e.g., hw:1,0
).
# Captures 10 seconds of audio and saves it as test.wav
arecord -D hw:1,0 -d 10 test.wav
The command will record 10 seconds of audio from your capture device. Play the test.wav
file to check the audio quality. If everything sounds good, proceed with configuring Icecast.
To manually set the sample rate, you can use:
# Sets the sample rate and captures 10 seconds of audio
arecord -D hw:1,0 -d 10 -f S16_LE -r 48000 test.wav
For the Behringer UCA202 for example, the max sample rate is 48 kHz
Before we dive into the configuration part, it's crucial to install and understand the role of two essential software components for this setup: Darkice and Icecast.
Darkice is a live audio streamer that captures audio from your specified device (in this case, Behringer UCA202) and encodes it into a streamable format. It acts as the bridge between your audio capture device and the Icecast server, capturing audio in real-time and sending it to Icecast for distribution.
Icecast is a streaming media server that will broadcast the audio stream to listeners. It's highly configurable and handles multiple clients, allowing you to stream audio to numerous listeners simultaneously. Icecast takes the encoded audio feed from Darkice and makes it accessible over the internet.
If you haven't installed these yet, you can do so with the following commands:
For Darkice:
sudo apt-get install darkice
For Icecast:
sudo apt-get install icecast2
-
Open the Darkice configuration file, usually named
darkice.cfg
, in a text editor.sudo nano /etc/darkice.cfg
-
Insert the configuration code provided in the referenced Git repository. This code typically sets the input device, sample rate, and other parameters tailored for optimum performance with your Behringer UCA202 capture device.
Note: The Git repository is your go-to source for a sample configuration. Simply copy-paste the code into your
darkice.cfg
file.
If you dont want to set Darkice as a system service, you can manually start it using the custom configuration file:
# Starts Darkice with the custom configuration file
darkice -c /path/to/darkice.cfg
In this case, you will need to run this command each time you wish to start Darkice. Make sure to replace /path/to/darkice.cfg
with the actual path to your Darkice configuration file.
Either method will initiate Darkice, allowing it to capture audio based on the parameters set in your configuration file and send it to the Icecast server for streaming.
If you find yourself frequently using Darkice and Icecast, setting them up as system services can automate the startup process and help manage the applications more efficiently.
To set up Darkice as a system service, you can create a custom systemd service file:
-
Create a new systemd service file for Darkice.
sudo nano /etc/systemd/system/darkice.service
-
Add the following content:
[Unit] Description=Darkice live audio streamer After=default.target [Service] ExecStartPre=/bin/sleep 10 ExecStart=/usr/bin/darkice -c /etc/darkice.cfg Restart=always User=vinyluser [Install] WantedBy=multi-user.target
Note: Replace
/etc/darkice.cfg
with the actual path to your Darkice configuration file andvinyluser
with the user you want the service to run as. -
Reload the systemd daemon and enable the service.
sudo systemctl daemon-reload sudo systemctl enable darkice
sudo systemctl start icecast2
sudo systemctl enable icecast2 # start on boot
Icecast usually installs itself as a service by default. If for some reason it isn't, you can create a custom systemd service file similar to Darkice.
- Connect to your stream using a web browser (Chrome) or a streaming app (iTunes / VLC).
- Listen to some music
If all goes well, your quality audio streaming setup is now complete!