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]: Pipewire raop -> shairport on Raspberry, extreme stuttering #1917

Open
2 tasks done
hjheins opened this issue Oct 7, 2024 · 8 comments
Open
2 tasks done

Comments

@hjheins
Copy link

hjheins commented Oct 7, 2024

What happened?

When playing music from a computer over pipewire raop-discover to shairport on an Raspberry Pi (as part of moode), the sound is extremely distorted/stuttery

Relevant log output

0.023675677 "shairport.c:2203" Startup in classic Airplay (aka "AirPlay 1") mode.
         0.000251875 "shairport.c:2239" Version String: "4.1.1-libdaemon-OpenSSL-Avahi-ALSA-jack-pa-dummy-stdout-pipe-soxr-convolution-metadata-mqtt-dbus-mpris-sysconfdir:/etc"
         0.000032761 "shairport.c:2258" Command Line: "/usr/bin/shairport-sync -v -a Moode AirPlay -- -d _audioout".
         0.000023229 "shairport.c:2294" Log Verbosity is 1.
         0.000033177 "audio_alsa.c:1031" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000076562 "audio_alsa.c:1185" alsa output rate is 44100 frames per second
         0.000039115 "audio_alsa.c:1320" alsa: disable_standby_mode is "auto".
         0.000022604 "audio_alsa.c:1324" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000023334 "audio_alsa.c:1326" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000041145 "audio_alsa.c:1366" alsa: output device name is "_audioout".
         0.000278125 "shairport.c:2342" disable_resend_requests is off.
         0.000037552 "shairport.c:2343" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000026094 "shairport.c:2347" statistics_requester status is 0.
         0.000022917 "shairport.c:2349" daemon status is 0.
         0.000024739 "shairport.c:1517" PID file: "/run/shairport-sync/shairport-sync.pid".
         0.000022917 "shairport.c:2350" daemon pid file path is "/run/shairport-sync/shairport-sync.pid".
         0.000022448 "shairport.c:2352" rtsp listening port is 5000.
         0.000022135 "shairport.c:2353" udp base port is 6001.
         0.000022240 "shairport.c:2354" udp port range is 10.
         0.000022031 "shairport.c:2355" player name is "Moode AirPlay".
         0.000021719 "shairport.c:2356" backend is "alsa".
         0.000022135 "shairport.c:2357" run_this_before_play_begins action is "(null)".
         0.000021771 "shairport.c:2358" run_this_after_play_ends action is "(null)".
         0.000022136 "shairport.c:2359" wait-cmd status is 1.
         0.000022708 "shairport.c:2360" run_this_before_play_begins may return output is 0.
         0.000021927 "shairport.c:2361" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000022083 "shairport.c:2363" run_this_before_entering_active_state action is  "/var/local/www/commandw/spspre.sh".
         0.000022448 "shairport.c:2365" run_this_after_exiting_active_state action is  "/var/local/www/commandw/spspost.sh".
         0.000022240 "shairport.c:2367" active_state_timeout is  10.000000 seconds.
         0.000026562 "shairport.c:2368" mdns backend "(null)".
         0.000022448 "shairport.c:2370" interpolation setting is "soxr".
         0.000028490 "shairport.c:2374" interpolation soxr_delay_threshold is 30000000.
         0.000022656 "shairport.c:2375" resync time is 0.050000 seconds.
         0.000023386 "shairport.c:2376" allow a session to be interrupted: 0.
         0.000022239 "shairport.c:2377" busy timeout time is 120.
         0.000022031 "shairport.c:2378" drift tolerance is 0.001995 seconds.
         0.000023073 "shairport.c:2379" password is "(null)".
         0.000021615 "shairport.c:2380" ignore_volume_control is 0.
         0.000021979 "shairport.c:2384" volume_max_db is not set
         0.000021563 "shairport.c:2385" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000022343 "shairport.c:2387" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000022240 "shairport.c:2391" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000022187 "shairport.c:2393" disable_synchronization is 0.
         0.000021719 "shairport.c:2394" use_mmap_if_available is 1.
         0.000021719 "shairport.c:2395" output_format automatic selection is disabled.
         0.000022292 "shairport.c:2398" output_format is "S16".
         0.000021823 "shairport.c:2399" output_rate automatic selection is disabled.
         0.000071197 "shairport.c:2402" output_rate is 44100.
         0.000024323 "shairport.c:2403" audio backend desired buffer length is 0.200000 seconds.
         0.000023698 "shairport.c:2405" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000023490 "shairport.c:2407" audio backend latency offset is 0.000000 seconds.
         0.000027917 "shairport.c:2409" audio backend silence lead-in time is "auto".
         0.000022500 "shairport.c:2413" zeroconf regtype is "_raop._tcp".
         0.000023437 "shairport.c:2414" decoders_supported field is 1.
         0.000022240 "shairport.c:2415" use_apple_decoder is 0.
         0.000021875 "shairport.c:2416" alsa_use_hardware_mute is 0.
         0.000021979 "shairport.c:2420" no special mdns service interface was requested.
         0.000054062 "shairport.c:2423" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000027604 "shairport.c:2430" metadata enabled is 1.
         0.000022865 "shairport.c:2431" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000022344 "shairport.c:2432" metadata socket address is "(null)" port 0.
         0.000022812 "shairport.c:2434" metadata socket packet size is "500".
         0.000022604 "shairport.c:2435" get-coverart is 1.
         0.000022553 "shairport.c:2438" mqtt is disabled.
         0.000021822 "shairport.c:2439" mqtt hostname is (null), port is 1883.
         0.000022448 "shairport.c:2440" mqtt topic is /Moode AirPlay.
         0.000021875 "shairport.c:2441" mqtt will not publish raw metadata.
         0.000022032 "shairport.c:2442" mqtt will not publish parsed metadata.
         0.000022239 "shairport.c:2443" mqtt will not publish cover Art.
         0.000021979 "shairport.c:2444" mqtt remote control is disabled.
         0.000021771 "shairport.c:2448" convolution is 0.
         0.000021875 "shairport.c:2449" convolution IR file is "(null)"
         0.000027656 "shairport.c:2450" convolution max length 8192
         0.000022396 "shairport.c:2451" convolution gain is 0.000000
         0.000023125 "shairport.c:2453" loudness is 0.
         0.000022240 "shairport.c:2454" loudness reference level is -20.000000
         0.000246042 "shairport.c:2464" size of hw_addr is 8.
         0.000770156 "rtsp.c:4135" metadata pipe name is "/tmp/shairport-sync-metadata".
         0.041987187 "dbus-service.c:609" >> setting loudness threshold to -20.000000.
         0.000182240 "dbus-service.c:622" >> setting drift tolerance to 0.001995 seconds.
         0.000082396 "dbus-service.c:1016" >> ALACDecoder set to "hammerton"
         0.000058802 "dbus-service.c:1021" >> Active set to "false"
         0.000043750 "dbus-service.c:1034" >> disable standby mode set to "auto"
         0.000046927 "dbus-service.c:1050" >> interpolation set to "soxr"
         0.000054635 "dbus-service.c:517" >> deactivating disable standby
         0.000038959 "dbus-service.c:599" >> deactivating loudness
         0.000037812 "dbus-service.c:533" >> deactivating convolution
         0.000167969 "dbus-service.c:502" >> log verbosity set to 1.
         0.000050521 "dbus-service.c:487" >> stop logging statistics
         0.000038333 "dbus-service.c:447" >> stop including elapsed time in logs
         0.000047604 "dbus-service.c:457" >> start including delta time in logs
         0.000039375 "dbus-service.c:470" >> start including file and line in logs
         0.000102292 "dbus-service.c:1163" Shairport Sync native D-Bus service started at "org.gnome.ShairportSync" on the system bus.
         0.001258958 "mpris-service.c:342" MPRIS service started at "org.mpris.MediaPlayer2.ShairportSync" on the system bus.
        85.550252936 "rtsp.c:1634" Connection 1: Classic AirPlay connection from 2a02:8071:6141:e2e0::295:39242 to self at 2a02:8071:6141:e2e0::ae7:5000.
