Auteur Sujet: Raspberry-Pi bt+mpd guide.  (Lu 12761 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne Seditio

  • Néophyte
  • *
  • Messages: 9
Raspberry-Pi bt+mpd guide.
« le: 27 janvier 2013 à 20:53:07 »
So here it is, some people have requested it already :)
http://www.youtube.com/watch?v=UXj9AZGmBJI
 
The basic idea is to have the Pi boot up and automatically run:
  • The bluetooth connection
  • The Media Player (in this case: MPD)
  • The remote control plugin for the remote (in this case: Remuco)
This guide will show you how to set up all of this, and it doesn't cost much! I use it in my car since I have some crappy cassette player (my car is old, the stereo is even older) but I can't really explain how to hook it up to a fully fledged car amp, as I just have a basic audio-in cable popping out of the stereo that I use.
 
So I will show you how I did it, it is no way near the easiest and/or simplest way, but it works.. (Should you manage an easier way, please do comment and/or create a new guide! :)
______________________________________________________________________________________________________________________________________
Step 1: Installing required packages.
Note: I use ArchLinux ARM, I'm pretty sure the package names are the same, if not I shall research the debian package names.
bluez alsa-utils mpd mpc python2-dbus python2-gobject initscripts remuco (aur)
Step 2: Pairing your bluetooth device.
I hope you know that your bluetooth device needs to be visible for this to work :)
hcitool scan
bluez-simple-agent hci0 <enter address found by hcitool here>

Step 3: Enabling sound.
 
By default, ArchLinux ARM doesn't have sound by default, Rasbian however, does, if running Raspbian, you can probably skip to the test..
 
modprobe snd-bcm2835 #Enable the sound module.
echo snd-bcm2835 > /etc/modules-load.d/sound.conf #Enable autoloading of the sound module.
alsamixer #Crank up the volume to the max, unless using a sound output that doesn't have a volume setting.
amixer cset numid=3 <n> #Auto mode doesn't tend to work as you'd like it to, replace n with the number (0=auto, 1=analog, 2=hdmi)
speaker-test -c 2 #Replace 2 by the number of channels you have as outputs, 2 = stereo, 6 = 5.1, 8 = 7.1

Step 4: Setting up MPD.
 
Please refer to https://wiki.archlinux.org/index.php/Music_Player_Daemon#Setup for setting up MPD as this depends on your usage of the software, I use it in per-user mode as root, but it's entirely up to you.
 
Step 5: Setting up Remuco.
 
Once you've installed remuco, you should just be able to run 'remuco-mpd' over ssh and test your connection and speakers.
 
Step 6: (Optional) Autostarting.
 
Create a file called 'start.sh' in your users directory (in my case /root/start.sh)
mpd
mpc clear
mpc search filename "." | mpc add
mpc update

Delete your /etc/rc.conf (if you have just installed initscripts, if not, DON'T do this) and add this line to your /etc/rc.local :
 
sh /root/start.sh (Replace with the location of your start.sh)
 
This will automatically start MPD and prepare your music player.
 
Starting remuco however is a little different, I shall explain my way of doing this:
  • Install tightvnc and lxde
  • Run 'vncserver :1' then 'vncserver -kill :1' to create the configuration files.
  • Add these lines to your users .vnc/xstartup file:
lxterminal &
/usr/bin/lxsession -s LXDE &
remuco-mpd

Now, depending on your startup utilities, you should enable the vncserver startup service by using 'systemctl enable vncserver@service' then edit your /etc/systemd/system/multi-user.target.wants/vncserver.service to use the :1 that you entered earlier.
 
You're done! Feel free to comment for your problems or achievements!