mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.21k stars 572 forks source link

Latest Version on the Debian Archive #688

Closed biocross closed 6 years ago

biocross commented 6 years ago

Hey @mikebrady,

First of all, thank you so much for this great piece of software! I have got it up an running on my C.H.I.P with my Bose Companion 5 Speakers.

It sounds awesome, except that it stops playing for a few seconds every 10-15 seconds or so.

Before troubleshooting the issue further, I checked the version I had installed using the -V flag, and it printed out the following:

2.8.6-OpenSSL-Avahi-ALSA-pulse-dummy-stdout-pipe-soxr-metadata-sysconfdir:/etc

I'm pretty sure, the latest stable version is 3.1.7, so I ran apt-get update and upgrade for shairport-sync, but it says it's already at the latest version.

I don't know how the debian archives work (linux n00b here), but any chance you might have missed publishing the latest releases to the archives?

mikebrady commented 6 years ago

Thanks for the post. Updating on Debian can take some time, I’m afraid, so it could easily be that 2.8.6 is the latest one there. There have been many important bug fixes since 2.8.6, and indeed there have been more important bug fixes since 3.1.7 — 3.2 is nearly ready to release. Would you consider building the application yourself?

biocross commented 6 years ago

Hey! So yeah, I ended up building it myself, and upgraded all the way to 3.2RC4.

Just that, now, the audio is worse. Now when I Airplay, I get about 20 seconds of crystal clear audio, and post that it just completely breaks down, with either no sound, or little bits of audio intermittently every few seconds.

I checked the CPU usage using top, and it's a little under 15%.

Any steps I can take to improve this? Maybe things that can increase the CPU load, but make it work better?

mikebrady commented 6 years ago

Good job. RC4 has all the fixes and improvements. What would not be great is if you could edit the configuration file so that the log verbosity is set to 2 and then restart Shairport Sync and try to play some material for maybe a minute. Then, in the log, you’ll get a lot of Shairport Sync entries. If you could post them here, we could get an idea of what might be happening. BTW, what are you playing from — is It an iOS device or iTunes? (Also, I should say that I have it running well on a C.H.I.P.)

mikebrady commented 6 years ago

One quick thing is that maybe the WiFi on your C.H.I.P. Is dropping back to low power mode after a short time, causing communication faults. Have a look at the troubleshooting page for some information on ensuring the WiFi chip does not go into low power mode.

biocross commented 6 years ago

Great, so looks like my wifi power_save was getting turn on every boot, so I disabled it permanently, and the performance has considerably improved!

Now I can listen to almost 1-2 mins of audio before it breaks down. Also, it seems to recovering at times from the breakdown.

Here's the log you requested: verbose2_logs.txt

Additional Info: I'm streaming from my iPhone X, using the Spotify app. Also, when the audio breaks down, changing the song mostly fixes it, temporarily.

mikebrady commented 6 years ago

That's progress, certainly. I see that your output device is "plughw:1". That means it's not a real hardware sound card, but rather a software-mediated device of some kind. Shairport Sync really relies on good timing information coming directly from a real output device, and I simply do not know (and don't really trust) these virtual devices. Using alsamixer on my C.H.I.P., I can see that there is indeed a real hardware device at hw:0 and it has a mixer called Power Amplifier, so my alsa settings are:

alsa = {
  output_device = "hw:0"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
  mixer_control_name = "Power Amplifier"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
// all the other settings are commented out
};

Could you try it and see what happens please?

biocross commented 6 years ago

Sure thing. So, I'm using my CHIP to output to my Bose Companion 5 Speakers using USB.

Due to my lack of knowledge in setting up audio interfaces in linux, I did quite a bit of trial and error before I could finally get sound out of these via USB.

The output of aplay and amixer doesn't make much sense to me, so I'm attaching the output of amixer, aplay -l & aplay -L for you here:

outputs.txt

Maybe it makes way more sense to you as to which device I should be using in the Shairport Configuration?

biocross commented 6 years ago

Also, when I do select hw:1 in Shairport config and play music to it, I get the following error:

screen shot 2018-04-23 at 7 41 26 pm

mikebrady commented 6 years ago

Thanks for this. You should try hw:0 rather than hw:1.

biocross commented 6 years ago

Setting it to hw:0 outputs to the 3.5mm jack on the CHIP, instead of my speakers. The speakers are connected to the CHIP via USB, and I want to output to them :)

mikebrady commented 6 years ago

Oops -- apologies. This is interesting.

Your first log indicated that the output device you were using was "plughw:1". That means that Shairport Sync's output was being sent to the ALSA subsystem where it was being converted (possibly transcoded), in software, for output to hw:1, the Bose USB device. Now, when you try to direct the audio directly to hw:1, an error occurs. It seems to imply to me that the Bose USB device is not capable of accepting what Shairport Sync outputs -- CD-quality: 2-channel interleaved signed 16-bit little-endian inputs at 44,100 frames per second, but that ALSA is (nominally) able to translate. My guess is that the load that translating the audio is eventually overloading the CPU, and it bogs down and gives up.

Do you have any more information about the Bose USB device? For example, model or part number?

mikebrady commented 6 years ago

I had a quick look on the internet and there has been some discussion about getting the Bose Companion 5 USB recognised and used.

This page might help if you want to do a bit of detective work on the card. It looks like it could help you figure out the capabilities of the USB interface.

biocross commented 6 years ago

Thanks for the pointers! Will get back to you when I have something. Closing this issue for now :)

mikebrady commented 6 years ago

Great, thanks.