Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem]: Using Docker inside a Proxmox VM -- bad sound quality when using non-default output device. #1833

Open
1 of 2 tasks
iko3 opened this issue Mar 25, 2024 · 18 comments

Comments

@iko3
Copy link

iko3 commented Mar 25, 2024

What happened?

Hi, I installed Shairport-sync in docker container and configured it to use alsa "default" output device.
I have one physical USB-sound card which is listed under different names when I run aplay -L
When I specify any other name for same physical output device, sound quality gets really bad and I hear lots of crackling.

Relevant log output

root@docker:~/airplay-1# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default
    Default Audio Device
sysdefault
    Default Audio Device
lavrate
    Rate Converter Plugin Using Libav/FFmpeg Library
samplerate
    Rate Converter Plugin Using Samplerate Library
speexrate
    Rate Converter Plugin Using Speex Resampler
jack
    JACK Audio Connection Kit
oss
    Open Sound System
pulse
    PulseAudio Sound Server
speex
    Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
    Plugin for channel upmix (4,6,8)
vdownmix
    Plugin for channel downmix (stereo) with a simple spacialization
hw:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    Direct hardware device without any conversions
plughw:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    Hardware device with all software conversions
default:CARD=S3
    Sound Blaster Play! 3, USB Audio
    Default Audio Device
sysdefault:CARD=S3
    Sound Blaster Play! 3, USB Audio
    Default Audio Device
front:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    Front output / input
surround21:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=S3,DEV=0
    Sound Blaster Play! 3, USB Audio
    Direct sample mixing device
usbstream:CARD=S3
    Sound Blaster Play! 3
    USB Stream Output

System Information.

Intel i5 with ProxMox
Running Shairport-Sync as docker container in Debian Bookworm VM.

Configuration Information.

# shairport-sync --displayConfig
>> Display Config Start.

From "uname -a":
 Linux docker 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 Linux

From /etc/os-release:
 Alpine Linux v3.17

Shairport Sync Version String:
 4.3.2-2-g165431a8-dirty-AirPlay2-smi10-alac-OpenSSL-Avahi-ALSA-pa-dummy-stdout-pipe-soxr-convolution-metadata-mqtt-dbus-mpris-sysconfdir:/etc

Command Line:
 shairport-sync --displayConfig

Configuration File:
 /etc/shairport-sync.conf

Configuration File Settings:
 general : 
 {
   name = "Bathroom";
   port = 6001;
 };
 alsa : 
 {
   output_device = "default";
 };
 mqtt : 
 {
   enabled = "yes";
   hostname = "192.168.1.32";
   port = 1883;
   username = "airplay";
   password = "airplay";
   topic = "airplay/bathroom";
   publish_parsed = "yes";
 };

>> Display Config End.
>> Goodbye!

PulseAudio or PipeWire installed?

  • Check if your system uses a Sound Server.

How did you install Shairport Sync?

Docker

Check previous issues

  • Confirm
@mikebrady
Copy link
Owner

Thanks for the post. I'm just wondering if there's a possibility that the hardware output device is not capable of working at 44,100 frames per second.

There is a tool called sps-alsa-explore (also available a a Docker image) that will give you some more information about what output devices are available that are compatible with Shairport Sync. It could be worth trying out.

@iko3
Copy link
Author

iko3 commented Mar 25, 2024

I'll try the tool, but I'm wondering if my USB sound card is not capable of working at 44,100 fps then it should behave same way when I refer to it as "default" output device?

@mikebrady
Copy link
Owner

Ah, sorry, should have explained a bit more. The "default" device probably includes a transcoder that could transcode from Shairport Sync's 44,100 to the output device's 48,000 fps, whereas going directly to the output device bypasses the transcoding. But we're getting ahead of ourselves.

@iko3
Copy link
Author

iko3 commented Mar 25, 2024

Here is the output from sps-alsa-explore:

 Device Full Name:    "hw:S3"
  Short Name:          "hw:0"
  This device seems suitable for use with Shairport Sync.
  Possible mixers:     "Speaker",0             Range:  44.00 dB
                       "Mic",0                 Range:  37.00 dB
  The following rate and format would be chosen by Shairport Sync in "auto" mode:
     Rate              Format
     44100             S24_3LE

@iko3
Copy link
Author

iko3 commented Mar 25, 2024

thank you for explanation, it makes sense now :)

