Airtime on raspberry pi
  • Hi everyone,

    I am trying to set up airtime on a raspberry pi for a small local radio station.  Just about everything works except audio playback.  Here's what I've done:

    I set up the Nginx server, PHP, APC, and postgresql:
    sudo apt-get install postgresql php5-cli php5-fpm nginx php-apc

    Next, I configured nginx to work with php and to use /usr/share/airtime/public as it's document root.

    I also had to configure nginx and php to allow large file uploads. (I added upload_max_filesize=250M; to /etc/airtime/airtime.ini and client_max_body_size 0; to /etc/sites-available/airtime)

    I installed apc.php
    (your installation manual says to copy the original from /usr/share/doc/php-apc/ and then unzip it.  That doesn't work anymore because the file is now supplied already unzipped.)

    Next, I configured postgresql and tested it from pgadmin 3 running on my laptop.

    Then I installed all of airtime's dependencies:
    sudo apt-get install python-virtualenv coreutils curl ecasound flac gzip libao-ocaml libcamomile-ocaml-data libesd0 libmad-ocaml libmp3lame0 libportaudio2 libpulse0 libsamplerate0 libsoundtouch-ocaml libtaglib-ocaml liquidsoap lsof monit multitail odbc-postgresql patch php5-curl php-db php5-gd php-pear php5-pgsql pwgen python rabbitmq-server sudo sysv-rc tar unzip vorbis-tools zendframework zendframework-bin zendframework-resources

    This is the same as the list mentioned in the manual installation instructions except for the following:
    I removed anything related to Apache because I wasn't using Apache.
    I removed silan from the list because it isn't in the debian wheezy repositories.
    I replaced libzend-framework-php with zendframework, and zendframework-bin, and zendframework-resources because libzend-framework-php isn't in the debian repositories.
    (Was it safe to remove those?  I'm not worried about the Apache-related packages, but I my problems have something to do with removing silan and replacing libzend-framework-php)

    I set up monit following as the manual installation instructions say to do, but I wasn't able to copy ~/airtime-2.4.0/python_apps/monit/airtime-monit.cfg to /etc/monit/conf.d/ because the
    airtime-monit.cfg file didn't exist.  I looked in the ~/airtime-2.4.0/python_apps/monit/ directory and found two similar files: monit-airtime-generic.cfg and monit-airtime-rabbitmq-server.cfg.  I copied them both to /etc/monit/conf.d/

    I ran the airtime minimal install script:
    sudo ~/airtime-2.4.0/install_minimal/airtime-install

    When the script finished, I loaded airtime in my browser.  Everything seemed fine except for the following:
    When clicked on a song or scheduled show, a black line instead of a context menu appeared.
    When I played music, I couldn't hear anything from the earbuds that I had plugged into the rasberry pi.  The "ON AIR" box also failed to turn red.  The switch next to the "scheduled play" source stream was on, but the line going from the source to the switch was not orange. (see attachment.)

    Here's the output from airtime-check-system:
    AIRTIME_STATUS_URL             = http://localhost:80/api/status/format/json/api_key/%%api_key%%
    AIRTIME_SERVER_RESPONDING      = OK
    KERNEL_VERSION                 = 3.6.11+
    MACHINE_ARCHITECTURE           = armv6l
    TOTAL_MEMORY_MBYTES            = 497504
    TOTAL_SWAP_MBYTES              = 102396
    AIRTIME_VERSION                = 2.4.0
    OS                             = Debian GNU/Linux 7.1 (n/a) armv6l
    CPU                            = UNKNOWN
    WEB_SERVER                     = nginx/1.2.1
    PLAYOUT_ENGINE_PROCESS_ID      = 20109
    PLAYOUT_ENGINE_RUNNING_SECONDS = 57
    PLAYOUT_ENGINE_MEM_PERC        = 2.0%
    PLAYOUT_ENGINE_CPU_PERC        = 1.9%
    LIQUIDSOAP_PROCESS_ID          = FAILED
    LIQUIDSOAP_RUNNING_SECONDS     = 0
    LIQUIDSOAP_MEM_PERC            = 0%
    LIQUIDSOAP_CPU_PERC            = 0%
    tail: cannot open `/var/log/airtime/pypo-liquidsoap/ls_script.log' for reading: No such file or directory
    -- Displaying log file /var/log/airtime/pypo-liquidsoap/ls_script.log
    --
    --
    MEDIA_MONITOR_PROCESS_ID       = 17229
    MEDIA_MONITOR_RUNNING_SECONDS  = 790
    MEDIA_MONITOR_MEM_PERC         = 2.2%
    MEDIA_MONITOR_CPU_PERC         = 0.9%
    -- There appears to be a problem with your Airtime installation.
    -- Please visit http://wiki.sourcefabric.org/x/HABQ


    It seems that the problem is with liquidsoap.  If I run airtime-test-soundcard -v I get:
    Sound API: alsa
    Outputting to soundcard. You should be able to hear a monotonous tone. Press ctrl-c to quit.
    At line 1, char 12: the variable output.alsa used here has not been
      previously defined.
    There was an error using the selected sound API. Please select a different API and run this program again. Use the -h option for help

    I know ALSA is working because alsamixer tells me:
    Card: bcm2835 ALSA
    Chip: Broadcom Mixer


    I can also play audio from the commandline:
    aplay /usr/share/sounds/alsa/Front_Center.wav
    Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

    That's about all I can think to say.  I'm sorry if I got a bit too verbose.  I just want to make it as easy as possible to answer my question.
    265 x 102 - 10K
    Post edited by Allan Anderson at 2013-10-22 09:53:33
  • 17 Comments sorted by
  • Vote Up1Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Allan, you will find that the Raspberry Pi is underpowered for running a complete Airtime server, but let's give it a try :-)

    First, did you compile Liquidsoap from source, or get a binary package from your distro? Are you running the latest version 1.1.1? The command:

    liquidsoap --version

    should tell you this. It sounds like you don't have Liquidsoap's ALSA plugin compiled/installed.

    Cheers!

    Daniel
  • liquidsoap --version tells me that I have version 1.0.1.  Looking in the Debian repositories, it says that the version that is distributed with debian wheezy is 1.0.1+repack1-1.1.  Does that mean that there is a way to upgrade to version 1.1.1 through the repositories?

    Thanks for your help.
    Post edited by Allan Anderson at 2013-10-22 10:21:41
  • Vote Up1Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Not for the Raspberry Pi, wheezy doesn't include Liquidsoap 1.1.1 and we don't provide binaries for ARM at the moment. Current Liquidsoap is not too hard to build, you can use the instructions here: https://github.com/savonet/liquidsoap-full/blob/master/INSTALL

    I would suggest using the configuration file PACKAGES.minimal and uncommenting:
    ocaml-alsa
    plus any other plugin that you need.

    Cheers!

    Daniel
  • Vote Up1Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Thanks for the tip on APC configuration no longer being gzipped, I have updated the manual :-)
  • When I run ./configure I get:
    Liquidsoap directory seems empty. I assume that submodules were not downloaded. Hold on, I'm doing it for you!
    make[1]: Entering directory `/home/pi/liquidsoap-full'
    git fetch
    git branch --set-upstream-to=origin/master master

    It seems that the --set-upstream-to command requires git v1.8.0+.  I'm not sure how to upgrade because the debian repositories only have version 1.7.10.4.

    What should I do?

    By the way, thanks for taking the time to answer all my questions.
  • As a side note, I'm curious exactly what you mean by "you will find that the Raspberry Pi is underpowered for running a complete Airtime server."  Do you mean that things will just be sluggish?  Do you mean that nothing will work?  Do you have any recommended alternative besides airtime pro?  In this post, someone from the airtime team said that they were able to setup a fully functional, albeit sluggish airtime setup on the raspberry pi.  What am I doing different than they?  Did they also have to compile liquidsoap from source?

    That post also mentioned that you were working on code optimizations for the raspberry pi.  How's that coming along?
    Post edited by Allan Anderson at 2013-10-22 14:38:04
  • I hate to "bump" this, but I am rather desperate.  I understand that Airtime will be sluggish, I just want it to work.  What did you guys do to your raspberry pi to make everything work?

    Thank you for your patience.

  • I read somewhere that with the 512M RAM this will not support Liquidsoap.  What about an

    A20-Cubieboard?  It has 1G DDR3 RAM.  http://docs.cubieboard.org/products/start  Would this work with Airtime?

  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Allan, I see you have already read:

    http://www.sourcefabric.org/en/airtime/didUknow/1574/Airtime-and-Raspberry-Pi-part-2-planning-for-peak-performance.htm

    I don't know of any further optimisations since then, but if you do gain some improvements, please post them here. See also the PDF:

    http://www.sourcefabric.org/attachment/77/WRD_handout_TheSmallesRadioStationInTheWorld.pdf?g_download=1

    Let us know how you get on!

    Daniel
    Post edited by Daniel James at 2013-10-23 05:50:03
  • Argh, I wish I had seen this earlier.  I was going to download it yesterday, but for some reason the download froze at 1.5MB every time.

    Thanks again.
  • Hello
    Allan, were you able to get this working?  Within the documents posted by Daniel it indicated that the files should be converted to flac.  Were you able to get it working without any issues using mp3's?  I'm looking to try this.  
  • When I run ./configure I get:
    ...
    It seems that the --set-upstream-to command requires git v1.8.0+.  I'm not sure how to upgrade because the debian repositories only have version 1.7.10.4.

    What should I do?

    By the way, thanks for taking the time to answer all my questions.




    To get around the git version issue, try running the following commands (taken from liquidsoap-full / Makefile.git ) from a checkout on your windows (or other system), and then zip up the resultant folder and transfer back to your PI:

            git fetch
            git branch --set-upstream-to=origin/master master
            git submodule init
            git submodule update --recursive
            git submodule foreach "git fetch && git submodule init"
            git submodule foreach "git branch --set-upstream-to=origin/master master"
            git submodule update --recursive
     
    When copying back from a windows system, you'll have to set file modes on the bootstrap and configure files. From within the copied liquidsoap-full folder, type the following:
            chmod +x ./configure
            chmod +x ./bootstrap
            find -type f -name configure.ac -exec chmod +x {} /;
            find -type f -name bootstrap -exec chmod +x {} /;
     
    This is as far as I've gotten so far....
  • Has anyone a copy of this - it has gone walk-about? http://www.sourcefabric.org/attachment/77/WRD_handout_TheSmallesRadioStationInTheWorld.pdf?g_download=1

    I am about to attempt this with a much more powerful micro box or two. (dual core 1.66Ghz 1 and 2 Gb RAM)

    Any help and or suggestions welcome.
    No longer using Airtime or Libretime.
  • I am having fun trying to get AT running on a quad core arm device. It is quite a beast and should be well capable of running Airtime. Is anybody else playing with ARM devices and Airtime?

    I am having trouble getting php 5.4 running on Ubuntu 12.04. The php distro files are out of step with each other and I cannot meet the dependencies - even to do an upgrade of php.
    There seems no way to run, it like that, so I am attempting to have a go with 13.04 which does have php 5.4.

    Post edited by John Chewter at 2014-09-15 03:43:30
    No longer using Airtime or Libretime.
  • Hi, I know it was while ago but I am thinking of doing the same (with a Pi3).  Did you get it working OK.  Did you do a write up?

    Also did you start with Ubuntu Core or Raspian, the former seems most appropriate.
    Post edited by Ben Edwards at 2016-03-13 12:45:43
  • Vote Up0Vote Down Micz FlorMicz Flor
    Posts: 184Administrator
    Hi Airtime and Pi Lovers,


    I wrote the infamous "WRD_handout_TheSmallesRadioStationInTheWorld.pdf" that is not on our site anymore (for magical reasons). I attached the file here to this post in the forum.

    This document was written and tested in 2013, using Airtime version 2.3.0. And I only wrote and published this PDF for the World Radio day the same year after I tried it twice. It was painfully slow, but it worked.

    On came the evening itself and I wanted to show the "smallest radio station in the world" as a little publicity stunt for Airtime at Supermarket, Berlin. I had it all set up, my laptop connect directly with the Raspberry Pi. I had tested that this set up worked in the afternoon where I also prepared the playlist to fit the evening time table. My words (as I remember them): "Imagine a week of scheduled radio shows including the audio files and the software would all live on a little card this size" Add image of me waving the SD card to your mental picture "and imagine you could just launch right into the programme by slotting this into your Raspberry Pi and firing it up..." ... Which is what I did as I spoke and then plugged in the Pi ... and nothing (of course). Nothing. No sound. I had tried it in the afternoon!!! But ... nothing.

    Now imagine how quickly the attention of the audience drifts away from the presentation. Much faster than the Airtime web interface of the Raspberry Pi reacted to my mouse. First, the attention drifted, then the audience, past my crouched back and sweaty palms, towards the bar.

    Running Airtime on a Raspberry Pi is inspring when it works, it is fun an a great proof of concept. 

    It's not for running a radio station :)
    Post edited by Micz Flor at 2016-03-14 17:35:23
  • Pi 3 + Raspian = win

    Nevermind! Guess the Wheezy distro links have all been pulled...
    Post edited by Roger Wilco at 2016-03-14 23:55:20