Event: Run spspre.sh
amixer: Invalid command!
         1.502645677 "rtp.c:965" Time ping turnaround time: 142593526976 ns -- it looks like a timing ping was lost.
         1.993421978 "rtsp.c:2058" Connection 1: POST /feedback Content-Length 0
         0.819793333 "player.c:2844" Large negative (i.e. early) sync error of -6685 frames (-0.151587 seconds), at frame: 886366956.
         0.438457604 "player.c:2844" Large negative (i.e. early) sync error of -2613 frames (-0.059252 seconds), at frame: 886386124.
         0.270395677 "player.c:2844" Large negative (i.e. early) sync error of -2716 frames (-0.061587 seconds), at frame: 886398355.
         0.421996511 "player.c:2844" Large negative (i.e. early) sync error of -3169 frames (-0.071859 seconds), at frame: 886417056.
         0.049435572 "rtsp.c:2058" Connection 1: POST /feedback Content-Length 0
         0.302981511 "player.c:2844" Large negative (i.e. early) sync error of -2239 frames (-0.050771 seconds), at frame: 886432694.
         0.244822239 "player.c:2844" Large negative (i.e. early) sync error of -2282 frames (-0.051746 seconds), at frame: 886443043.
         0.426592552 "player.c:2844" Large negative (i.e. early) sync error of -2830 frames (-0.064172 seconds), at frame: 886462096.
         0.289476042 "player.c:2844" Large negative (i.e. early) sync error of -2272 frames (-0.051519 seconds), at frame: 886474560.
         0.318988750 "player.c:2844" Large negative (i.e. early) sync error of -2248 frames (-0.050975 seconds), at frame: 886489142.
         0.255321562 "player.c:2844" Large negative (i.e. early) sync error of -2959 frames (-0.067098 seconds), at frame: 886500198.
         0.162728073 "rtsp.c:2058" Connection 1: POST /feedback Content-Length 0
         0.184635989 "player.c:2844" Large negative (i.e. early) sync error of -2380 frames (-0.053968 seconds), at frame: 886514544.
         0.348450052 "player.c:2844" Large negative (i.e. early) sync error of -3084 frames (-0.069932 seconds), at frame: 886530304.
         0.347394531 "player.c:2844" Large negative (i.e. early) sync error of -2237 frames (-0.050726 seconds), at frame: 886545590.
         0.237194011 "player.c:2844" Large negative (i.e. early) sync error of -2941 frames (-0.066689 seconds), at frame: 886556646.
         0.882582864 "rtsp.c:2058" Connection 1: POST /feedback Content-Length 0
         1.999179218 "rtsp.c:2058" Connection 1: POST /feedback Content-Length 0
         0.900523958 "player.c:393" 1024 buffers allocated, 1024 buffers released.
         0.003805521 "rtsp.c:1353" Connection 1: Connection closed by client.
