Killerbee
Posts: 62
Joined: Tue Sep 20, 2011 6:38 pm

Almost there. Need some help on audio!

Sun Aug 19, 2012 7:32 am

My perfect setup is almost finisched. I have only two issue.

My set-up is like this.
I have two Pi's (lucky me :) )

One Pi is running owncloud (apache/sqllite/php/php-apc), SAMBA, and the logitech mediaserver. A large USB disk is connected and running Raspbian (PISCES) from the beginning . Thanks Mike.

My second Pi is running Xbian and squeezeslave. Connected to my TV and amp. Os is Xbian Thanks Koen. I configured Xbian in such way that a dummy screensaver is kicking in after one minute. CPU usages drops to 30% so enough CPU power available for squeezeslave to listen to my favorite music.

My first issue is how to force squeezeslave to use the analog output and XBMC use the HDMI audio output! Squuezeslave is used to listen to the internet radio stations and connected to my amp. XMBC is used to watch movies (off course) and audio should go to my TV. If I connect my pi to a monitor squuezeslave is using the analog output and in XBMC I am able to select HDMI audio output. But if I connect my pi to my Philips TV squeezeslave is using HDMI for audio.

My second issue is, and already discussed several times, but not in combination with squeezeslave, the "poping" when changing songs. Probably I need some help from dom on this one. It seems to occur only on heavy load.

Could somebody help me out?

castalla
Posts: 558
Joined: Thu Jul 19, 2012 3:46 pm

Re: Almost there. Need some help on audio!

Sun Aug 19, 2012 9:35 am

Have you done rpi-update? Popping disappeared for me after using this.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5501
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Almost there. Need some help on audio!

Sun Aug 19, 2012 9:43 am

Killerbee wrote: My first issue is how to force squeezeslave to use the analog output and XBMC use the HDMI audio output! Squuezeslave is used to listen to the internet radio stations and connected to my amp. XMBC is used to watch movies (off course) and audio should go to my TV. If I connect my pi to a monitor squuezeslave is using the analog output and in XBMC I am able to select HDMI audio output. But if I connect my pi to my Philips TV squeezeslave is using HDMI for audio.
Not tried this, but xbmc uses openMAX and squeezeslave uses ALSA, so they can probably be set to different outputs. You can try:

Code: Select all

sudo amixer cset numid=1
(see http://elinux.org/R-Pi_Troubleshooting#Sound)
Killerbee wrote: My second issue is, and already discussed several times, but not in combination with squeezeslave, the "poping" when changing songs. Probably I need some help from dom on this one. It seems to occur only on heavy load.
My best guess is the interrupt latency (mostly caused by the sdcard) causes audio underruns, and that produces popping. Firstly update your firmware (with rpi-update) and confirm it still happens.
There is some experimental code that reduces sdcard latency. Add the following to /boot/cmdline.txt

Code: Select all

sdhci-bcm2708.sync_after_dma=0 sdhci-bcm2708.missing_status=0
and see if it makes a difference.

Note: this only seems to work with some sdcards, so make a sdcard backup first, in case there are problems.

Killerbee
Posts: 62
Joined: Tue Sep 20, 2011 6:38 pm

Re: Almost there. Need some help on audio!

Mon Aug 20, 2012 7:30 pm

There is some experimental code that reduces sdcard latency. Add the following to /boot/cmdline.txt

Code: Select all

sdhci-bcm2708.sync_after_dma=0 sdhci-bcm2708.missing_status=0
Xbian doesn't have a cmdline.txt file so I created one. During boot I get a kernel panic. "Cannot mount root filesystem".
So what should be the "full command line"?

Thanks in advance

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5501
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Almost there. Need some help on audio!

Mon Aug 20, 2012 8:00 pm

Killerbee wrote: Xbian doesn't have a cmdline.txt file so I created one. During boot I get a kernel panic. "Cannot mount root filesystem".
So what should be the "full command line"?
If there is no cmdline.txt, this is the default used:

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait

Killerbee
Posts: 62
Joined: Tue Sep 20, 2011 6:38 pm

Re: Almost there. Need some help on audio!

Mon Aug 20, 2012 9:43 pm

dom wrote:
Killerbee wrote: Xbian doesn't have a cmdline.txt file so I created one. During boot I get a kernel panic. "Cannot mount root filesystem".
So what should be the "full command line"?
If there is no cmdline.txt, this is the default used:

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
Ok I am able to boot now but the result is even worse.
This is what I did.
1) rpi-update and reboot
2) XBMC didn't start (the message was something like " service wont start....." )
3) Run rpi-update 192 reboot
4) XBMC started and poping was alot more.
4) Boot my pi with the cmdline.txt file including your suggestion and reboot
5) Poping was still there and worse than before step 1).

checked if cmdline.txt was used using cat /proc/cmdline

Code: Select all

dma.dmachans=0x3c bcm2708_fb.fbwidth=1280 bcm2708_fb.fbheight=1024 bcm2708.boardrev=0x2 bcm2708.serial=0xexxxxxxx smsc95xx.macaddr=XX:XX:XX:XX:XX:XX dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait sdhci-bcm2708.sync_after_dma=0 sdhci-bcm2708.missing_status=0
looks ok to me

Do you have any suggestion?
Thanks in advance

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5501
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Almost there. Need some help on audio!

Mon Aug 20, 2012 10:22 pm

You should use the 128M split for xbmc.
If you remove sync_after_dma or missing_status, does it behave any differently?
Try
kernel=kernel_cutdown.img
In config.txt

Killerbee
Posts: 62
Joined: Tue Sep 20, 2011 6:38 pm

