Friday, 28 March 2014

Raspberry Pi Car Audio

Spontaneous Projects is a chronicle of all of my projects, a reference for me, and a way to prevent others from making the same mistakes. 

So I finally got myself a couple of Raspberry Pi's, so I'm trying to get my head around what they can do. 

To start off with I'm setting one up to act as an airplay speaker for my iphone, and probably a media server that plays a random selection of music. 



First thoughts

  • Using it without the SD card doesn't boot, just a black screen. 
  • I've installed Raspian, it's easy enough to set up for WiFi and general display etc. 
  • nano and leafpad work well enough as text editors
Setting up audio for the 3.5 jack not the HDMI port
amixer cset numid=3 1 
    3 2 will make it HDMI again. 
testing the output can be conducted through aplay file.wav for any wav files you can find.

Installing Shairplay

I used parts from here and here
Shairplay is an airplay emulator, and I've found installing it to be a bit of a pain, lots of older blogs and things, but nothing current.

first up, we need to update the apt-get functions, you'll probably need sudo privileges
apt-get update
apt-get upgrade

then install some basic dev dependencies for Shairplay, some may already be installed, but it can sort that out for itself.
apt-get install libssl-dev libavahi-client-dev libasound2-dev
apt-get install git libao-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils libmodule-build-perl 


Then install Perl, this might not be required, and can certainly be done later... I'll find out when I reinstall it at some stage.

cd perl-net-sdp perl Build.PL
sudo ./Build
sudo ./Build test
sudo ./Build install
cd ..


Finally we can install shairport








git clone -b 1.0-dev git://github.com/abrasive/shareport.git
cd shairport
./configure
make
make install

You'll be missing a few things, libao, PulseAudio, but they are not essential.

Run it using ./shairport -a 'NameHere'



Some Issues I had:
symptoms, Pi is visible as an Airplay device, but won't connect.
cause: lack of avahi, perl or libao, or some other dependency that is now added in the above code. I think it's the avahi mDNS, as forcing the use of tinysvcmdns causes the same issues. But I think this was caused by the lack of perl-net-sdp...

No comments:

Post a Comment