balenaPhono is a project for Raspberry Pi that takes the audio output from a turntable or any other audio device and creates a shoutcast/icecast network stream. This project is great for anyone looking for a cheap and simple way to play vinyl on Sonos speakers.
- Raspberry Pi (Tested with Pi3, running daily on Pi Zero W)
- Audio device:
- Turntable with USB output -or-
- Turntable with RCA output and USB Phono Preamp
- You can use a USB audio capture card if you want to connect your old Walkman or Diskman.
- A cheaper USB phono preamp
- The turntable I use: audio-technica AT-LP60XUSB
Running this project is as simple as deploying it to a balenaCloud application. You can deploy it in one click by using the button below:
-
In the balenaCloud console for your new device check the log for any errors. You may need to change the DARKICE_DEVICE variable to match your device. Take a look here for troubleshooting tips.
-
Get the local ip address for your device from the balenaCloud console.
-
To play the stream in a browser window:
http://<device-ip>/rapi.mp3
-
To add your stream to your Sonos system:
You must use the Sonos desktop controller app to add a custom stream to Sonos. Click on Manage > Add Radio Station and enter the url for the stream (using your device local ip) "http://<device-ip>/rapi.mp3". Also enter a Station Name and click OK.
Variable | Example Value | Note |
---|---|---|
PORTAL_SSID | balenaPhono | Wifi-connect captive portal SSID **Check out wifi-connect page for additional variables. |
PORTAL_PASSPHRASE | balenaPhono | Wifi-connect captive portal Passphrase |
PORTAL_LISTENING_PORT | 8000 | *Changed from the default port 80 due to conflict with Icecast server |
CHECK_CONN_FREQ | 120 | This is the wifi-connect polling wait time in seconds. The default is 120 seconds, I usually set mine to 3000. |
REBOOT_SLEEP_TIME | 1d | Default is 1d (one day). Will work with d m s (days, minutes, seconds). It is a sleep time for the balenaBooter. Darkice audio streams have a tendency to get corrupted after a few days of up time. balenaBooter reboots the host once a day to keep things clean. Looking for a better way... if you have ideas. |
ICECAST_LOCATION | Interwebs | Where your stream is hosted from or where you are located. |
ICECAST_ADMIN_EMAIL | balenaAdmin@localhost | Used for the Icecast status page, doesn't need to be real |
ICECAST_CLIENTS | 10 | How many clients can connect to your stream. Keep it low if you are using a Pi Zero |
ICECAST_SOURCE_PASSWORD | b@13n4! | Password used by Darkice to connect to Icecast. Must be the same as DARKICE_PASSWORD |
ICECAST_RELAY_PASSWORD | b@13n4! | Not exactly sure what this one is for. You can change it with this device variable! |
ICECAST_ADMIN_NAME | balenaAdmin | Username for logging into the admin portal. |
ICECAST_ADMIN_PASSWORD | b@13n4-@dm1n! | Password for the admin portal |
ICECAST_HOSTNAME | balenaPhono | Hostname for the Icecast server |
ICECAST_PORT | 80 | Port that Icecast server listens on. Needs to be the same as DARKICE_PORT |
ICECAST_MOUNT_POINT | rapi.mp3 | Should end in .mp3 for MP3 streams and .ogg for Ogg Vorbis encoding |
ICECAST_STREAM_NAME | balenaPhono | Name of your stream. |
ICECAST_STREAM_DESC | A stream from AUX/Phono | Description of your stream. |
ICECAST_GENRE | Vinyl | The genre of your stream. |
DARKICE_DURATION | 0 | Duration of the stream in seconds. Set this to 0 to disable. |
DARKICE_BUFFER_SECONDS | 1 | How many seconds the stream buffers before playing. Minimum value: 1 (seems to work fine) |
DARKICE_RECONNECT | yes | Automatically re-connect to Icecast |
DARKICE_DEVICE | plughw:0,0 | Source device for your stream. Very hard to find information on this setting. Try this man page. The default setting here worked on a pi zero w. On a pi3 I had to change it to plughw:1,0 Good Luck! |
DARKICE_SAMPLE_RATE | 44100 | Sample rate of the source audio. You shouldn't need to change this. |
DARKICE_BITS_PER_SAMPLE | 16 | Bits per sample. You shouldn't need to change this one either. |
DARKICE_CHANNEL | 2 | How many channels. 2 for stereo... 1 for mono |
DARKICE_BITRATE_MODE | cbr | Accepts cbr, abr, vbr. Read the man page for more info |
DARKICE_FORMAT | mp3 | Format of the stream sent to the IceCast2 server. Supported formats are 'vorbis', 'opus', 'mp3', 'mp2', 'aac' and 'aacp' |
DARKICE_BITRATE | 320 | Bit rate to encode to in kBits / sec (e.g. 320). Only used when cbr or abr bitrate modes are specified. |
DARKICE_SERVER | localhost | Icecast server address or url |
DARKICE_PORT | 80 | Icecast port. Needs to be the same as ICECAST_PORT |
DARKICE_PASSWORD | b@13n4! | Needs to be the same as ICECAST_SOURCE_PASSWORD |
DARKICE_MOUNT_POINT | rapi.mp3 | Needs to be the same as ICECAST_MOUNT_POINT |
DARKICE_NAME | balenaPhono | Name of the stream. |
- Google is your friend!
- Submit an issue on this repo and I'll help if I can.