Re: Almost there. Need some help on audio!

Thu Aug 23, 2012 5:47 pm

dom wrote:You should use the 128M split for xbmc.
If you remove sync_after_dma or missing_status, does it behave any differently?
Try
kernel=kernel_cutdown.img
In config.txt
Thanks dom and sorry for my late response.

This is what I did today.
run rpi-update 128 => new kernel: Linux XBian 3.2.27+ #58 PREEMPT Thu Aug 23 15:23:36 BST 2012 armv6l GNU/Linux
-.- Side effect my logitech K400 doesn't work anymore. This was also the case with Xbian 0.60. As far as I know version 0.60 was using the 3.2 kernel as well. In 3.1.9+ keyboard is working.
-.- Popping is still bad

I Removed the sync_after_dma or missing_status
-.- I could not hear any difference. Still popping

I added the -y200 (buffer) argument for squuezeslave

Code: Select all

-y, --latency <msec>        Modify the default latency for the audio device.
                            Useful if you experience drop outs during playback.
                            Values between 80-200 ms are recommended.
-.- Popping was a bit less. So some improvement
-.- Popping only when skip to next or previous song. Between two songs no popping :)

With the cutdown kernel I was not able to start squeezeslave. squeezeslave log showed me the next message:

Code: Select all

PortAudio error7: No output devices found.
Conclusion "stock xbian 0.6.2" (with the -y200 option) has the best results so far :)

Do you have another suggestion?

Thanks
KB

sgraham
Posts: 5
Joined: Wed Aug 15, 2012 11:24 am

Re: Almost there. Need some help on audio!

Fri Aug 24, 2012 6:29 am

I noticed that the popping occurs more frequently when the RPi is under load. I was listening to SqueezeSlave while running 'apt-get update' and the audio popped quite frequently, but when the update completed, the popping stopped and now it's only popping when skipping between tracks.

I have no idea how to do it yet, but I'd suggest configuring/recompiling SqueezeSlave to have a larger audio buffer.

User avatar
bigdavethehorn
Posts: 56
Joined: Thu Jan 19, 2012 8:46 pm
Location: Scotland

Re: Almost there. Need some help on audio!

Tue Aug 28, 2012 7:30 pm

Killerbee wrote:I configured Xbian in such way that a dummy screensaver is kicking in after one minute. CPU usages drops to 30% so enough CPU power available for squeezeslave to listen to my favorite music.
This sounds like a good idea, how did you setup a dummy screensaver?

Killerbee
Posts: 62
Joined: Tue Sep 20, 2011 6:38 pm

Re: Almost there. Need some help on audio!

Wed Aug 29, 2012 7:55 pm

bigdavethehorn wrote:
Killerbee wrote:I configured Xbian in such way that a dummy screensaver is kicking in after one minute. CPU usages drops to 30% so enough CPU power available for squeezeslave to listen to my favorite music.
This sounds like a good idea, how did you setup a dummy screensaver?
I just selected Plasma. The Plasma didn't work on the PI so I just see a black screen :) CPU goes down to 30%

elcado
Posts: 2
Joined: Thu Sep 20, 2012 12:31 pm

Re: Almost there. Need some help on audio!

Mon Oct 08, 2012 6:46 pm

Killerbee wrote:[...] My first issue is how to force squeezeslave to use the analog output and XBMC use the HDMI audio output! Squuezeslave is used to listen to the internet radio stations and connected to my amp. XMBC is used to watch movies (off course) and audio should go to my TV. If I connect my pi to a monitor squuezeslave is using the analog output and in XBMC I am able to select HDMI audio output. But if I connect my pi to my Philips TV squeezeslave is using HDMI for audio.[...]
Hi,

i'm really interested in knowing if you found a way to have XBian on the HDMI output while having squeezeslave on the analog one !

Can you give us some feedback on this, please ?

Cad

vik
Posts: 5
Joined: Sat Oct 13, 2012 1:12 am

Re: Almost there. Need some help on audio!

Sat Oct 13, 2012 1:46 am

The command to specify using the analog output should be:

Code: Select all

sudo amixer cset numid=3 1
and not numid=1 as said earlier (numid=1 sets the volume, numid=3 sets the playback route, which then would need to be specified)

In any case, I'm having trouble getting both squeezeslave and xbmc working together - my requirements are much like OP. I'm finding I can either get squeezeslave running, or xbmc, but once I've run one of them (then stopped playback) try to run the other causes things to freeze up.

I understand that xbmc uses OMXPlayer, which talks to the audio hardware at a low level, while squeezeplayer uses ALSA (a slightly higher level). I don't even know if mixing is possible between these two - I'm guessing that would have to happen at a hardware level - is the audio hardware capable of mixing? However, mixing isn't in itself necessary, just switching from one to the other, but that still seems to cause problems.

elcado
Posts: 2
Joined: Thu Sep 20, 2012 12:31 pm

Re: Almost there. Need some help on audio!

Sat Oct 13, 2012 9:53 am

Hi,

I've made an interesting test...

Running XBian 0.8, I configured XBMC to output audio through the analog output. Separately, I installed squeezeslave directly (not with the XSqueeze plugin) and also configured it to output through the analog output with

Code: Select all

sudo amixer cset numid=3 1
as stated early in the thread.

And... tadada! I can have music and video playback at the same, with the audio mixing through the analog output.

Of course, if your video setup needs audio on the HDMI, it won't help you, but in my case (everything is connected to a home theater receiver which outputs to a stereo setup), it's great !

Return to “Graphics, sound and multimedia”