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]: Slight crackling during loud parts of songs. #1919

Open
1 of 2 tasks
tom8347 opened this issue Oct 11, 2024 · 8 comments
Open
1 of 2 tasks

[Problem]: Slight crackling during loud parts of songs. #1919

tom8347 opened this issue Oct 11, 2024 · 8 comments

Comments

@tom8347
Copy link

tom8347 commented Oct 11, 2024

What happened?

There's a slight crackling sound during loud parts of some tracks. Not all tracks, but if I notice it with one track, it will do it consistently with that track. I notice it the worst when the source is my nixos desktop (pipewire), but I also notice it with my android phone with airmusic to a slightly lesser extent, and I also notice it with my M1 macbook air. Again it seems to be to different degrees with these three devices. And again I on't notice it on all tracks, it seems to happen is a track goes suddenly from being quiet to loud, though I'm not quite sure. It didn't always happen (I don't think... But I'm beginning to doubt myself because it's quite a subtle thing that I might have missed before), and seems to have started in the last month or so.

The crackling sound is similar to that you sometimes get in VMs when you don't pin cpu cores if that helps at all, though it's much less exaggerated.

The nature of the crackling changes when I switch between basic interpolation and soxr, but it happens either way. This makes me think it must be to do with lost packets?

I thought it might be a sign of my pi dying so I switched it out for an identical one but the problem persists.

The only other thing I can think of is that it is a problem with my network itself, but I'm not aware of any changes to my network in the last months/weeks.

I'm fairly certain it's not a problem with the dac because the problem goes away when I connect directly to the dac via bluetooth.

Relevant log output

output from shairport-sync -v when connecting from my nixos machine:

         0.001293073 "shairport.c:2278" Startup in AirPlay 2 mode, with features 0x405c4a00,0x1c340 on device "b8:27:eb:93:75:07".
         0.000131510 "shairport.c:2317" Version String: "4.3.4-1-g910264e5-AirPlay2-smi10-alac-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc"
         0.000025729 "shairport.c:2336" Command Line: "shairport-sync -v".
         0.000466302 "shairport.c:2372" Log Verbosity is 1.
         0.000059480 "audio_alsa.c:1082" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000075000 "audio_alsa.c:1371" alsa: disable_standby_mode is "never".
         0.000018229 "audio_alsa.c:1375" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000018594 "audio_alsa.c:1377" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000029479 "audio_alsa.c:1417" alsa: output device name is "hw:Audio".
         0.000236406 "shairport.c:2440" disable_resend_requests is off.
         0.000029010 "shairport.c:2441" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000021250 "shairport.c:2445" statistics_requester status is 0.
         0.000016407 "shairport.c:2450" rtsp listening port is 7000.
         0.000045937 "shairport.c:2451" udp base port is 6001.
         0.000038854 "shairport.c:2452" udp port range is 10.
         0.000036823 "shairport.c:2453" player name is "Living Room".
         0.000036771 "shairport.c:2454" backend is "alsa".
         0.000036510 "shairport.c:2455" run_this_before_play_begins action is "(null)".
         0.000037240 "shairport.c:2456" run_this_after_play_ends action is "(null)".
         0.000036563 "shairport.c:2457" wait-cmd status is 0.
         0.000036250 "shairport.c:2458" run_this_before_play_begins may return output is 0.
         0.000037239 "shairport.c:2459" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000037448 "shairport.c:2461" run_this_before_entering_active_state action is  "(null)".
         0.000037292 "shairport.c:2463" run_this_after_exiting_active_state action is  "(null)".
         0.000037291 "shairport.c:2465" active_state_timeout is  10.000000 seconds.
         0.000041615 "shairport.c:2466" mdns backend "(null)".
         0.000036094 "shairport.c:2468" interpolation setting is "basic".
         0.000036458 "shairport.c:2472" interpolation soxr_delay_threshold is 30000000.
         0.000037188 "shairport.c:2473" resync time is 0.050000 seconds.
         0.000038281 "shairport.c:2474" resync recovery time is 0.100000 seconds.
         0.000037864 "shairport.c:2475" allow a session to be interrupted: 0.
         0.000036302 "shairport.c:2476" busy timeout time is 120.
         0.000036094 "shairport.c:2477" drift tolerance is 0.002000 seconds.
         0.000038125 "shairport.c:2478" password is not set.
         0.000035729 "shairport.c:2479" default airplay volume is: -24.000000.
         0.000040417 "shairport.c:2480" high threshold airplay volume is: -16.000000.
         0.000039167 "shairport.c:2482" check for higher-than-threshold volume for new play session is disabled.
         0.000037239 "shairport.c:2488" ignore_volume_control is 0.
         0.000036563 "shairport.c:2492" volume_max_db is not set
         0.000035364 "shairport.c:2493" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000040000 "shairport.c:2495" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000038386 "shairport.c:2499" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000037656 "shairport.c:2501" disable_synchronization is 0.
         0.000036354 "shairport.c:2502" use_mmap_if_available is 1.
         0.000036250 "shairport.c:2503" output_format automatic selection is enabled.
         0.000036771 "shairport.c:2507" output_rate automatic selection is enabled.
         0.000036510 "shairport.c:2511" audio backend desired buffer length is 0.200000 seconds.
         0.000038386 "shairport.c:2513" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000038854 "shairport.c:2515" audio backend latency offset is 0.000000 seconds.
         0.000053385 "shairport.c:2517" audio backend silence lead-in time is "auto".
         0.000036250 "shairport.c:2521" zeroconf regtype is "_raop._tcp".
         0.000036146 "shairport.c:2522" decoders_supported field is 3.
         0.000036407 "shairport.c:2523" use_apple_decoder is 1.
         0.000036041 "shairport.c:2524" alsa_use_hardware_mute is 0.
         0.000036354 "shairport.c:2528" no special mdns service interface was requested.
         0.000070000 "shairport.c:2531" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000042657 "shairport.c:2561" loudness is 0.
         0.000036823 "shairport.c:2562" loudness reference level is -20.000000
         0.002102812 "shairport.c:2689" NQPTP is online.
        22.561277179 "rtsp.c:4543" Connection 1: Classic AirPlay connection from 192.168.1.13:20003 to self at 192.168.1.23:7000.
         0.136114739 "rtp.c:811" Remote processing time greater than return time -- ignored.




the last line there about the remote processing time didn't used to be there - but then I don't see that line when I connect from my phone (android) or my laptop (macbook) so I'm not sure how relevant it is.

System Information.

I'm running shairport, compiled with Airplay 2 and soxr support, on a raspberry pi 3 model B with an ethernet connection. It's outputting to an SMSL SA300 DAC.

Configuration Information.

>> Display Config Start.

From "uname -a":
 Linux raspberrypi 6.1.21-v7+ #1642 SMP Mon Apr  3 17:20:52 BST 2023 armv7l GNU/Linux

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

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

Shairport Sync Version String:
 4.3.4-1-g910264e5-AirPlay2-smi10-alac-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc

Command Line:
 shairport-sync --displayConfig

Configuration File:
 /etc/shairport-sync.conf

Configuration File Settings:
 general : 
 {
   name = "Living Room";
   audio_backend_latency_offset_in_seconds = 0.0;
   interpolation = "basic";
 };
 alsa : 
 {
   output_device = "hw:Audio";
   mixer_control_name = "PCM";
 };

>> 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. If there is a lot of interpolation, then you might hear some crackling if using basic interpolation, but it should be almost inaudible if you use soxr interpolation. What would be very interesting would be to turn on the gathering of statistics (statistics in the diagnostics section of the configuration file). This would enable us to see how much interpolation is being done, which might help with troubleshooting.

@tom8347
Copy link
Author

tom8347 commented Oct 12, 2024

Okay so starting shairport with shairport-sync -v --statistics gives this output

     7.929294580 "player.c:2651" Sync Error ms | Net Sync PPM | All Sync PPM | Missing |   Late | Too Late | Resend Reqs | Min DAC Queue | Min Buffers | Max Buffers | Nominal FPS | Received FPS | Output FPS (r) | Output FPS (c) | Source Drift PPM | Drift Samples
     0.000181823 "player.c:2651"         -0.21           54.4          145.9         0        0          0             0            8100           172           174      44085.50       44084.97              N/A              N/A               0.00               0
     8.006620570 "player.c:2651"         -0.58          291.7          660.0         0        0          0             0            8105           172           174      44092.31       44090.84         44116.54         44116.78               0.00               0
     8.003130309 "player.c:2651"          0.17          -65.1          592.0         0        0          0             0            8188           172           174      44101.12       44099.84         44111.08         44111.32               0.00               0
     8.003910987 "player.c:2651"         -0.10           28.3          674.1         0        0          0             0            8136           172           175      44095.09       44102.69         44098.21         44098.45               0.00               0
     8.014545361 "player.c:2651"         -1.01          405.0          620.3         0        0          0             0            8165           172           174      44099.64       44101.20         44101.42         44101.66               0.00               0
     8.000132549 "player.c:2651"         -0.35          150.1          620.3         0        0          0             0            8112           172           174      44096.19       44098.75         44103.31         44103.55               0.00               0
     7.999625362 "player.c:2651"          0.30         -150.1          614.6         0        0          0             0            8127           172           174      44099.30       44097.45         44100.02         44100.26               0.00               0
     8.014494789 "player.c:2651"         -1.09          473.0          688.3         0        0          0             0            8052           172           174      44099.12       44097.28         44100.01         44100.25               0.00               0
     8.010481819 "player.c:2651"         -0.22          121.8          643.0         0        0          0             0            8144           172           174      44099.00       44099.69         44102.07         44102.31               0.00               0
     8.003444529 "player.c:2651"         -0.18          130.3          538.2         0        0          0             0            8135           172           174      44096.86       44101.07         44101.84         44102.08               0.00               0
     8.000180934 "player.c:2651"         -0.70          368.2          917.7         0        0          0             0            8078           172           174      44098.73       44099.76         44100.02         44100.26               0.00               0
     8.007308695 "player.c:2651"         -0.13           99.1          676.9         0        0          0             0            8129           172           174      44100.35       44099.06         44100.00         44100.24               0.00               0
     8.007019841 "player.c:2651"          0.10          -14.2          546.7         0        0          0             0            8167           172           174      44098.69       44098.62         44101.84         44102.08               0.00               0
     8.003324736 "player.c:2651"         -1.34          628.8         1002.7         0        0          0             0            8090           172           174      44100.05       44099.75         44101.69         44101.93               0.00               0
     8.003908174 "player.c:2651"         -0.02           11.3          521.2         0        0          0             0            8191           172           174      44098.60       44100.44         44100.00         44100.24               0.00               0
     8.007583174 "player.c:2651"          0.16          -39.7          719.4         0        0          0             0            8167           172           174      44099.81       44099.80         44099.63         44099.87               0.00               0
     8.006666039 "player.c:2651"         -1.92          812.9         1079.1         0        0          0             0            7238           170           174      44098.48       44099.52         44100.69         44100.93               0.00               0
     7.999766976 "player.c:2651"          0.22          -70.8          603.3         0        0          0             0            8179           172           174      44099.55       44098.94         44099.68         44099.92               0.00               0
     8.014657549 "player.c:2651"         -0.03           31.2          716.6         0        0          0             0            8146           172           174      44100.50       44098.74         44100.31         44100.55               0.00               0
     7.999320049 "player.c:2651"         -1.63          725.1          764.8         0        0          0             0            7968           172           174      44099.43       44100.62         44100.58         44100.82               0.00               0
     8.014609528 "player.c:2651"         -0.59          266.2          753.4         0        0          0             0            8121           172           174      44099.37       44100.37         44101.10         44101.34               0.00               0
     7.999913122 "player.c:2651"          0.17          -19.8          524.0         0        0          0             0            8150           172           174      44099.31       44099.82         44100.01         44100.24               0.00               0
     8.007348330 "player.c:2651"         -1.65          753.4         1189.6         0        0          0             0            8030           172           174      44100.11       44099.45         44100.00         44100.24               0.00               0
     8.006678799 "player.c:2651"         -0.26          169.9          725.1         0        0          0             0            8126           172           174      44099.17       44099.28         44100.72         44100.96               0.00               0

@mikebrady
Copy link
Owner

mikebrady commented Oct 12, 2024

Thanks. As I suspected, there is a great deal of interpolation going on — it should be in the 10s of PPM or occasionally up to 150 PPM or so. However, you can see that synchronization error is going positive and negative, indicating that the system is overcompensating. My suggestion would be to make the drift_tolerance_in_seconds larger, e.g. 0.020 seconds, (i.e. 20 milliseconds) and see if the amount of interpolation drops. If so, then you can reduce it if you wish.

@tom8347
Copy link
Author

tom8347 commented Oct 12, 2024

I've set drift_tolerance_in_seconds to 0.020 and it's much better which is great, I hear only very occasional cracks. Will this affect audio/video synchronisation when watching videos?

This is the output now:

     7.928989893 "player.c:2651" Sync Error ms | Net Sync PPM | All Sync PPM | Missing |   Late | Too Late | Resend Reqs | Min DAC Queue | Min Buffers | Max Buffers | Nominal FPS | Received FPS | Output FPS (r) | Output FPS (c) | Source Drift PPM | Drift Samples
     0.000173229 "player.c:2651"         -3.36            0.0            0.0         0        0          0             0            7851           164           166      44105.49       44082.33              N/A              N/A               0.00               0
     8.006776247 "player.c:2651"         -7.30            0.0            0.0         0        0          0             0            7304           161           166      44091.44       44089.34         44094.46         44094.62               0.00               0
     8.000504945 "player.c:2651"         -7.21            0.0            0.0         0        0          0             0            7788           164           166      44100.54       44104.27         44091.77         44091.93               0.00               0
     8.013773017 "player.c:2651"        -10.44            0.0            0.0         0        0          0             0            7561           164           166      44099.89       44103.13         44094.51         44094.67               0.00               0
     8.000062497 "player.c:2651"        -14.70            0.0            0.0         0        0          0             0            7474           164           166      44099.51       44099.82         44099.98         44100.14               0.00               0
     8.007548279 "player.c:2651"        -15.14            0.0            0.0         0        0          0             0            7455           164           166      44095.67       44098.16         44098.91         44099.07               0.00               0
     8.006932236 "player.c:2651"        -14.90            0.0            0.0         0        0          0             0            7507           164           166      44098.97       44097.52         44098.15         44098.31               0.00               0
     8.014404476 "player.c:2651"        -15.02            2.8            2.8         0        0          0             0            7308           164           166      44101.21       44097.38         44099.22         44099.38               0.00               0
     7.993037393 "player.c:2651"        -15.20            0.0            0.0         0        0          0             0            7535           164           166      44098.81       44100.72         44099.32         44099.48               0.00               0
     8.013876143 "player.c:2651"        -16.10            5.7            5.7         0        0          0             0            7173           164           167      44098.75       44100.60         44099.38         44099.54               0.00               0
     8.000540413 "player.c:2651"        -16.48           11.3           11.3         0        0          0             0            7285           165           167      44098.68       44099.16         44098.35         44098.51               0.00               0
     8.007059060 "player.c:2651"        -16.05            5.7            5.7         0        0          0             0            7344           164           167      44100.26       44098.64         44098.01         44098.16               0.00               0
     8.007253903 "player.c:2651"        -17.28           34.0           34.0         0        0          0             0            7028           164           167      44098.38       44098.11         44099.99         44100.14               0.00               0
     8.010392080 "player.c:2651"        -17.87           34.0           34.0         0        0          0             0            7290           165           166      44099.89       44099.60         44099.15         44099.31               0.00               0
     8.003723070 "player.c:2651"        -17.36           39.7           39.7         0        0          0             0            7142           164           167      44098.47       44100.42         44099.21         44099.36               0.00               0
     7.999963591 "player.c:2651"        -18.30           65.1           65.1         0        0          0             0            7119           164           167      44099.68       44099.64         44100.00         44100.15               0.00               0
     8.007974893 "player.c:2651"        -18.79           48.2           48.2         0        0          0             0            7116           164           167      44099.60       44098.95         44099.99         44100.15               0.00               0
     8.006313174 "player.c:2651"        -17.95           25.5           25.5         0        0          0             0            7052           164           167      44099.50       44098.85         44099.67         44099.82               0.00               0
     8.003817705 "player.c:2651"        -19.69          150.1          150.1         0        0          0             0            7063           164           167      44100.46       44099.51         44099.39         44099.54               0.00               0
     8.003639007 "player.c:2651"        -19.10           87.8           87.8         0        0          0             0            6803           164           167      44099.31       44100.14         44099.71         44099.86               0.00               0
     8.014149633 "player.c:2651"        -19.08           70.8           70.8         0        0          0             0            7182           164           166      44100.19       44100.03         44100.00         44100.15               0.00               0
     8.000061611 "player.c:2651"        -20.37          206.8          206.8         0        0          0             0            6924           164           167      44099.23       44099.44         44099.22         44099.37               0.00               0
     8.000167601 "player.c:2651"        -19.74          116.1          116.1         0        0          0             0            6898           164           167      44100.03       44098.91         44099.75         44099.90               0.00               0
     8.014424164 "player.c:2651"        -19.43           96.3           96.3         0        0          0             0            7160           164           167      44099.95       44098.80         44100.24         44100.39               0.00               0
     8.010638747 "player.c:2651"        -21.42          257.7          257.7         0        0          0             0            6840           164           167      44099.87       44099.53         44099.54         44099.70               0.00               0
     7.996440882 "player.c:2651"        -21.33          192.6          192.6         0        0          0             0            6727           164           168      44099.01       44099.87         44099.34         44099.49               0.00               0
     8.007201456 "player.c:2651"        -19.66           79.3           79.3         0        0          0             0            7145           164           167      44099.68       44099.59         44100.21         44100.36               0.00               0
     8.007396038 "player.c:2651"        -22.23          371.0          371.0         0        0          0             0            6717           164           168      44100.35       44099.26         44100.00         44100.15               0.00               0

Other than that, is there a root cause of the interpolation that I could try to address?

@mikebrady
Copy link
Owner

That’s good news. You will hardly hear a sync mismatch of 20 milliseconds, but you could experiment with reducing the drift tolerance until overcompensation starts — that will be when the All Sync PPM is considerably greater than the Net Sync PPM.

There seems to be two issues at work here. First, the rate of arrival of audio frames from the player doesn’t quite match the rate at which they are played. Second — and apparently more significant in this case — it looks as if the reference clock on the sending device is wandering, slowly getting faster and slower then faster again, etc. over a period of 10s of seconds.

If your Pi has a good connection to the internet, the Output FPS (c) should be accurate over a long period, as it should be adjusted by the NTP service used by the Pi.

On the face of it, it looks as if your output device is pretty exactly on 44,100. It also looks like the audio is arriving at close to 44,100 fps, but the reference clock seems to be wandering by something in the region of 100 to 150 PPM.

It would be interesting to run it continuously for a few hours if possible, in order to get better readings. Apple sources tend to be stable and accurate, but others maybe not so much.

@tom8347
Copy link
Author

tom8347 commented Oct 13, 2024

When I get a chance to do this I will, and then post the output here. Thank you so much for your help so far!

@tom8347
Copy link
Author

tom8347 commented Oct 16, 2024

Okay this is quite a long run, about 2 hours

output.txt

@mikebrady
Copy link
Owner

Thanks -- that's interesting. You could probably experiment with reducing the tolerance to 10 milliseconds and see what happens. There are a few discontinuities in the sequence -- was anything special happening at those times, e.g. the end of a track and the start of another, that might account for them?

Later in the log, you can see a kind of cyclical increase and decrease of the amount of interpolation needed, with a periodicity of the order of five minutes or so.

Just for reference, here is a log of an iPad playing an album using Apple Music to Shairport Sync running on a Raspberry Pi 3 all up-to-date.

         2.754348124 "player.c:2656" Sync Error ms | Net Sync PPM | All Sync PPM | Missing |   Late | Too Late | Resend Reqs | Min DAC Queue | Min Buffers | Max Buffers | Nominal FPS | Received FPS | Output FPS (r) | Output FPS (c) | Source Drift PPM | Drift Samples
         0.000332292 "player.c:2656"         -0.01            0.0            0.0         0        0          0             0            7411           194           232      44099.94       44534.74              N/A              N/A               0.00               0
         8.003875830 "player.c:2656"          0.06            0.0            0.0         0        0          0             0            7547           225           232      44099.96       44313.32         44099.52         44099.76               0.00               0
         8.010835934 "player.c:2656"          0.10            0.0            0.0         0        0          0             0            7487           227           232      44100.00       44223.54         44099.90         44100.14               0.00               0
         7.988741508 "player.c:2656"          0.05            0.0            0.0         0        0          0             0            7785           227           232      44100.00       44192.89         44099.95         44100.19               0.00               0
         8.009574997 "player.c:2656"          0.04            0.0            0.0         0        0          0             0            7583           228           232      44100.00       44178.93         44099.89         44100.14               0.00               0
         8.008603590 "player.c:2656"          0.04            2.8            2.8         0        0          0             0            7611           227           232      44099.98       44146.43         44099.93         44100.17               0.00               0
         8.012604320 "player.c:2656"          0.06            0.0            0.0         0        0          0             0            7556           225           232      44100.00       44153.17         44100.04         44100.28               0.00               0
         8.009522237 "player.c:2656"          0.05            0.0            0.0         0        0          0             0            7424           225           232      44099.99       44137.87         44099.96         44100.20               0.00               0
         7.990153382 "player.c:2656"          0.04            0.0            0.0         0        0          0             0            7412           225           232      44099.99       44138.71         44100.00         44100.24               0.00               0
         8.014222757 "player.c:2656"          0.03            0.0            0.0         0        0          0             0            7427           225           232      44100.00       44134.50         44100.00         44100.25               0.00               0
         8.005724841 "player.c:2656"          0.10            0.0            0.0         0        0          0             0            7436           225           232      44100.00       44135.11         44100.00         44100.24               0.00               1
         8.011295257 "player.c:2656"          0.15            2.8            2.8         0        0          0             0            7169           225           233      44100.00       44129.54         44099.98         44100.22               0.00               1
         7.988343852 "player.c:2656"          0.15            0.0            0.0         0        0          0             0            7669           225           232      44100.00       44128.20         44100.00         44100.24               0.00               1
         8.018523017 "player.c:2656"          0.14            0.0            0.0         0        0          0             0            7637           227           232      44099.99       44124.20         44099.99         44100.23               0.00               1
         8.003098851 "player.c:2656"          0.15            0.0            0.0         0        0          0             0            7485           224           232      44099.99       44123.62         44099.98         44100.23               0.00               2
         8.009229893 "player.c:2656"          0.37           -2.8            8.5         0        0          0             0            7497           225           232      44100.00       44118.11         44100.00         44100.24               0.00               4
         8.010071247 "player.c:2656"          0.42            0.0            0.0         0        0          0             0            7540           225           232      44100.00       44120.63         44100.00         44100.24               0.00               4
         7.990804060 "player.c:2656"          0.43          -25.5           25.5         0        0          0             0            7557           226           232      44100.00       44119.17         44100.01         44100.25               0.00               5
         8.009969163 "player.c:2656"          0.44            0.0            0.0         0        0          0             0            7634           226           232      44100.00       44119.46         44100.01         44100.25               0.00               5
         8.011786508 "player.c:2656"          0.44            0.0            0.0         0        0          0             0            7559           226           232      44100.00       44116.78         44100.01         44100.25               0.00               5
         8.008771351 "player.c:2656"          0.44            0.0            0.0         0        0          0             0            7639           225           232      44100.00       44117.14         44100.02         44100.26               0.00               5
         7.990143070 "player.c:2656"          0.43           -2.8            8.5         0        0          0             0            7315           224           232      44100.00       44116.30         44100.03         44100.28               0.00               6
         8.011871299 "player.c:2656"          0.44          -11.3           17.0         0        0          0             0            7669           227           232      44100.00       44114.23         44100.01         44100.25               0.00               7
         8.007091455 "player.c:2656"          0.44            0.0            0.0         0        0          0             0            7474           225           232      44100.00       44115.19         44100.03         44100.27               0.00               7
         8.011373851 "player.c:2656"          0.42            0.0            0.0         0        0          0             0            7586           228           232      44100.00       44115.10         44100.02         44100.26               0.00               7
         8.010618382 "player.c:2656"          0.43           -2.8            2.8         0        0          0             0            7437           225           232      44100.00       44113.37         44100.02         44100.26               0.00               8
         7.987568643 "player.c:2656"          0.47          -17.0           17.0         0        0          0             0            7432           226           232      44100.00       44111.71         44100.02         44100.26               6.75              10
         8.010075310 "player.c:2656"          0.47           -5.7            5.7         0        0          0             0            7467           225           232      44100.00       44112.01         44100.01         44100.26               6.75              10
         8.012435622 "player.c:2656"          0.46           -5.7           11.3         0        0          0             0            7526           227           232      44100.00       44111.96         44100.03         44100.27               6.75              10
         8.010195049 "player.c:2656"          0.47           -5.7           11.3         0        0          0             0            7454           224           232      44100.00       44112.12         44100.02         44100.27               6.75              10
         8.010987132 "player.c:2656"          0.46           -5.7            5.7         0        0          0             0            7555           227           232      44100.00       44112.23         44100.02         44100.26               5.91              11
         7.989374164 "player.c:2656"          0.40            0.0            0.0         0        0          0             0            7751           227           232      44100.00       44110.76         44100.02         44100.26               5.91              11
         8.008284424 "player.c:2656"          0.41            0.0            0.0         0        0          0             0            7579           227           232      44100.00       44109.80         44100.02         44100.26               5.52              12
         8.011274319 "player.c:2656"          0.43            0.0            0.0         0        0          0             0            7455           226           232      44100.00       44108.71         44100.03         44100.27               5.52              12
         8.011050622 "player.c:2656"          0.44           -2.8            2.8         0        0          0             0            7642           227           232      44100.00       44110.06         44100.03         44100.27               5.21              13
         7.989979997 "player.c:2656"          0.43            0.0            0.0         0        0          0             0            7482           226           232      44100.00       44109.79         44100.02         44100.27               5.09              14
         8.009523070 "player.c:2656"          0.46           -2.8            2.8         0        0          0             0            7518           224           232      44100.00       44110.14         44100.02         44100.26               5.09              14
         8.011114633 "player.c:2656"          0.45           -2.8            2.8         0        0          0             0            7708           226           232      44100.00       44109.17         44100.02         44100.27               5.01              15
         8.009082340 "player.c:2656"          0.46           -5.7            5.7         0        0          0             0            7436           226           232      44100.00       44109.53         44100.02         44100.27               5.01              15
         8.010195258 "player.c:2656"          0.45            0.0            5.7         0        0          0             0            7355           225           232      44100.00       44109.64         44100.03         44100.27               4.80              17
         7.989293122 "player.c:2656"          0.45           -2.8            2.8         0        0          0             0            7366           226           232      44100.00       44108.69         44100.03         44100.27               4.80              17
         8.005109580 "player.c:2656"          0.46           -5.7            5.7         0        0          0             0            7210           225           249      44100.00       44125.25         44100.02         44100.27               4.89              18
         8.016836299 "player.c:2656"          0.46           -8.5            8.5         0        0          0             0            6709           227           250      44100.00       44123.27         44100.03         44100.27               5.17              19
         8.015134476 "player.c:2656"          0.46           -2.8            2.8         0        0          0             0            6871           223           250      44100.00       44123.89         44100.03         44100.27               5.17              19
         7.986647080 "player.c:2656"          0.45           -5.7            5.7         0        0          0             0            7163           227           249      44100.00       44123.82         44100.03         44100.27               5.17              19
         8.021341403 "player.c:2656"          0.45           -5.7            5.7         0        0          0             0            7427           235           248      44100.00       44122.67         44100.03         44100.27               5.06              20
         7.989247133 "player.c:2656"          0.46           -5.7            5.7         0        0          0             0            7431           235           248      44100.00       44122.42         44100.02         44100.26               5.31              21
         8.005621091 "player.c:2656"          0.45           -5.7            5.7         0        0          0             0            7264           235           248      44100.00       44122.18         44100.03         44100.27               5.31              21
         8.024091090 "player.c:2656"          0.46           -2.8            2.8         0        0          0             0            7425           235           248      44100.00       44121.67         44100.02         44100.27               5.25              22
         7.994137497 "player.c:2656"          0.46           -5.7            5.7         0        0          0             0            7192           235           249      44100.00       44120.90         44100.02         44100.26               5.26              23
         8.017411716 "player.c:2656"          0.46            0.0            5.7         0        0          0             0            7156           234           249      44100.00       44121.07         44100.03         44100.27               5.27              24
         7.988194789 "player.c:2656"          0.46           -8.5            8.5         0        0          0             0            7428           236           248      44100.00       44120.21         44100.03         44100.27               5.29              25
         8.016075726 "player.c:2656"          0.45           -5.7            5.7         0        0          0             0            7424           235           249      44100.00       44119.78         44100.03         44100.27               5.29              25
         8.018753903 "player.c:2656"          0.46           -2.8            2.8         0        0          0             0            7438           236           248      44100.00       44119.01         44100.03         44100.27               5.29              25
         7.986618486 "player.c:2656"          0.46           -5.7            5.7         0        0          0             0            7432           236           248      44100.00       44119.17         44100.02         44100.27               5.29              25
         8.020410674 "player.c:2656"          0.45           -5.7            5.7         0        0          0             0            7395           235           248      44100.00       44119.12         44100.02         44100.27               5.29              25
         7.989129112 "player.c:2656"          0.46           -2.8            2.8         0        0          0             0            7428           236           248      44100.00       44118.99         44100.03         44100.28               5.29              25
         8.012277914 "player.c:2656"          0.45           -2.8            8.5         0        0          0             0            7372           236           249      44100.00       44118.23         44100.03         44100.27               5.21              26
         8.019398642 "player.c:2656"          0.45           -2.8            2.8         0        0          0             0            7195           235           248      44100.00       44118.21         44100.03         44100.27               5.13              25
         7.985224060 "player.c:2656"          0.44           -2.8            2.8         0        0          0             0            7427           235           248      44100.00       44117.81         44100.03         44100.27               5.04              26
         8.026504997 "player.c:2656"          0.46            0.0            0.0         0        0          0             0            7086           235           250      44100.00       44117.20         44100.03         44100.27               5.00              27
         7.988868434 "player.c:2656"          0.45           -5.7            5.7         0        0          0             0            7422           235           248      44100.00       44117.11         44100.03         44100.27               5.01              28
         8.008968851 "player.c:2656"          0.46           -5.7            5.7         0        0          0             0            7426           235           248      44100.00       44116.79         44100.03         44100.27               4.88              27
         8.023053070 "player.c:2656"          0.43            0.0            0.0         0        0          0             0            7424           236           247      44100.00       44116.52         44100.03         44100.27               4.74              26
         7.988237185 "player.c:2656"          0.45           -2.8            2.8         0        0          0             0            7006           235           250      44100.00       44116.51         44100.03         44100.27               4.72              27
         8.019355049 "player.c:2656"          0.46            0.0            0.0         0        0          0             0            7433           236           248      44100.00       44115.91         44100.03         44100.28               4.77              26
         7.989900413 "player.c:2656"          0.45           -8.5            8.5         0        0          0             0            7427           236           248      44100.00       44115.78         44100.03         44100.28               4.77              26
         8.008281716 "player.c:2656"          0.45           -5.7            5.7         0        0          0             0            7385           236           249      44100.00       44115.51         44100.03         44100.27               4.77              26
         8.023184684 "player.c:2656"          0.44            0.0            0.0         0        0          0             0            7432           235           248      44100.00       44115.34         44100.03         44100.28               4.77              26
         7.990268174 "player.c:2656"          0.46           -5.7            5.7         0        0          0             0            7432           235           249      44100.00       44115.16         44100.03         44100.27               4.84              25
         8.020923226 "player.c:2656"          0.45           -2.8            2.8         0        0          0             0            7428           235           248      44100.00       44115.12         44100.03         44100.27               4.80              25
         7.985945727 "player.c:2656"          0.47           -5.7            5.7         0        0          0             0            7173           235           249      44100.00       44114.62         44100.03         44100.27               4.91              26
         8.013320934 "player.c:2656"          0.44           -2.8            2.8         0        0          0             0            7274           233           249      44100.00       44114.70         44100.03         44100.27               4.67              27
         8.019962184 "player.c:2656"          0.43            0.0            0.0         0        0          0             0            7426           235           248      44100.00       44114.18         44100.03         44100.27               4.65              26
         7.990130414 "player.c:2656"          0.46           -2.8            2.8         0        0          0             0            7313           234           248      44100.00       44114.06         44100.03         44100.28               4.72              24
         8.021149997 "player.c:2656"          0.46           -5.7            5.7         0        0          0             0            7429           235           248      44100.00       44114.01         44100.03         44100.28               4.72              24
         7.989120362 "player.c:2656"          0.45           -2.8            2.8         0        0          0             0            7018           235           250      44100.00       44114.00         44100.03         44100.27               4.72              24
         8.007802705 "player.c:2656"          0.45           -2.8            2.8         0        0          0             0            7429           233           248      44100.00       44113.82         44100.03         44100.27               4.72              24
         7.991066247 "player.c:2656"          0.46           -2.8            2.8         0        0          0             0            7429           232           248      44100.00       44113.64         44100.03         44100.28               4.65              23
         8.023771090 "player.c:2656"          0.46           -2.8            2.8         0        0          0             0            7431           235           248      44100.00       44112.86         44100.03         44100.28               4.65              23
         8.018033175 "player.c:2656"          0.46          -14.2           14.2         0        0          0             0            7424           234           248      44100.00       44113.09         44100.03         44100.28               4.86              24
         7.990952184 "player.c:2656"          0.45           -2.8            2.8         0        0          0             0            7433           235           249      44100.00       44112.94         44100.03         44100.27               4.86              24
         8.011984945 "player.c:2656"          0.46          -14.2           14.2         0        0          0             0            7431           235           248      44100.00       44112.53         44100.03         44100.27               5.07              24
         7.987053174 "player.c:2656"          0.45           -2.8            2.8         0        0          0             0            7428           236           248      44100.00       44112.63         44100.03         44100.28               5.05              23

Here is the output from $ shairport-sync --displayConfig. I was experimenting with a very small drift tolerance, and you can see in this case that there was a little (very little!) overcompensation.

        0.003304427 "shairport.c:2133" >> Display Config Start.
         0.006822813 "shairport.c:2133" 
         0.000082969 "shairport.c:2133" From "uname -a":
         0.000024948 "shairport.c:2133"  Linux Officina 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux
         0.011436250 "shairport.c:2133" 
         0.000088750 "shairport.c:2133" From /etc/os-release:
         0.000025677 "shairport.c:2133"  Raspbian GNU/Linux 10 (buster)
         0.008873958 "shairport.c:2133" 
         0.000082240 "shairport.c:2133" From /sys/firmware/devicetree/base/model:
         0.000027916 "shairport.c:2133"  Raspberry Pi 3 Model B Rev 1.2
         0.000086459 "shairport.c:2133" 
         0.000025625 "shairport.c:2133" Shairport Sync Version String:
         0.000020625 "shairport.c:2133"  4.3.5-dev-50-g616b6e71-OpenSSL-Avahi-ALSA-stdout-pipe-soxr-metadata-mqtt-dbus-sysconfdir:/etc
         0.000025052 "shairport.c:2133" 
         0.000020677 "shairport.c:2133" Command Line:
         0.000020677 "shairport.c:2133"  ./shairport-sync -X
         0.000096510 "shairport.c:2133" 
         0.000024688 "shairport.c:2133" Configuration File:
         0.000019687 "shairport.c:2133"  /etc/shairport-sync.conf
         0.000020990 "shairport.c:2133" 
         0.000264479 "shairport.c:2133" Configuration File Settings:
         0.000025938 "shairport.c:2133"  general : 
         0.000021302 "shairport.c:2133"  {
         0.000020000 "shairport.c:2133"    drift_tolerance_in_seconds = 0.0005;
         0.000042448 "shairport.c:2133"  };
         0.000022656 "shairport.c:2133"  alsa : 
         0.000021875 "shairport.c:2133"  {
         0.000021667 "shairport.c:2133"    output_device = "hw:IQaudIODAC";
         0.000022448 "shairport.c:2133"    mixer_control_name = "Digital";
         0.000021406 "shairport.c:2133"  };
         0.000021042 "shairport.c:2133"  diagnostics : 
         0.000020937 "shairport.c:2133"  {
         0.000022865 "shairport.c:2133"    statistics = "yes";
         0.000021771 "shairport.c:2133"    log_verbosity = 1;
         0.000021146 "shairport.c:2133"  };
         0.000020625 "shairport.c:2133" 
         0.000018437 "shairport.c:2133" >> Display Config End.
         0.000041302 "shairport.c:2135" >> Goodbye!
         0.000174427 "shairport.c:1733" normal exit

One anomaly in your log is that there are no drift samples registered. I'll have to think about why that is -- maybe the acceptance algorithm is too strict. In any case, the drift samples are diagnostic only -- they have no function apart from providing a little information. In my sample, it seems that there is a drift of about 5 parts per million between the iPad and the Pi's clocks, which seems reasonable.

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