Ah, sorry, should have explained a bit more. The "default" device probably includes a transcoder that could transcode from Shairport Sync's 44,100 to the output device's 48,000 fps, whereas going directly to the output device bypasses the transcoding. But we're getting ahead of ourselves.

@mikebrady
Copy link
Owner

Super (just edited it for formatting). That looks good, so no transcoding problems there.

Ensuring that Shairport Sync isn't running in the background, could you run, from the command line, something like:

$ shairport-sync -v --statistics -- -d hw:0

and let it run through the unpleasantness for a short while, and the post the log, please? Note that after --statistics that is a double dash...

@mikebrady
Copy link
Owner

Also, is anything else using the output device? Any other audio program or utility?

@iko3
Copy link
Author

iko3 commented Mar 25, 2024

No, I don't think it is being used by anything else. It is mounted only to one VM and I have only one container running there.

Below is the output from $ shairport-sync -v --statistics -- -d hw:0

/ # shairport-sync -v --statistics -- -d hw:0
         0.000358084 "shairport.c:2252" Startup in AirPlay 2 mode, with features 0x405fca00,0x1c340 on device "bc:24:11:57:50:37".
         0.000626174 "shairport.c:2291" Version String: "4.3.2-2-g165431a8-dirty-AirPlay2-smi10-alac-OpenSSL-Avahi-ALSA-pa-dummy-stdout-pipe-soxr-convolution-metadata-mqtt-dbus-mpris-sysconfdir:/etc"
         0.000410239 "shairport.c:2310" Command Line: "shairport-sync -v --statistics -- -d hw:0".
         0.000708337 "shairport.c:2346" Log Verbosity is 1.
         0.000371690 "audio_alsa.c:1021" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000603783 "audio_alsa.c:1310" alsa: disable_standby_mode is "never".
         0.000398590 "audio_alsa.c:1314" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000544208 "audio_alsa.c:1316" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000538483 "audio_alsa.c:1356" alsa: output device name is "hw:0".
         0.000470065 "shairport.c:2394" disable_resend_requests is off.
         0.000475284 "shairport.c:2395" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000487073 "shairport.c:2399" statistics_requester status is 1.
         0.000397554 "shairport.c:2404" rtsp listening port is 6001.
         0.000750325 "shairport.c:2405" udp base port is 6001.
         0.000471477 "shairport.c:2406" udp port range is 10.
         0.000389819 "shairport.c:2407" player name is "Bathroom".
         0.000419975 "shairport.c:2408" backend is "alsa".
         0.000390791 "shairport.c:2409" run_this_before_play_begins action is "(null)".
         0.000311665 "shairport.c:2410" run_this_after_play_ends action is "(null)".
         0.000353035 "shairport.c:2411" wait-cmd status is 0.
         0.000402239 "shairport.c:2412" run_this_before_play_begins may return output is 0.
         0.000318731 "shairport.c:2413" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000334453 "shairport.c:2415" run_this_before_entering_active_state action is  "(null)".
         0.000400479 "shairport.c:2417" run_this_after_exiting_active_state action is  "(null)".
         0.000967088 "shairport.c:2419" active_state_timeout is  10.000000 seconds.
         0.000757063 "shairport.c:2420" mdns backend "(null)".
         0.000427743 "shairport.c:2422" interpolation setting is "auto".
         0.000389481 "shairport.c:2426" interpolation soxr_delay_threshold is 30000000.
         0.000551830 "shairport.c:2427" resync time is 0.050000 seconds.
         0.000453138 "shairport.c:2428" resync recovery time is 0.100000 seconds.
         0.000603326 "shairport.c:2429" allow a session to be interrupted: 0.
         0.000454798 "shairport.c:2430" busy timeout time is 0.
         0.000191769 "shairport.c:2431" drift tolerance is 0.002000 seconds.
         0.000375941 "shairport.c:2432" password is "(null)".
         0.000568245 "shairport.c:2433" default airplay volume is: -24.000000.
         0.000380298 "shairport.c:2434" high threshold airplay volume is: -16.000000.
         0.000655309 "shairport.c:2436" check for higher-than-threshold volume for new play session is disabled.
         0.000373412 "shairport.c:2442" ignore_volume_control is 0.
         0.000366691 "shairport.c:2446" volume_max_db is not set
         0.000437926 "shairport.c:2447" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000027909 "shairport.c:2449" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000012125 "shairport.c:2453" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000025136 "shairport.c:2455" disable_synchronization is 0.
         0.000194508 "shairport.c:2456" use_mmap_if_available is 1.
         0.000011714 "shairport.c:2457" output_format automatic selection is enabled.
         0.000268625 "shairport.c:2461" output_rate automatic selection is enabled.
         0.000016606 "shairport.c:2465" audio backend desired buffer length is 0.200000 seconds.
         0.000012208 "shairport.c:2467" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000012183 "shairport.c:2469" audio backend latency offset is 0.000000 seconds.
         0.000027818 "shairport.c:2471" audio backend silence lead-in time is "auto".
         0.000011119 "shairport.c:2475" zeroconf regtype is "_raop._tcp".
         0.000009540 "shairport.c:2476" decoders_supported field is 3.
         0.000009171 "shairport.c:2477" use_apple_decoder is 1.
         0.000251545 "shairport.c:2478" alsa_use_hardware_mute is 0.
         0.000160339 "shairport.c:2482" no special mdns service interface was requested.
         0.000463957 "shairport.c:2485" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000566362 "shairport.c:2492" metadata enabled is 1.
         0.000261162 "shairport.c:2493" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000094714 "shairport.c:2494" metadata socket address is "(null)" port 0.
         0.000015382 "shairport.c:2496" metadata socket packet size is "500".
         0.000009729 "shairport.c:2497" get-coverart is 1.
         0.000009114 "shairport.c:2500" mqtt is enabled.
         0.000008958 "shairport.c:2501" mqtt hostname is 192.168.1.32, port is 1883.
         0.000313614 "shairport.c:2502" mqtt topic is airplay/bathroom.
         0.000213877 "shairport.c:2503" mqtt will not publish raw metadata.
         0.000206396 "shairport.c:2504" mqtt will publish parsed metadata.
         0.000011855 "shairport.c:2505" mqtt will not publish cover Art.
         0.000009117 "shairport.c:2506" mqtt remote control is disabled.
         0.000295511 "shairport.c:2510" convolution is 0.
         0.000014613 "shairport.c:2511" convolution IR file is "(null)"
         0.000009645 "shairport.c:2512" convolution max length 8192
         0.000009034 "shairport.c:2513" convolution gain is 0.000000
         0.000246045 "shairport.c:2515" loudness is 0.
         0.000026603 "shairport.c:2516" loudness reference level is -20.000000
         0.000086262 "rtsp.c:4193" metadata pipe name is "/tmp/shairport-sync-metadata".
         0.001418892 "mqtt.c:252" Initialising MQTT
         0.003145791 "shairport.c:2643" NQPTP is online.
         0.002704450 "rtsp.c:5504" unable to listen on IPv4 port 6001. The error is: "Address in use".
         0.001328219 "rtsp.c:5504" unable to listen on IPv6 port 6001. The error is: "Address in use".
         0.001289730 "rtsp.c:5695" *warning: could not establish a service on port 6001 -- program terminating. Is another instance of Shairport Sync running on this device?
         0.000508086 "rtsp.c:5699" Oops -- fell out of the RTSP select loop
