High-end Vinyl Streaming to Squeezebox

High end vinyl streaming

High end vinyl streaming

Finally I found time to optimise my wireless vinyl streaming Raspberry Pi project. It uses now Liquidsoap and lossless FLAC streaming at 44100 kHz, 16 bit sampling for high end quality.

I am using the same raspberry pi setup as in my previous post. In that post I also explain how to tune your Squeezebox players to the stream, so I am not repeating it here again. Very important: only Logitech Media Servers 7.8 and higher support FLAC streaming in a OGG/Vorbis container. So, make sure that you are using the community edition and not one of the last official releases, or you wont be able to listen to the stream.

If you are running LMS 7.8, here are the step-by-step instructions how to set up liquidsoap on Raspbian Wheezy under the default user “pi”.

First, you need to update apt-get

$ sudo apt-get update

$ sudo apt-get upgrade

Then, you can install liquidsoap with all plugins including Ogg/Flac

$ sudo apt-get install liquidsoap

$ sudo apt-get install liquidsoap-plugin-all

Create a liquidsoap script, called “phono.liq”

$ sudo nano /etc/liquidsoap/phono.liq

Copy this script, replace [IP-ADDRESS] with your actual raspi’s IP address. Make sure that your DHCP server does not change it occasionally.

#!/usr/bin/liquidsoap

# set the path and permissions for the logfile

set(“log.file.path”,”/var/log/liquidsoap/phono.log”)

set(“log.file.perms”,777)

set(“log.unix_timestamps”,true)

#input from soundcard

phono = input.alsa(bufferize=true,fallible=false,device=”hw:1″)

#stream it to local icecast, default port and password

output.icecast(%ogg(%flac(samplerate=44100,channels=2,compression=5,bits_per_sample=16)), mount=”/phono”, name=”Phono”, format=”audio/ogg”, description=”Turntable FLAC”, url=”http://IP-ADDRESS”, genre = “Misc”, phono)

Save the script with CTRl-x, y ,

then make it executable

$ sudo chmod +x /etc/liquidsoap/phono.liq

Liquidsoap is extremely fragile, when it comes to owners and user rights. So, let’s make sure that we are ok here, otherwise it will not start.

$ sudo chmod 666 /etc/logrotate.d/liquidsoap

$ sudo chmod 777 /var/log/liquidsoap

$ sudo chmod 666 /var/log/liquidsoap/phono.log

$ sudo chmod 777 /run/liquidsoap

$ sudo chown liquidsoap /etc/logrotate.d/liquidsoap

$ sudo chgrp liquidsoap /etc/logrotate.d/liquidsoap

$ sudo chown root /var/log/liquidsoap

$ sudo chgrp root /var/log/liquidsoap

$ sudo chown liquidsoap /var/log/liquidsoap/phono.log

$ sudo chgrp liquidsoap /var/log/liquidsoap/phono.log

$ sudo chown liquidsoap /var/run/liquidsoap

$ sudo chgrp liquidsoap /var/run/liquidsoap

Let’s test the script

$ /etc/liquidsoap/phono.liq

If everything went well, you should see a long list of prompts. Check with your browser, if Icecast is running properly “http://IP-ADDRESS:8000/phono

Now press CTRL-c to stop liquidsoap. This is what you have to do to start your script automatically.

Open rc.local:

$ sudo nano /etc/rc.local

Add the following before “exit 0”

chmod 777 /run/liquidsoap

/etc/init.d/liquidsoap start

Save the changes with CTRl-x, y

We are not completely done. Have to change the user to run liquidsoap properly as a daemon.

$ sudo nano /etc/init.d/liquidsoap

#change user and group to default Raspberry Pi user “pi” and group “pi”

user = pi

group = pi

Save changes with CTRl-x, y

Now enable autostart and reboot

$ sudo update-rc.d liquidsoap enable

$ sudo reboot

You should now be able to listen to your turntable Flac stream. Enjoy!

Some useful Internet sources

# Liquidsoap home

http://liquidsoap.fm

# Raspberry Pi + Liquidsoap + Icecast (in French)

https://technic2radio.fr/tuto-raspberry-pi-liquidsoap-icecast/

# good step-by-step instructions

http://wiki.radioreference.com/index.php/Liquidsoap

# how-to autostart programs on raspberry-pi (German)

https://jankarres.de/2014/07/raspberry-pi-autostart-von-programmen-einrichten/

Advertisements

6 comments

  1. Pingback: Wireless Vinyl Streaming to Squeezebox | IOT-Solutions
  2. Denis · December 4

    Hi, thanks for your guide. I’ve been trying to reproduce your steps without success. Any chance you’ll be providing image of your raspberry pi card soon? I’m struggling to get liquidsoap to install on raspbian jessie.

    Like

  3. fontalamh · January 10

    Hi, thanks for this it is exactly what I’m looking for. I there any chance you could upload a text file of the script. WordPress has mangled it so cut and pastes won’t work. I’ve tried replicating it but it still doesn’t work but I’m not convinced all the characters are showing correctly.

    Like

    • IOT-Solutions · January 10

      I actually want to provide the full image for download sometime. Getting liquidsoap to work is tricky, the daemon is pretentious. Check the scripts again, but especially make sure that the ownership and access rights are all correct.

      Like

  4. fontalamh · January 10

    Thanks, it’s not to do with ownership nor access rights.
    I’ve decided just to try from scratch but for the sake of others for the script to work anyone using it will need to at least sort out the quotation marks which above show as left quotation marks, right quotation marks and the unicode description of a left quotation mark, ie:
    replace ” with ”
    replace “ with ”
    change url=”http://IP-ADDRESS”, to url=”http://IP-ADDRESS”,
    Of course wordpress might just stuff this up…

    Like

  5. fontalamh · January 10

    WordPress stuffed it up, interestingly correcting the characters after IP-ADDRESS itself!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s