Wireless Vinyl Streaming to Squeezebox

A few years ago I got rid of my whole analog hifi equipment. I replaced it with a decent pair of active loudspeakers, a NAS running Logitech Squeezebox Server (LMS), a pair of Squeezebox Receivers, a Boom, a couple of Logitech Radios and a Squeezebox Classic all connected over Wifi.IMG_0176

Despite Logitech’s discontinuation of the Squeezebox product line and because everything is open source, I have kept this setup and have no plans to replace it in the near or distant future. I just love the flexibility and the audio quality.

But back to the story: With the introduction of Squeezeboxes into my home, I ripped all my CDs to MP3 and AAC and swore to myself I would never again tolerate a CD player. I have been a happy Deezer user (after ditching Spotify) for over three years and also swore to myself, I would never buy any music on physical media again.

Never say never. Last year I went to a hip(ster) Berlin restaurant where they played music from a turntable. They celebrated the record selection, the style of placing it on the turntable before finally playing it. I felt nostalgic, happy memories came to my mind of my huge vinyl collection from the late 70s and 80s that I had fortunately kept in a dry and clean place at my parents’ home. I knew I had to get myself a turntable again.

After checking new and used turntable options, I decided to buy a used Dual 731Q, arguably one of the best turntables from the late 70s, early 80s. I got one that was in a not too bad condition, it just needed some cleaning (mechanics and cover) and a new stylus.

But how to integrate a vintage turntable into my Squeezebox setup? I wanted it to stream directly into the LMS so that I could pick up the signal and distribute it to any Player also for synchronized playback. I needed something to convert the analog signal into a high quality digital signal and then to stream it through wifi to the Squeezebox clients.

Since LMS can connect to any Internet radio stream through a M3U file, the idea was born to create my own audio streaming server fed on-the-fly from the turntable.

But before you can think about digitizing a phono signal, bear in mind that turntable signals are much weaker than typical line-in analog signals and must get pre-amplified first. I use an Analogis Stereo Phono Pre-Amplifier to bring the signal to line-in levels. There might be better pre-amps around, but as I was anyhow going to digitize the signal, I found this to be good value for money.IMG_0177

I decided to use a Raspberry Pi to do the actual transcoding and streaming job together with a low-latency high-end USB A/D converter (since the Pi does not support audio in by default). I opted for a Behringer U-Control UCA222, which is not too expensive, samples up to 48kHz and is powered through USB (at least one power cord saved). The main benefit of the UCA222 is its ALSA compatibility, so that it does not require any additional drivers. You could also buy a Behringer UFO202, which comes already with a built-in phono pre-amp and save a few bucks.

IMG_0178An Edimax Wireless USB adapter is used to connect the Raspberry Pi to Wifi and a fast Class 10 8GB SD card serves as data storage.

The solution is small enough to hide it with all the cables behind a shelf. Listeners only see the turntable and no other equipment except for the loudspeakers, of course. I control everything through iPeng on my iPhone, but you can also use a Squeezebox Remote or the original Squeezebox app.

Now a few words about the actual streaming software. To convert the uncompressed Wave Input into streamable MP3, I use Darkice together with Icecast2 as streaming server on Raspbian OS.

Darkice is configured to convert the high quality digital signal into a 320kbps MP3 (only lossy compression formats are supported by Darkice, in this post I am decribing how to use Liquidsoap with lossless FLAC instead). Icecast2 provides streaming access on port 8000. Note, that my setup is only used behind my home network’s firewall, so I did not feel a need to change default users, passwords, or ports.

Here you can find the Internet-sources how to set it up

Download Raspbian Wheezy

https://www.raspberrypi.org/downloads/raspbian/

Setup Raspbian Wheezy headless and configure it through ssh

http://hertaville.com/2012/09/27/raspbian-raspberry-pi/

Configure Wifi

https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

Install and configure Darkice, Icecast on Raspian Wheezy using ALSA input

https://stmllr.net/blog/live-mp3-streaming-from-audio-in-with-darkice-and-icecast2-on-raspberry-pi/

edit /etc/Darkice.cfg

Mount Point: phono

Stream Title: Phono

Bitrate 320, cbr