Event: Run spspost.sh
        65.345780027 "mdns_avahi.c:296" avahi: client failure: Daemon connection failed
         0.000211667 "mdns_avahi.c:299" avahi client -- we have been disconnected, so let's reconnect.
         0.421871562 "shairport.c:1669" normal exit

System Information.

Raspberry Pi 3B + Audiophonics es9028 running Moode (which includes shairport 4.1.1-libdaemon-OpenSSL-Avahi-ALSA-jack-pa-dummy-stdout-pipe-soxr-convolution-metadata-mqtt-dbus-mpris-sysconfdir:/etc)

Configuration Information.

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

From "uname -a":
 Linux undermoode 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

From /etc/os-release:
 Debian GNU/Linux 11 (bullseye)

From /sys/firmware/devicetree/base/model:
 Raspberry Pi 3 Model B Plus Rev 1.3

Shairport Sync Version String:
 4.1.1-libdaemon-OpenSSL-Avahi-ALSA-jack-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 : 
 {
   interpolation = "soxr";
   audio_backend_latency_offset_in_seconds = 0.0;
   audio_backend_buffer_desired_length_in_seconds = 0.2;
 };
 sessioncontrol : 
 {
   run_this_before_entering_active_state = "/var/local/www/commandw/spspre.sh";
   run_this_after_exiting_active_state = "/var/local/www/commandw/spspost.sh";
   active_state_timeout = 10.0;
   wait_for_completion = "yes";
   allow_session_interruption = "no";
   session_timeout = 120;
 };
 alsa : 
 {
   output_rate = 44100;
   output_format = "S16";
   disable_standby_mode = "auto";
 };

>> Display Config End.
>> Goodbye!

PulseAudio or PipeWire installed?

  • Check if your system uses a Sound Server.

How did you install Shairport Sync?

Built from source

Check previous issues

  • Confirm
@mikebrady
Copy link
Owner

Thanks for the post. A couple of quick questions:

  1. Have you tried playing from a regular Apple device, e.g. an iPhone or Mac?
  2. What sound server is installed on your system -- is it PipeWire or PulseAudio? The backend selected is alsa, (rather than pw if you have PipeWire on your Pi, or pa is you have a PulseAudio). Is that what you intend?

