This forum is now read only and kept for historical purposes. We'd love you to stay in the loop, and if you'd like to as well, you can sign up for our new forum here

Post Reply 
Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Alpha] usb sound cards support for raspbmc
07-08-2012, 05:12 PM (This post was last modified: 11-30-2012 12:38 AM by s7mx1.)
Post: #1
[Alpha] usb sound cards support for raspbmc
It finally arrived folks. If you have been patiently waiting for usb sound card/speakers for you pi then its time to get your hands dirty.

Before you are getting too excited here is the warning:
  • it's alpha quality and built/modified from the latest xbmc-rbp git repository. Don't be surprised to see crashes now and then.
  • occasional audio/video out of sync (read further for details)
  • very high cpu usage playing audio files

Some background for this built:
  • All the goodies from AudioEngine
  • Skin/Menu sound now works!!
  • pulseaudio v2.0 as the backend which should avoid SRC if the hardware supports it
  • smart plug & play support and it shall recognize your usb sound card/speakers and automatically configure it for your.

I have included most useful pluseaudio addons therefore you should expect most exciting functionality from running pulseaudio on your pc, for example:
  • you NOW can streaming audio over network/wifi to a remote pulseaudio server
  • you NOW can streaming audio from your pc to pi over network/wifi.

Here is the instruction to get it install on your pi. Please login into your pi via ssh/putty as user pi

Step1: Install optimised pulseaudio
sudo apt-get install libltdl7
sudo rm -rf /usr/lib/arm-linux-gnueabihf/libpulse*
sudo rm -rf /usr/lib/arm-linux-gnueabihf/pulseaudio
sudo rm -rf /usr/share/pulseaudio
sudo rm -rf /usr/lib/pulseaudio
sudo rm -rf /usr/lib/pulse-2.0
sudo rm  /usr/lib/libpulse*
wget -O /tmp/pulseaudio-2.1-hardfp.tgz
cd /
sudo tar xzf /tmp/pulseaudio-2.1-hardfp.tgz
sudo wget -O /lib/udev/rules.d/30-sound.rules
sudo wget -O /lib/udev/set_volume
sudo chmod 755 /lib/udev/set_volume
sudo initctl start pulseaudio

Step 2: Install AE enabled xbmc
As of 2012-11-27 nightly is AE enabled and to install it just go to raspbmc settings addon and install the latest nightly from there.

Step3: Configure xbmc to use AE
By default AE is turned off and to enable AE we need to go to raspbmc settings addon and go the system settings tab and enable "Audio Engine". Restart XBMC is needed (some user reported back that restart pi is needed in order for it to work)

Just to clarify that if audio engine is disabled then xbmc should behave exactly the same as the one of the xbmc nightly. Please also make sure HDMI is selected when audio engine is disabled if you want audio to go from hdmi.

USB workaround
If your usb 2.0 sound card/speakers produce distorted audio please put this entry into your /boot/cmdline.txt to force the built-in usb hub to run in usb 1.0/1.1 mode

Digital Passthrough
All you need to do is switch to the new multi-sink profile after you usb sound card is detcted (i.e. audio device list is showing other than default)
for card in $(pactl list short cards | awk '{print $1}') ; do pactl set-card-profile $card multi-sink;
then head over to xbmc's system settings and pick the right passthrough device.

Audio/Video Sync issues
  • Audio/Video can go out of sync for around 0.5 - 1 second when forward/backward skip is pressed during playback. Pause/Play has no effect on sync, i.e. you can play/pause many times you want and should not make audio and video out of syn as long as you do not seek
  • Please make sure your usb sound card/speakers has native support for 48K sample rate which is most sample rate used for video files. If the sound card/speakers does not native support the sample rate of the audio file, it will make the audio/video sync problems a lot worse.

Onboard audio (hdmi/analogue) device
With latest RC5 update this is not possible due to problem at compiling kernel alsa driver
You can enable the experimental alsa driver for the onboard device by
sudo modprobe snd-bcm2835
This will not survive after a reboot and to make it auto load you should put a entry like snd-bcm2835 inside /etc/modules.
Audio/Video sync does not work reliable for the alsa driver snd-bcm2835 and if you experience out of sync at starting of the video you should stop it and then start it again.
Do not pause/play too often and too much for alsa driver snd-bcm2835 as this may cause xbmc/pulseaudio to freeze. If this happens you have to restart xbmc.

Performance turning
I would recommend use "Super" performance profile if you have usb install.

Trouble Shootings
If you see whitescreen loops then post the results of
ldd /home/pi/.xbmc-current/xbmc-bin/lib/xbmc/xbmc.bin

If there is no sound please run the following during audio/video playback
pactl list short sinks
pactl list clients
pactl list sink-inputs
and please also upload your xbmc.log and syslog

To unmute and set volume to full do
for sink in $(pactl list short sinks | awk '{print $1}') ; do pactl set-sink-mute $sink 0; pactl set-sink-volume $sink 100%; done
and go through every single audio devices by replacing 0 by 1 2 ... etc

Revert back
If for any reasons that it did not work for you its really easy to revert back, just run
rm /home/pi/.xbmc-current
and revert and changes made to /etc/modules
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
[Alpha] usb sound cards support for raspbmc - s7mx1 - 07-08-2012 05:12 PM

Forum Jump:

User(s) browsing this thread: 1 Guest(s)

Sponsored Advertisement