Stream URL: http://raspberrypi.local:8000/phono

add Darkice to the autostart section

sudo nano /etc/rc.local

darkice &

exit 0

If you don’t want to go through all these tedious steps of setting up Raspian, Darkice and Icecast2 yourself, you can download my Raspberry Pi image from here soon.

Once you’ve set up your Raspberry Pi, all that is left to stream your records through LMS is to create a M3U file that points to the live stream. Below is how my file looks like. I stored it as “Phono.m3u” in the playlist folder of my LMS. Don’t forget to rescan your music library.

#CURTRACK 0
#EXTM3U
#EXTURL:http://IPADDRESS:8000/phono
#EXTINF:-1,Phono
http://IPADDRESS:8000/phono

You must replace IPADDRESS with the actual IP address that was assigned to your Raspberry Pi by your DHCP (mDNS does not work with original Squeezebox players, it does work with “our” Raspberry Pi players, though). You can retrieve it either with a Wifi Scan tool or by logging into your access point and browsing through the list of connected devices.

To listen to a record simply pick “Phono” from your playlists. That will direct LMS to your turntable’s stream. Thanks to LMS you can now even sync different players and listen to your records in different rooms simultaneously.  For easier access you can also add “Phono” to your favorites.

Direct comparison between a 320kbps MP3, a Deezer high quality stream (320kbps) and my 320kbps record stream reveals no real difference. The “analog” signal sounds probably a little less analytic, but warmer and more integrated. And nothing can compare to the joy of browsing through my vinyl collection, choosing a record, taking it out of the sleeve, flipping it to the correct side, placing it on the turntable, before carefully lifting the stylus down and then listening to the little crackling sound when the needle finds the track.

For less than 100€ I now stream records directly to my Squeezebox players in hi-fi quality. What I described here also allows to integrate a tape deck, a microphone or any other analog audio source (musical instrument) into a Squeezebox ecosystem. It can of course also be used with any other media player including Sonos or Teufel Raumfeld that can handle M3U files.

Parts List

Behringer UCA222, Analogis Phono Pre-Amp or Behringer UFO202
Raspberry Pi A+ or B+ with 2000mA power plug
EDIMAX EW-7811UN Wireless USB Adapter, 150 Mbit/s, IEEE802.11b/g/n
SanDisk Ultra Android 8GB microSDHC Class 10

 