If you got a chance to run dacquery and post the results, it would give us an idea of the capability of the DAC you are using, which might be helpful.

@hjheins
Copy link
Author

hjheins commented Oct 7, 2024

Hi Mike,

  1. nope, sorry, I have no Apple device
  2. on the computer: pipewire. on the Raspberry looks like it's alsa

dacquery output:

# dacquery 
  --- Alsa Version: 1.2.4.
  --- Sound Cards: 1.
  --- Card 0:
        --- Name: "I-Sabre Q2M DAC".
        --- Mixer:
               --------------------------------------------------------------------------------------------------------
              |  Name                              |  Index  |     Min  |     Max  |  Mute dB  |   Min dB  |   Max dB  |
               --------------------------------------------------------------------------------------------------------
              |  Digital                           |      0  |       0  |     100  |       No  |  -100.00  |     0.00  |
               --------------------------------------------------------------------------------------------------------
        --- Interfaces and Supported Formats:
              >>> Interface "hw:DAC":
                  This interface supports any rate, format and channel combination from the following table:
                       -------------------------------------------------------------------------------------------------------------
                      |    Rate |              Format |  Channels | Channel Map                                                     |
                       -------------------------------------------------------------------------------------------------------------
                      |    8000 |              S16_LE |         2 |                                                                 |
                      |   11025 |              S32_LE |           |                                                                 |
                      |   16000 |                     |           |                                                                 |
                      |   22050 |                     |           |                                                                 |
                      |   32000 |                     |           |                                                                 |
                      |   44100 |                     |           |                                                                 |
                      |   48000 |                     |           |                                                                 |
                      |   64000 |                     |           |                                                                 |
                      |   88200 |                     |           |                                                                 |
                      |   96000 |                     |           |                                                                 |
                      |  176400 |                     |           |                                                                 |
                      |  192000 |                     |           |                                                                 |
                      |  352800 |                     |           |                                                                 |
                      |  384000 |                     |           |                                                                 |
                       -------------------------------------------------------------------------------------------------------------

@mikebrady
Copy link
Owner

Thanks, and to clarify: does the Pi have a sound server on it? A quick way to tell is that if it has a Desktop GUI, it has a sound server.

If you could somehow try it out with an Apple device, it would help to eliminate that RAOP plugin as a potential problem.

@hjheins
Copy link
Author

hjheins commented Oct 7, 2024

No, the pi has no desktop and no gui

Unfortunately I have no Apple device, so testing that will be difficult.

To clarify: the pi is installed with moodeaudio; before pipewire I pushed music to it over dlna, but as pipewire doesn't support dlna yet, I used raop / shairport as the alternative solution (shairport is part of moodeaudio)

@mikebrady
Copy link
Owner

Many thanks for the clarifications. Another possibility for testing (and maybe for using?) is OwnTone.

@hjheins
Copy link
Author

hjheins commented Oct 8, 2024

Hi Mike, thanks. Owntone looks very nice.
However I am looking for a solution to basically select another output/renderer while going through audio on my computer. So like when I open a youtube video/sound file, and I want to stream it directly to the living room instead of my computer. up till pipewire I used DLNA for it, but as pipewire doesn't support that, I tried airplay.
Owntone is nice but apparently not for something like that.

@JayGatsby7
Copy link

JayGatsby7 commented Oct 10, 2024

i use raop from my ubuntu and arch linux desktop workstations. Able to sling to a headless raspberry pi running shairport sync. it works great. Believe that I had issues when trying to do this from a raspberry pi os desktop so it could have something to do with the os and/or desktop you are using on the machine that isn't running shairport-sync. Gnome/Arch linux; Gnome/Ubuntu 24.04 work great for me. I run shairport on a headless pi (lite version of raspbian) using the docker image of Shairport-sync

@hjheins
Copy link
Author

hjheins commented Oct 10, 2024

hi @JayGatsby7 ,
actually I am playing from a computer with a ryzen 3600, 16Gb Ram, 1Gb SSD to a raspbberry with shairplay installed.

I guess this is a dead-end for now.
I found an alternative solution in pa-dlna which can play from any computer with pipewire installed to any dlna renderer.
So for the moment no airport for me.
cheers :-)

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

3 participants