Segmentation fault (core dumped)

@mikebrady
Copy link
Owner

Thanks. The log seems to show that it's listening on port 6001 instead of the default port 7000. Could you try a different port, or leave it at default for the present? (Try to avoid ports in the range 6001 -- 6010.)

@mikebrady
Copy link
Owner

(I shoulda seen that 6001 thing earlier, sorry.)

@iko3
Copy link
Author

iko3 commented Mar 25, 2024

tried with port 7000, still hearing crackling

/ # shairport-sync -v --statistics -- -d hw:0
         0.000284122 "shairport.c:2252" Startup in AirPlay 2 mode, with features 0x405fca00,0x1c340 on device "bc:24:11:57:50:37".
         0.000777036 "shairport.c:2291" Version String: "4.3.2-2-g165431a8-dirty-AirPlay2-smi10-alac-OpenSSL-Avahi-ALSA-pa-dummy-stdout-pipe-soxr-convolution-metadata-mqtt-dbus-mpris-sysconfdir:/etc"
         0.000499925 "shairport.c:2310" Command Line: "shairport-sync -v --statistics -- -d hw:0".
         0.000607968 "shairport.c:2346" Log Verbosity is 1.
         0.000434991 "audio_alsa.c:1021" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000597867 "audio_alsa.c:1310" alsa: disable_standby_mode is "never".
         0.000441954 "audio_alsa.c:1314" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000494167 "audio_alsa.c:1316" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000554716 "audio_alsa.c:1356" alsa: output device name is "hw:0".
         0.000825342 "shairport.c:2394" disable_resend_requests is off.
         0.000734850 "shairport.c:2395" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000577166 "shairport.c:2399" statistics_requester status is 1.
         0.000496948 "shairport.c:2404" rtsp listening port is 7000.
         0.000571736 "shairport.c:2405" udp base port is 6001.
         0.000391193 "shairport.c:2406" udp port range is 10.
         0.000575463 "shairport.c:2407" player name is "Bathroom".
         0.000555135 "shairport.c:2408" backend is "alsa".
         0.000449359 "shairport.c:2409" run_this_before_play_begins action is "(null)".
         0.000435116 "shairport.c:2410" run_this_after_play_ends action is "(null)".
         0.000224259 "shairport.c:2411" wait-cmd status is 0.
         0.000473762 "shairport.c:2412" run_this_before_play_begins may return output is 0.
         0.000521897 "shairport.c:2413" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000421169 "shairport.c:2415" run_this_before_entering_active_state action is  "(null)".
         0.000488438 "shairport.c:2417" run_this_after_exiting_active_state action is  "(null)".
         0.000629175 "shairport.c:2419" active_state_timeout is  10.000000 seconds.
         0.000272190 "shairport.c:2420" mdns backend "(null)".
         0.000070980 "shairport.c:2422" interpolation setting is "auto".
         0.000066139 "shairport.c:2426" interpolation soxr_delay_threshold is 30000000.
         0.000084141 "shairport.c:2427" resync time is 0.050000 seconds.
         0.000345675 "shairport.c:2428" resync recovery time is 0.100000 seconds.
         0.000099367 "shairport.c:2429" allow a session to be interrupted: 0.
         0.000324519 "shairport.c:2430" busy timeout time is 0.
         0.000062260 "shairport.c:2431" drift tolerance is 0.002000 seconds.
         0.000258376 "shairport.c:2432" password is "(null)".
         0.000134448 "shairport.c:2433" default airplay volume is: -24.000000.
         0.000068198 "shairport.c:2434" high threshold airplay volume is: -16.000000.
         0.000068433 "shairport.c:2436" check for higher-than-threshold volume for new play session is disabled.
         0.000042577 "shairport.c:2442" ignore_volume_control is 0.
         0.000010418 "shairport.c:2446" volume_max_db is not set
         0.000251109 "shairport.c:2447" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000016126 "shairport.c:2449" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000011748 "shairport.c:2453" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000011295 "shairport.c:2455" disable_synchronization is 0.
         0.000009193 "shairport.c:2456" use_mmap_if_available is 1.
         0.000009004 "shairport.c:2457" output_format automatic selection is enabled.
         0.000047532 "shairport.c:2461" output_rate automatic selection is enabled.
         0.000351437 "shairport.c:2465" audio backend desired buffer length is 0.200000 seconds.
         0.000016156 "shairport.c:2467" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000012669 "shairport.c:2469" audio backend latency offset is 0.000000 seconds.
         0.000011294 "shairport.c:2471" audio backend silence lead-in time is "auto".
         0.000010786 "shairport.c:2475" zeroconf regtype is "_raop._tcp".
         0.000009562 "shairport.c:2476" decoders_supported field is 3.
         0.000034156 "shairport.c:2477" use_apple_decoder is 1.
         0.000010101 "shairport.c:2478" alsa_use_hardware_mute is 0.
         0.000155550 "shairport.c:2482" no special mdns service interface was requested.
         0.000299825 "shairport.c:2485" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000015993 "shairport.c:2492" metadata enabled is 1.
         0.000041755 "shairport.c:2493" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000012587 "shairport.c:2494" metadata socket address is "(null)" port 0.
         0.000011298 "shairport.c:2496" metadata socket packet size is "500".
         0.000124541 "shairport.c:2497" get-coverart is 1.
         0.000241015 "shairport.c:2500" mqtt is enabled.
         0.000011653 "shairport.c:2501" mqtt hostname is 192.168.1.32, port is 1883.
         0.000011961 "shairport.c:2502" mqtt topic is airplay/bathroom.
         0.000515608 "shairport.c:2503" mqtt will not publish raw metadata.
         0.000011980 "shairport.c:2504" mqtt will publish parsed metadata.
         0.000009252 "shairport.c:2505" mqtt will not publish cover Art.
         0.000008942 "shairport.c:2506" mqtt remote control is disabled.
         0.000023285 "shairport.c:2510" convolution is 0.
         0.000050508 "shairport.c:2511" convolution IR file is "(null)"
         0.000010600 "shairport.c:2512" convolution max length 8192
         0.000009118 "shairport.c:2513" convolution gain is 0.000000
         0.000009226 "shairport.c:2515" loudness is 0.
         0.000042645 "shairport.c:2516" loudness reference level is -20.000000
         0.000758833 "rtsp.c:4193" metadata pipe name is "/tmp/shairport-sync-metadata".
         0.001309503 "mqtt.c:252" Initialising MQTT
         0.002925387 "shairport.c:2643" NQPTP is online.
         0.003649951 "rtsp.c:5504" unable to listen on IPv4 port 7000. The error is: "Address in use".
         0.000746038 "rtsp.c:5504" unable to listen on IPv6 port 7000. The error is: "Address in use".
         0.000543579 "rtsp.c:5695" *warning: could not establish a service on port 7000 -- program terminating. Is another instance of Shairport Sync running on this device?
         0.000404528 "rtsp.c:5699" Oops -- fell out of the RTSP select loop
