Crawling the Linux walls (with some success!)
#1
Hi all!,

I have read and re-read and searched and searched and searched to find a solution to my particular xbmc problem! I hope someone can help - and hope it helps others with the same problem!

Background... Found myself with a spare laptop. Figured I'd make it into a media center PC connected to the TV. Off I went, installed Ubuntu 9.04, xbmc etc. etc. Decided I needed remote control over the machine - so installed Synergy (software KVM - basically means I can control the media center laptop from the coffee table laptop! - I'm that lazy!).

Problem one was no sound at all via XBMC. Laptop is connected to TV via VGA (no HDMI on this one - and Ubuntu is a bit rubbish in its support there anyway). Audio is taken from the optical out (SPDIF) into the back of the surround sound system (audio hardware is Realtek ALC260).

Got audio by changing the ALSA mixer to show IEC958 switches. Enabled them. Then, changed the audio hardware to iec958 in XBMC. Et Voila! MP3 Audio working! Changed sound preferences in Ubuntu to default to ALSA Digital.

Next up...
YouTube
BBC iPlayer

...via the xbmc SVN Repo Installer (also grabbed the XBMC Favorites Installer, equally useful). Both worked a treat, result....

Until, I tried other media sources/plugins. E.g., WatchXOnline (TV shows and movies). Another plugin for The Simpsons episodes. One for family guy episodes. (etc. etc. you get the picture). None of them will work - I get either "Failed initialising audio device" or - it plays too fast (sounds a lot like the chipmunks - which I don't mind - cept when I don't want to listen to the chipmunks!).

* scratches head *

Then I noted that YouTube in a browser did not have audio. In fact, there was no Operating System audio (login sounds etc.). Found this very odd as "youtube in xbmc" worked just fine.

Upgraded all drivers - including ALSA - to latest.

Then, added a ".asoundrc" to my home directory reading...

Code:
pcm.!default {
        type plug
        slave.pcm "cards.pcm.iec958"
        slave {
                pcm "cards.pcm.iec958"
#                rate 44100
#               format S16_LE
        }
}

(tried different rates/formats, no success, in the end, worked better without specifying either)

And whaddya know.... suddenly, I have OS sounds from Ubuntu. And... I now have sounds in xbmc in terms of navigation (button clicks, menu selections etc.... hadn't even realised it had them until I did the above!).

Still no sound in "browser flash" land. And.... in XBMC, most streams other than iPlayer/YouTube still either give me no audio - or audio played too fast.

I have also tried Pulse Audio and OSS to no avail. Have also tried other Linux Distros.

Anyone any ideas? Maybe I'll try bouncing the laptop off the floor a couple of times....

Cheers!,
~G
Reply
#2
Smile 
UPDATE 1:
Well, I fixed the flash audio setup. As I had been playing with OSS and PulseAudio I had installed additional plugins to support them in Flash (OSS one is in the package manager, Pulse Audio I downloaded off t'internet). Uninstalled the first and manually uninstalled the latter (wiped the so from /usr/lib and ldconfig).

So... now my only problem is back in the land of XBMC and the too fast/cannot initialise problems. Shall report back but I'm fairly certain I'm getting there messing with asoundrc.

Cheers,
~G
Reply
#3
k, lets keep it simple. Uninstall PulseAudio, and OSS. They will only add to the confusion and complexity of the setup. Once you get alsa working and don't have to mess with it in order to get all applications working then you should able to install pulseaudio without complications. However, for a media center PC you shouldn't need pulseaudio because typically there is only one application using the audio device at any given time anyway.

A thing to keep in mind about the alsa audio device, only one application has the right to use it at any given time. Unless the default device is set to use dmix you're not going to hear any audio from applications that don't have rights to us it.

Given the example: boot up into Gnome, load XBMC, load Web Browser. You won't hear anything from the Web Browser because XBMC has the audio device. Given this scenario you must exit XBMC, exit Web Browser, and then load the Web Browser again for the browser to have the audio device.

Typically browsers don't have an area to assign the audio device to use, this is done usually by the authority of the desktop enivronment, IE Gnome, KDE, Xfce.

Another useful application I haven't seen mentioned here is asoundconf. It allows an easy method to set the default audio card for alsa to use.

Another useful application is speaker-test. An example of it's use is
Code:
speaker-test -c 6

Additionally make sure when you're testing sound you're testing as a user and not root.

In regards to the chipmunk thing that is likely as a result of a frequency difference in the source material, and the playback going to your receiver. It's not that it's playing too fast though it seems this way. It's just that the frequency has been modulated to the frequency that your receiver is expecting. Most sources are 44khz, but most High Def stuff and most likely your optical audio is set to output at 48khz.

The best practice that i've found so far is to install the OS, screw around with stuff until it works. Find out what worked, and then reinstall the OS, and then just do what worked. That way you don't have a lot of uninstalled, installed unneeded apps all over the place.

Additionally you can start with an already slimmed down OS like Mythbuntu, which already doesn't have PulseAudio installed.
Reply
#4
Thanks Maxim.

I'm pretty sure I've "cleaned up" after myself as it were... and everything is going via ALSA. I had noticed that only one application can have the audio device. I can live with that, and have been testing programs in isolation (i.e., nowt else running).

Currently, then, I have sound going to optical out and works for:
- Operating System Sounds
- Flash sound via FireFox
- XBMC Sound (menu/navigation)
- XBMC Sound (Music)
- XBMC Sound Video - some sources fine, others chipmunks!

So I concur there's some rate problem here. Though I've tried changing the rate to 44100 in asoundrc to no avail... Have only been testing as user not root, as, well, root account won't be picking up the asoundrc.

Onwards... Tried the sound-test as you suggested. All fine. Info:

Code:
Playback device is default
Stream parameters are 48000Hz, S16_LE, 6 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 64 to 16384
Period size range from 32 to 8192
Using max buffer size 16384
Periods = 4
was set period_size = 4096
was set buffer_size = 16384

Took some of the above and tried whacking into asoundrc, no joy. On the plus side, I did realise I don't have to keep rebooting!

Code:
sudo /etc/init.d/alsa-utils restart

If I try putting any format indicators in my asoundrc (e.g. S16_LE or whatever) - speaker test will no longer run, it's not a valid value for the PCM section in my asoundrc....

Code:
pcm.!default {
        type plug
        slave.pcm "cards.pcm.iec958"
        slave {
                pcm "cards.pcm.iec958"
        }
}

* scratches head somemore! *

Thanks again for your help...

Cheers,
~G
Reply
#5
SOLVED!!! As per this thread: http://forum.xbmc.org/showthread.php?tid=53159

I changed the audio device from iec958 to plug:iec958 and all is well! Whoooooooo!

Cheers,
~G
Reply

Logout Mark Read Team Forum Stats Members Help
Crawling the Linux walls (with some success!)0