52 comments

  1. Martin Benson · March 20, 2016

    I like this, and being a lazy so-and-so, I’ll be interested in downloading the image when it arrives.

    I use a Squeezebox Classic into my old analogue hi-fi, which has a record deck attached (a Michell Focus One, if you’re interested); I have other squeezeboxes (Touch, Radio, another Classic) dotted around the house. Presumably, there is no reason why I could not use the tape output from the amp and put it straight into the Behringer A/D, and hence get my vinyl into all my squeezeboxes?

    Like

    • IOT-Solutions · March 20, 2016

      That should work and it is really fun to have analogue music playing all over the house. I still need to find 1-2 days in the next weeks to add Wifi setup to the image. As soon as this is done, I will make the image available here

      Like

    • IOT-Solutions · May 2, 2016

      Thanks for your comments. I will fix the instructions. Strange that you need to downsample to 22k, though. Probably your Wifi is not fast enough.

      Like

      • Martin Benson · May 2, 2016

        It’s not the wifi – it’s a direct wired connection. I think the issue is actually the old RPi model A with only 512M of memory; I don’t think it has enough oomph to do the job.

        Like

      • IOT-Solutions · May 2, 2016

        I am using a Raspi A+, and that is sufficient for 44k …

        Like

  2. Martin Benson · May 1, 2016

    Hi there

    I decided to just go ahead and follow these instructions. And….it works! Using the same A/D converter as you.

    Couple of issues:-

    a) The playlist for Phono in the LMS must have http://IPADDRESS:8000/phono – note no .m3u at the end, or it doesn’t work.
    b) I also found that I had to drop the sampling rate in the darkice.cfg from 44100 to 22050, otherwise I got pops on my music stream. But it sounds fine to me even so.

    It’s a little odd to drop the stylus onto the record, and then hear that distinctive sound five or six seconds later…but there’s no way round that.

    Thanks again for this – it’s been a fun way to spend a Sunday afternoon.

    Like

  3. Stewart · May 16, 2016

    I’m trying to follow this guide, but trying to get the Raspberry Pi to broadcast a local radio station that I can point my Sonos App to…

    Any ideas how I could configure my DarkIce.cfg to do this? Can I just use the sample .cfg file from the site you linked to?

    Once I get the .cfg file sorted, do I just point the Sonos app to the Raspberry Pi IP Address?

    Like

  4. DR · July 16, 2016

    Hi – first time Pi-er here. You mentioned you could share your Raspberry Pi image with Darkice etc already built – where could I find that please?

    Like

    • IOT-Solutions · July 16, 2016

      My image does not include a wifi setup yet. I will share it once I have found the time to integrate this. Stay tuned.

      Like

      • Mickaël · October 3, 2016

        I’m tuned since the day one 😉 Any chance to get the image in few days ?

        Like

      • IOT-Solutions · October 3, 2016

        Sorry, but very unlikely. I must include a wifi setup script and could not find the time yet. Probably something for the holiday season … in the meantime you can follow the instructions in the links I provided.

        Like

      • Mickaël · October 3, 2016

        Alright. I’ll go flollow the instructions. One question from a newbie, if the live streaming is always on, how do you manage the free space on the SD card ?

        Like

      • IOT-Solutions · October 10, 2016

        Icecast and darkice certainly use some buffer for the streaming, but they are not recording anything. So, space is freed up all the time …

        Like

  5. CJ · August 27, 2016

    Did you every get any further with Liquid Soap?

    Like

    • IOT-Solutions · August 29, 2016

      Unfortunately I could not find time in the past months to explore Liquidsoap further.

      Like

      • CJ · September 19, 2016

        Once again many thanks for the instructions. I followed them exactly yesterday and successfully installed this on my raspberry pi 2 running Jessie to stream to my pair of Sonos Play:1s. I get about a roughly a 2 second delay using a USB headset to test the streaming. I am streaming in mono at the moment but will test stereo when my UFO202 arrives.

        Like

      • IOT-Solutions · September 20, 2016

        Thx for your feedback! Pls share your experiences again when your UFO202 has arrived.

        Like

    • IOT-Solutions · October 15, 2016

      I managed to get liquidsoap working with Flac on my Mac. Now waiting for my new SD card, then I will give it a try with the raspberry.

      Like

      • CJ · November 11, 2016

        Great! How much of a delay in streaming to you get with liquidsoap?

        Like

      • IOT-Solutions · November 12, 2016

        Around 5 secs, not more than with the darkice/icecast setup.

        Like

  6. a! · September 8, 2016

    Sounds like a great solution! I read something similar before and played with the idea, but wasn’t thinking of the Raspberry Pi before.
    I’ll try to have a look if I get it running on my OSMC-Raspberry Pi, since OSMC is anyways Raspbian based, so it should be ok to run it side-by-side…
    Just wondering: From your instruction, darkice & icecast run all the time and with autostart. Instead of autostart, I prefer a script to switch both on/off, this could then be even triggered through a GUI-button in OSMC… Any idea how this script should look like? Otherwise I’ll have a look by myself, but I guess that will need some time. (Is it enough to start darkice like in your autostart entry, or is it necessary to start icecast as well?)

    Like

    • IOT-Solutions · September 8, 2016

      Afaik darkice pulls icecast up automatically. If you want to stop that service (but why? The actual mem and cpu consumption is negligible) you would have to check darkice manual (it is included in one of the sources I provided)

      Like

      • a! · September 9, 2016

        Hi,
        tried now the installation, and ran into some small problems. I get the following error message when trying to start darkice:
        TcpSocket.cpp:251: connect error [111]

        As mentioned, I install it on OSMC, since it is Raspbian based it should work.

        That’s what I did:
        sudo apt-get install darkice (did not bother compiling like in your link, since for me ogg vorbis is fine. mp3 seems to be anyways included now, as far as I see)

        sudo gzip -d /usr/share/doc/darkice/examples/darkice.cfg.gz (was zipped)
        sudo cp /usr/share/doc/darkice/examples/darkice.cfg /etc/

        -> editing etc/darkice.cfg, it looks like this for me:
        # this section describes general aspects of the live streaming session
        [general]
        duration = 0 # duration of encoding, in seconds. 0 means forever
        bufferSecs = 5 # size of internal slip buffer, in seconds
        reconnect = yes # reconnect to the server(s) if disconnected
        realtime = yes # run the encoder with POSIX realtime priority
        rtprio = 3 # scheduling priority for the realtime threads

        # this section describes the audio input that will be streamed
        [input]
        device = hw:1,0 # OSS DSP soundcard device for the audio input
        sampleRate = 44100 # sample rate in Hz. try 11025, 22050 or 44100
        bitsPerSample = 16 # bits per sample. try 16
        channel = 2 # channels. 1 = mono, 2 = stereo

        # this section describes a streaming connection to an IceCast2 server
        # there may be up to 8 of these sections, named [icecast2-0] … [icecast2-7]
        # these can be mixed with [icecast-x] and [shoutcast-x] sections
        [icecast2-0]
        bitrateMode = abr # average bit rate
        format = vorbis # format of the stream: ogg vorbis
        bitrate = 192 # bitrate of the stream sent to the server
        server = osmc
        # host name of the server
        port = 8000 # port of the IceCast2 server, usually 8000
        password = myPW # same as in Icecast2
        mountPoint = osmc # mount point of this stream on the IceCast2 server
        name = Phono # name of the stream
        description = My vinyl stream
        # description of the stream
        url = http://osmc.local:8000/phono
        # URL related to the stream
        genre = my own # genre of the stream
        public = no # advertise this stream?
        localDumpFile = dump.ogg # local dump file

        —————————-
        Do you see any issue in there?

        When now calling darkice, it tells me:
        osmc@osmc:~$ darkice
        DarkIce 1.2 live audio streamer, http://code.google.com/p/darkice/
        Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/
        Copyright (c) 2008-2013, Akos Maroy and Rafael Diniz
        This is free software, and you are welcome to redistribute it
        under the terms of The GNU General Public License version 3 or
        any later version.

        Using config file: /etc/darkice.cfg
        Using ALSA DSP input device: hw:1,0
        Could not set POSIX real-time scheduling, this may cause recording skips.
        Try to run darkice as the super-user.
        DarkIce: TcpSocket.cpp:251: connect error [111]
        ————————————-
        And with sudo:
        osmc@osmc:~$ sudo darkice
        DarkIce 1.2 live audio streamer, http://code.google.com/p/darkice/
        Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/
        Copyright (c) 2008-2013, Akos Maroy and Rafael Diniz
        This is free software, and you are welcome to redistribute it
        under the terms of The GNU General Public License version 3 or
        any later version.

        Using config file: /etc/darkice.cfg
        Using ALSA DSP input device: hw:1,0
        Using POSIX real-time scheduling, priority 3
        DarkIce: TcpSocket.cpp:251: connect error [111]
        ——————-
        When trying to connect to http://osmc.local:8000/phono, I don’t get anything, neither with the m3u and the IP address, which is most likely related to this connection error…

        Do you have any idea?
        Thanks!

        Like

      • IOT-Solutions · September 9, 2016

        That looks like a deeper rooted error to me. If you have not compiled darkice, I suggest you do so and then see, if the bug is fixed.

        Like

      • a! · September 9, 2016

        Thanks for your answer, tried the compiling, but it fails somewhere:
        osmc@osmc:/src$ apt-get source darkice
        Reading package lists… Done
        Building dependency tree
        Reading state information… Done
        WARNING: The following packages cannot be authenticated!
        darkice
        E: Some packages could not be authenticated

        After, I cannot change into that folder, darkice-1.0/ does not exist.
        My guess it is related to me running Jessie and not Wheezy. Tried changing that entry in the repro source, but no difference…

        So I guess I will try to fix the direct installation which was working, maybe still some network settings messed up. I saw my changes in the icecast2 setup were somehow ignore, tried to fix this, but maybe there is still something wrong…

        Like

      • a! · September 14, 2016

        Hi, just to let you know: I got it running finally, wasn’t necessary to compile. Only had to start icecast manually once before starting darkice (/etc/init.d/icecast2 start), as described here: https://askubuntu.com/questions/28496/how-do-i-setup-an-icecast-server-for-broadcasting-audio-in-my-network
        After it works without that, also in the autostart.
        Now I still have a problem with my Squeezebox playlist. I can tune in the browser to http://10.0.1.18:8000/phono.ogg and it works fine, but not in my squeezebox, both as a playlist or in “tune in URL”. My playlist file looks like this:
        #CURTRACK 0
        #EXTM3U
        #EXTURL:http://10.0.1.18:8000/phono.ogg
        #EXTINF:-1,Phono
        [audio src="http://http://10.0.1.18:8000/phono.ogg" /]

        I get in the Squeezebox the correct link display, and file format is also displayed correctly “Ogg Vorbis”, but nothing playing. Which is strange… Do you have any idea what might be the problem? (I tried setting up the link both with and without “.ogg”, no change)

        Like

      • IOT-Solutions · September 14, 2016

        Afaik squeezebox does not support ogg. Only if a local squeezebox server or lms does the transcoding. Mp3, wav, wma, flac are supported directly.

        Like

      • a! · September 14, 2016

        Hi,
        according to http://wiki.slimdevices.com/index.php/How_to_get_the_Best_Audio_Quality#Why.3F and http://wiki.slimdevices.com/index.php/Beginners_Guide_To_File_Formats#Native_or_Transcoded.3F Ogg Vorbis has native support on Squeezebox, and I had never problems playing ogg streams or files. Nevertheless, I tried as well mp3, same result. Played also around with vbr, cbr, abr, but no nothing new, all work in a browser or music player, but not in the Squeezebox.
        Probably time to try it on a clean Raspbian installation following exactly your steps (by the way, some links don’t work anymore) to get closer to the problem…
        Cheers!

        Like

      • a! · September 14, 2016

        And another update: Did it with a clean install on Rasbian Jessie following the guide, now compiling worked (though not necessary, since darkice 1.2 has mp3 support already included as long as lame is installed, might have been different in 1.0). Same result: I can listen, but not through Squeezebox, used exactly the same settings as described here. Exported as well from my icecast2-admin-GUI the m3u, same result.
        Seems somehow Squeezebox (I use daphile as LMS server and different squeezelite players) can’t read the stream, while all other programs have no problems. Not sure if I have a mistake or if there is a bug somewhere, I might try out darkice 1.3 (https://github.com/rafael2k/darkice/blob/master/darkice/trunk/ChangeLog mentions some bug fixes…)

        Like

      • IOT-Solutions · September 19, 2016

        What’s now left to stream your records through LMS is to create a M3U file that points to the live stream. Below is how my file looks like. I stored it as “Phono.m3u” in the playlist folder of my LMS. Don’t forget to rescan your music library.

        #CURTRACK 0
        #EXTM3U
        #EXTURL:http://:8000/phono.m3u
        #EXTINF:-1,Phono
        http://:8000/phono.m3u

        You must replace with the actual IP address

        Like

  7. a! · September 26, 2016

    Hi,
    I just wanted to let you know I got it finally running, but totally different. I discovered the Squeezebox WaveInput-Plugin (http://forums.slimdevices.com/showthread.php?49584-Announce-WaveInput-for-Linux/) is doing the same, and since my LMS-computer sits anyways next to my turntable, I didn’t finally bother the Raspberry Pi anymore.
    Just had to install this plugin, level out the recording level in alsamixer, and listen to the stream (in my case: “wavin:hw:1,0”, in many other cases “wavin:default” should do it.
    Thanks anyways!

    Like

    • IOT-Solutions · September 26, 2016

      I was actually experimenting with this plugin before, too. Great that you can listen to records now!

      Like

      • a! · November 11, 2016

        Hi,
        just a short follow up: I think the problem I couldn’t open the streams from Squeezeboxes was related to a permission problem in my LMS system. Anyways, as long as I am using the stream only through my Squeezeboxes and the LMS PC sits next to my stream source/vinyl, I don’t see an advantage of using this method here over the wavinput-plugin. But of course, already when having the LMS in a different room, this here makes completely sense.

        Like

  8. Mickaël · October 10, 2016

    Hi,
    I followed the instructions, except I updated version Raspbian to Jessie and I also updated version DarkIce (about 1.2 – 1.3 not yet in the repo). My hardware is a Raspberry Pi 3 with UFO202, it works perfectly in 320 bitrate (CBR) and 44100 khz. I also see a delay of approximately 7 seconds, but it’s fine for me. Everything works and it’s great, thank you for this blog post.
    Cheers.
    NB: for DarkIce properly start automatically at startup, follow these steps https://ubuntuforums.org/showthread.php?t=2183222

    Like

    • IOT-Solutions · October 10, 2016

      Great that it works for you. The 7 sec delay is caused by the buffers darkice and icecast are building up. You can somewhat try to reduce that, but I also kept the default settings and experience some delay.

      Like

  9. Pingback: High-end wireless vinyl streaming | IOT-Solutions
  10. CJ · November 13, 2016

    I have been trying your liquidsoap example over the weekend but I can’t get it to work. I get a file doesn’t exist error when I try to change the permissions of the log file and an empty token error associated with the liquidsoap script. Any ideas?

    Like

    • IOT-Solutions · November 13, 2016

      Just ignore it, but change the owner rights for all others. Then execute liquidsoap manually. Afterwards the files will exist and you can change also their owner rights, before you start setting up liquidsoap for autostart.

      Like

      • CJ · November 14, 2016

        I worked out the problems I had with the script and it now seems to be working. I needed to replace the ” characters in the example script and remove &#8221 from the url part (I guess these issues are a result of wordpress) and replace hw with plughw in the input.alsa part. Thanks again for the guide!

        Like

  11. Paul Webster · December 4, 2017

    I have done something similar. I used the Behringer UFO202 (with the built in phono amp) but went a simpler route to get the sound in.
    I used the WaveInput LMS plugin – which in essence runs arecord and I set a favourite called Turntable with “URL” of
    wavin:sysdefault:CARD=CODEC
    Benefit of this approach is that it is really simple to get up and running and if you know the name of the device in Linux then there is not even a need to login to the LMS box.

    Like

    • IOT-Solutions · December 4, 2017

      That is indeed a simpler approach. Small caveat is that it only works with LMS.

      Like

    • Martin Benson · December 26, 2017

      Just to say thanks to you, Paul – just tried that, and it’s trivially easy to make work. No settings, no nothing – just off it goes.

      Like

  12. Tom Verhoeven · June 6, 2018

    hi, i’m a bit new to raspberry pi but again into vinyl. would like to try this set up with my samsung multiroom speakers. so far i have the behringer connencted to my laptop and that works.
    could you advise me if a pi 3B would also do the trick from hardware pov?

    tx

    Like

    • IOT-Solutions · June 6, 2018

      Hi, a raspi 3b is definitely sufficient to do the job. I am running it on a raspi 2 without any issues. Just make sure that your Samsung speakers can playback any Internet radio source …

      Like

  13. Tom Verhoeven · June 6, 2018

    ok, so it won’t be streaming as a UPnP/DLNA source for example? this is how i have now set it up with my PC through the application Streamwhatyouhear

    Like

    • IOT-Solutions · June 6, 2018

      If you want that then you need to pick up the radio stream from a upnp server first. Ie lms, your pc, or fritzbox …

      Like

  14. paulcurtis26 · September 3, 2020

    Hi there,

    Many thanks for the post it was the first project I built.

    I have tried to get this working on Debian Buster and there have been many changes so I ended up using it as a tutorial for myself on how to get this working.

    I have uploaded a Image file of the build (Called Vinyl) to a shared link, I hope that some folks out there stumble on your post and find the image useful

    Apologies that it is 5.6GB compressed and goes onto a 64GB card, its all I had and I did not know how to shrink the partitions.
    🙂
    This version runs by default at vorbis quality, it is easy to change to flac if your network can sustain it

    Here is the image link, extracted from a raspberry pi 3 and a 64gb sd card
    https://1drv.ms/u/s!AiyozyshITwqt03PWEzQGBhuDP44?e=r4CeBP

    Like

Leave a comment