Segmentation fault (core dumped)

@mikebrady
Copy link
Owner

Thanks. The thing is, it looks as if there's another instance of Shairport Sync running somewhere in the background, possibly started automatically after startup, or possibly running in another window, so the log you are posting is not the log of the functioning Shairport Sync, and so is no use for debugging.

To stop an automatically-started version of Shairport Sync, do a $ sudo systemctl stop shairport-sync. Then try the command line again.

@iko3
Copy link
Author

iko3 commented Mar 25, 2024

I'm running Shairport Sync in docker container, I run shairport-sync -v --statistics -- -d hw:0 from inside of the container, its an official image so I think it should be fine

@mikebrady
Copy link
Owner

Just looking back over this -- are you running Shairport Sync inside Docker on a Linux system that's in a VMWare/VirtualBox/Parallels Virtual Machine?

@iko3
Copy link
Author

iko3 commented Mar 25, 2024

Yes, I'm using ProxMox

@mikebrady
Copy link
Owner

I'm running Shairport Sync in docker container, I run shairport-sync -v --statistics -- -d hw:0 from inside of the container, its an official image so I think it should be fine

Okay, so a copy of Shairport Sync is automatically launched when the Docker container comes up, so when you execute the command line inside the Docker image, that copy of Shairport Sync is already running. The problem now is that, if you kill it, the container will close.

So, if you could stop that Docker container completely and instead do this on the command line:

$ docker run --net host --device /dev/snd mikebrady/shairport-sync:latest -v --statistics -- -d hw:0

It should log the single copy of Shairport Sync that should be running. (Haven't tested it here though.)

@iko3
Copy link
Author

iko3 commented Mar 25, 2024

here is new output:

Starting shairport-sync
         0.001694283 "shairport.c:2252" Startup in AirPlay 2 mode, with features 0x405fca00,0x1c340 on device "bc:24:11:57:50:37".
         0.000653558 "shairport.c:2291" Version String: "4.3.2-2-g165431a8-dirty-AirPlay2-smi10-alac-OpenSSL-Avahi-ALSA-pa-dummy-stdout-pipe-soxr-convolution-metadata-mqtt-dbus-mpris-sysconfdir:/etc"
         0.000408600 "shairport.c:2310" Command Line: "/usr/local/bin/shairport-sync -v --statistics -- -d hw:0".
         0.000639976 "shairport.c:2346" Log Verbosity is 1.
         0.000246633 "audio_alsa.c:1021" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000445232 "audio_alsa.c:1310" alsa: disable_standby_mode is "never".
         0.000251389 "audio_alsa.c:1314" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000294246 "audio_alsa.c:1316" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000332746 "audio_alsa.c:1356" alsa: output device name is "hw:0".
         0.000385823 "shairport.c:2394" disable_resend_requests is off.
         0.000206710 "shairport.c:2395" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000434780 "shairport.c:2399" statistics_requester status is 1.
         0.000204835 "shairport.c:2404" rtsp listening port is 7000.
         0.000238366 "shairport.c:2405" udp base port is 6001.
         0.000202828 "shairport.c:2406" udp port range is 10.
         0.000245176 "shairport.c:2407" player name is "Docker".
         0.000217115 "shairport.c:2408" backend is "alsa".
         0.000272090 "shairport.c:2409" run_this_before_play_begins action is "(null)".
         0.000413724 "shairport.c:2410" run_this_after_play_ends action is "(null)".
         0.000345936 "shairport.c:2411" wait-cmd status is 0.
         0.000209671 "shairport.c:2412" run_this_before_play_begins may return output is 0.
         0.000383490 "shairport.c:2413" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000372678 "shairport.c:2415" run_this_before_entering_active_state action is  "(null)".
         0.000471762 "shairport.c:2417" run_this_after_exiting_active_state action is  "(null)".
         0.000423032 "shairport.c:2419" active_state_timeout is  10.000000 seconds.
         0.000374650 "shairport.c:2420" mdns backend "(null)".
         0.000208655 "shairport.c:2422" interpolation setting is "auto".
         0.000245563 "shairport.c:2426" interpolation soxr_delay_threshold is 30000000.
         0.000411363 "shairport.c:2427" resync time is 0.050000 seconds.
         0.000210411 "shairport.c:2428" resync recovery time is 0.100000 seconds.
         0.000386072 "shairport.c:2429" allow a session to be interrupted: 0.
         0.000187311 "shairport.c:2430" busy timeout time is 0.
         0.000163471 "shairport.c:2431" drift tolerance is 0.002000 seconds.
         0.000046798 "shairport.c:2432" password is "(null)".
         0.000166237 "shairport.c:2433" default airplay volume is: -24.000000.
         0.000190482 "shairport.c:2434" high threshold airplay volume is: -16.000000.
         0.000209549 "shairport.c:2436" check for higher-than-threshold volume for new play session is disabled.
         0.000049021 "shairport.c:2442" ignore_volume_control is 0.
         0.000018392 "shairport.c:2446" volume_max_db is not set
         0.000016736 "shairport.c:2447" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000044579 "shairport.c:2449" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000031010 "shairport.c:2453" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000045270 "shairport.c:2455" disable_synchronization is 0.
         0.000018023 "shairport.c:2456" use_mmap_if_available is 1.
         0.000016798 "shairport.c:2457" output_format automatic selection is enabled.
         0.000044819 "shairport.c:2461" output_rate automatic selection is enabled.
         0.000053341 "shairport.c:2465" audio backend desired buffer length is 0.200000 seconds.
         0.000612921 "shairport.c:2467" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000365384 "shairport.c:2469" audio backend latency offset is 0.000000 seconds.
         0.000149385 "shairport.c:2471" audio backend silence lead-in time is "auto".
         0.000061832 "shairport.c:2475" zeroconf regtype is "_raop._tcp".
         0.000019068 "shairport.c:2476" decoders_supported field is 3.
         0.000017874 "shairport.c:2477" use_apple_decoder is 1.
         0.000031239 "shairport.c:2478" alsa_use_hardware_mute is 0.
         0.000428722 "shairport.c:2482" no special mdns service interface was requested.
         0.000384944 "shairport.c:2485" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000374851 "shairport.c:2492" metadata enabled is 1.
         0.000053697 "shairport.c:2493" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000032852 "shairport.c:2494" metadata socket address is "(null)" port 0.
         0.000556160 "shairport.c:2496" metadata socket packet size is "500".
         0.000180133 "shairport.c:2497" get-coverart is 1.
         0.000190538 "shairport.c:2500" mqtt is disabled.
         0.000190160 "shairport.c:2501" mqtt hostname is (null), port is 1883.
         0.000201818 "shairport.c:2502" mqtt topic is /Docker.
         0.000229032 "shairport.c:2503" mqtt will not publish raw metadata.
         0.000188094 "shairport.c:2504" mqtt will not publish parsed metadata.
         0.000189206 "shairport.c:2505" mqtt will not publish cover Art.
         0.000183885 "shairport.c:2506" mqtt remote control is disabled.
         0.000211685 "shairport.c:2510" convolution is 0.
         0.000180239 "shairport.c:2511" convolution IR file is "(null)"
         0.000185388 "shairport.c:2512" convolution max length 8192
         0.000205826 "shairport.c:2513" convolution gain is 0.000000
         0.000059108 "shairport.c:2515" loudness is 0.
         0.000033489 "shairport.c:2516" loudness reference level is -20.000000
         0.000480548 "rtsp.c:4193" metadata pipe name is "/tmp/shairport-sync-metadata".
         0.001318956 "shairport.c:2643" NQPTP is online.
         0.007387937 "dbus-service.c:610" >> setting loudness threshold to -20.000000.
         0.000650858 "dbus-service.c:623" >> setting drift tolerance to 0.002000 seconds.
         0.000483747 "dbus-service.c:1021" >> ALACDecoder set to "apple"
         0.000275398 "dbus-service.c:1030" >> Active set to "false"
         0.000218778 "dbus-service.c:1035" >> disable standby mode set to "off"
         0.000266017 "dbus-service.c:1056" >> interpolation set to "auto" (soxr support built in)
         0.000463479 "dbus-service.c:518" >> deactivating disable standby
         0.000212198 "dbus-service.c:600" >> deactivating loudness
         0.000231981 "dbus-service.c:534" >> deactivating convolution
         0.000449646 "dbus-service.c:503" >> log verbosity set to 1.
         0.000323973 "dbus-service.c:483" >> start logging statistics
         0.000468356 "dbus-service.c:448" >> stop including elapsed time in logs
         0.000300523 "dbus-service.c:458" >> start including delta time in logs
         0.000401602 "dbus-service.c:471" >> start including file and line in logs
         0.000434612 "dbus-service.c:1175" Shairport Sync native D-Bus service started at "org.gnome.ShairportSync" on the system bus.
         0.001074560 "mpris-service.c:342" MPRIS service started at "org.mpris.MediaPlayer2.ShairportSync" on the system bus.
Service "docker" (/etc/avahi/services/ssh.service) successfully established.
Service "docker" (/etc/avahi/services/sftp-ssh.service) successfully established.
         1.488622442 "shairport.c:255" "soxr" interpolation has been chosen.
        16.287225417 "rtsp.c:2902" Connection 1: AP2 PTP connection from XXXXXXXXXXXXX:60248 ("Oleg’s iPhone 15 Pro") to self at XXXXXXXXXXXXXXX:7000.
         2.789283237 "rtsp.c:3258" Connection 1: SETUP AP2 no Active-Remote information  the SETUP Record.
         0.000637569 "rtsp.c:3277" Connection 1: SETUP AP2 doesn't include DACP-ID string information.
         0.327471532 "rtp.c:2490" Flush completed while play_enabled is true.
         0.327994419 "player.c:2835" Connection 1: Playback started at frame 257017700 -- AirPlay 2 Buffered.
         7.934896459 "player.c:2654" Sync Error ms | Net Sync PPM | All Sync PPM | Min DAC Queue | Min Buffers | Min Buffer Size | Output FPS (r) | Output FPS (c)
         0.000663752 "player.c:2654"          0.58          -40.1           51.5            7790            47              209k              N/A              N/A
         8.003409983 "player.c:2654"          0.11          -34.0           85.0            7821            48             1189k         44105.22         44105.88
         8.003748010 "player.c:2654"         -0.03           -8.5           53.8            7837            48             1354k         44102.54         44103.20
         8.005450617 "player.c:2654"          0.05          -11.3           56.6            7809            48             1223k         44095.78         44096.44
         8.008724149 "player.c:2654"         -0.03           -2.8           65.1            7830            48             1473k         44096.82         44097.49
        12.328280989 "player.c:1797" Connection 1: Playback stopped. Total playing time 00:00:52. Output: 44096.82 (raw), 44097.49 (corrected) frames per second.

@mikebrady
Copy link
Owner

Great stuff -- well done. Sadly (for the big picture) it indicates that Shairport Sync is working more-or-less normally. The interpolation needed to compensate for sync errors should be almost completely imperceptible.

However, the output FPS figures indicate that the accuracy of the clocking of the output device isn't great -- I'd expect the Output FPS (r) figure to be around 44100 ± 0.2 or so on non-virtual hardware, and for there to be very little variation from line to line.

If you could run the experiment without specifying the output device, i.e:

$ docker run --net host --device /dev/snd mikebrady/shairport-sync:latest -v --statistics

It would be interesting to see the statistics.

Presuming they are mostly the same, I'm wondering if the default output device is being handled specially by ProxMox... Does the Linux host have a GUI? Does it run PipeWire or PulseAudio? What about the ProxMox host? What OS is it?

@mikebrady mikebrady changed the title [Problem]: Bad sound quality when using non-default output device [Problem]: Using Docker inside a Proxmox VM -- bad sound quality when using non-default output device. Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants