Closed chuhuanping closed 5 years ago
Thanks for the post. The log does not reveal anything unusual. If you could enable statistics and post a log including statistics covering the time of a glitch, it would be very useful.
Jul 04 07:03:45 raspberrypi systemd[1]: Started Shairport Sync - AirPlay Audio Receiver.
Jul 04 07:03:55 raspberrypi shairport-sync[824]: sync error in milliseconds, net correction in ppm, corrections in ppm, total packets, missing packets, late packets, too late packets, resend requests, min DAC queue size, min buffer occupancy, max buffer occupancy, source
Jul 04 07:04:05 raspberrypi shairport-sync[824]: 1.24, -46.0, 46.0, 1003, 0, 0, 0, 0, 8203, 221, 241, 44100.04, 44139.28, 44097.66, 0.00, 0, -53.85
Jul 04 07:04:13 raspberrypi shairport-sync[824]: 1.87, -167.1, 167.1, 2006, 0, 0, 0, 0, 6149, 229, 244, 44099.96, 44183.40, 44091.84, 0.00, 0, -184.25
Jul 04 07:04:21 raspberrypi shairport-sync[824]: 1.33, -73.6, 73.6, 3009, 0, 0, 0, 0, 8230, 229, 242, 44100.00, 44008.72, 44093.33, 0.00, 0, -151.13
Jul 04 07:04:29 raspberrypi shairport-sync[824]: 0.97, 0.0, 0.0, 4012, 0, 0, 0, 0, 8312, 229, 241, 44099.98, 44104.97, 44095.26, 0.00, 0, -107.03
Jul 04 07:04:37 raspberrypi shairport-sync[824]: 0.90, -36.8, 36.8, 5015, 0, 0, 0, 0, 5109, 229, 246, 44100.01, 44107.97, 44095.17, 0.00, 0, -109.73
Jul 04 07:04:45 raspberrypi shairport-sync[824]: 1.73, -110.5, 110.5, 6018, 0, 0, 0, 0, 7079, 229, 243, 44100.00, 44116.05, 44096.22, 0.00, 0, -85.72
Jul 04 07:04:53 raspberrypi shairport-sync[824]: 1.29, -11.3, 11.3, 7021, 0, 0, 0, 0, 8326, 229, 242, 44099.99, 44095.85, 44096.42, 0.00, 0, -80.95
Jul 04 07:05:01 raspberrypi shairport-sync[824]: 1.80, -141.6, 153.0, 8024, 0, 0, 0, 0, 7819, 229, 242, 44099.99, 44110.02, 44096.19, 0.00, 0, -86.18
lines 1-18/18 (END)
pi@raspberrypi:~ $ sudo systemctl status shairport-sync
● shairport-sync.service - Shairport Sync - AirPlay Audio Receiver
Loaded: loaded (/lib/systemd/system/shairport-sync.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-07-04 07:03:45 CST; 2min 6s ago
Main PID: 824 (shairport-sync)
Memory: 4.5M
CGroup: /system.slice/shairport-sync.service
└─824 /usr/local/bin/shairport-sync
Jul 04 07:04:37 raspberrypi shairport-sync[824]: 0.90, -36.8, 36.8, 5015, 0, 0, 0, 0, 5109, 229, 246, 44100.01, 44107.97, 44095.17, 0.00, 0, -109.73
Jul 04 07:04:45 raspberrypi shairport-sync[824]: 1.73, -110.5, 110.5, 6018, 0, 0, 0, 0, 7079, 229, 243, 44100.00, 44116.05, 44096.22, 0.00, 0, -85.72
Jul 04 07:04:53 raspberrypi shairport-sync[824]: 1.29, -11.3, 11.3, 7021, 0, 0, 0, 0, 8326, 229, 242, 44099.99, 44095.85, 44096.42, 0.00, 0, -80.95
Jul 04 07:05:01 raspberrypi shairport-sync[824]: 1.80, -141.6, 153.0, 8024, 0, 0, 0, 0, 7819, 229, 242, 44099.99, 44110.02, 44096.19, 0.00, 0, -86.18
Jul 04 07:05:09 raspberrypi shairport-sync[824]: 1.85, -203.9, 203.9, 9027, 0, 0, 0, 0, 4453, 229, 247, 44100.00, 44107.35, 44095.68, 0.00, 0, -97.91
Jul 04 07:05:17 raspberrypi shairport-sync[824]: 1.08, -5.7, 5.7, 10030, 0, 0, 0, 0, 8286, 229, 242, 44100.00, 44095.12, 44096.14, 0.00, 0, -87.57
Jul 04 07:05:25 raspberrypi shairport-sync[824]: 0.69, 0.0, 0.0, 11033, 0, 0, 0, 0, 8359, 229, 241, 44100.00, 44097.80, 44096.76, 0.00, 0, -73.57
Jul 04 07:05:33 raspberrypi shairport-sync[824]: 0.62, 0.0, 0.0, 12036, 0, 0, 0, 0, 8329, 229, 241, 44099.99, 44102.69, 44096.56, 0.00, 0, -77.92
Jul 04 07:05:41 raspberrypi shairport-sync[824]: 1.25, -2.8, 2.8, 13039, 0, 0, 0, 0, 8226, 229, 241, 44100.00, 44109.46, 44097.20, 0.00, 0, -63.52
Jul 04 07:05:49 raspberrypi shairport-sync[824]: 1.58, -28.3, 28.3, 14042, 0, 0, 0, 0, 8289, 229, 241, 44100.00, 44101.02, 44096.93, -9.37, 9, -60.24
Thanks for the update. It does look like something unusual happened between 07:05:01
and 07:05:09
. The minimum DAC queue size, which should be nominally 8,450 to 8,800 frames, drops to 4,459, indicating a sudden load on the system.
Maybe the system is just too slow for the load it is under. To get an idea, could you let us know what model of Raspberry Pi you are using please?
Also, if you start with a log verbosity of 2 and post part of the log that looks something like the following:
Jul 04 08:31:45 RaspberryPi3BP shairport-sync[28500]: 0.583881380 "shairport.c:228" soxr_delay_index: 5.
Jul 04 08:31:45 RaspberryPi3BP shairport-sync[28500]: 0.000086875 "shairport.c:235" "soxr" interpolation has been chosen.
The soxr_delay_index
is an indication of how long some soxr
calculations take on the device, and the lower it is the better. If it is 30 or greater, the device is deemed too slow for soxr
, and basic
interpolation is chosen. This log (from a Pi 3B Plus) has a slightly different format – it's coming from an experimental edition of Shairport Sync.
Here is part of the log from a Pi B:
Jul 04 09:22:17 RaspberryPiB shairport-sync[7044]: 0.427157980|soxr_delay_index: 39.
Jul 04 09:22:17 RaspberryPiB shairport-sync[7044]: 0.005481769|"basic" interpolation has been chosen.
and here is one from a Pi Zero W:
Jul 04 09:56:05 zeropi shairport-sync[17150]: 0.466944996 "shairport.c:228" soxr_delay_index: 22.
Jul 04 09:56:05 zeropi shairport-sync[17150]: 0.003923966 "shairport.c:235" "soxr" interpolation has been chosen.
(Incidentally, the column that's fourth from the end of the statistics entries is an estimate of the true speed of the DAC. If the device's clock has been well conditioned by an ntp
server and there are no DAC underruns, this figure should be accurate after a settling time. Furthermore, if you let the statistics run for maybe 10 or 15 minutes, you should also get an accurate estimate of the drift, in parts per million, between the source clock and the local device clock in the third column from the end.)
0.593174146|soxr_delay_index: 22
First Generation RPI on default 700MHz CPU clock.
0.020251491|sync error in milliseconds, net correction in ppm, corrections in ppm, total packets, missing packets, late packets, too late packets, resend requests, min DAC queue size, min buffer occupancy, max buffer occupancy, source nominal frames per second, source actual frames per second, output frames per second, source clock drift in ppm, source clock drift sample count, rough calculated correction in ppm
10.051046642| -0.52, 0.0, 0.0, 1003, 0, 0, 0, 0, 8634, 257, 258, 44096.51, 44096.17, 44094.09, 0.00, 0, -54.97
8.006335142| -0.60, 0.0, 0.0, 2006, 0, 0, 0, 0, 8578, 257, 258, 44096.51, 44096.56, 44094.79, 0.00, 0, -39.03
8.006202189| -0.54, 0.0, 0.0, 3009, 0, 0, 0, 0, 8611, 257, 258, 44096.51, 44096.48, 44096.72, 0.00, 0, 4.72
8.006850246| -0.62, 0.0, 0.0, 4012, 0, 0, 0, 0, 8628, 257, 258, 44096.51, 44096.42, 44096.33, 0.00, 0, -4.27
8.005811377| -0.47, 0.0, 0.0, 5015, 0, 0, 0, 0, 8631, 257, 258, 44096.51, 44097.18, 44095.62, 0.00, 0, -20.29
8.006810484| 0.15, 0.0, 0.0, 6018, 0, 0, 0, 0, 8638, 257, 258, 44096.51, 44096.58, 44094.78, 0.00, 0, -39.35
8.006318660| 0.52, 0.0, 0.0, 7021, 0, 0, 0, 0, 8647, 257, 258, 44096.51, 44096.80, 44095.69, 0.00, 0, -18.64
8.007084829| 0.28, 0.0, 0.0, 8024, 0, 0, 0, 0, 8696, 257, 258, 44096.51, 44096.27, 44096.16, 0.00, 0, -8.05
8.005810083| 0.34, 0.0, 0.0, 9027, 0, 0, 0, 0, 8623, 257, 258, 44096.51, 44096.65, 44094.83, 0.00, 0, -38.20
8.007080295| 1.30, -2.8, 2.8, 10030, 0, 0, 0, 0, 8581, 257, 258, 44096.51, 44096.42, 44095.27, 0.00, 0, -28.11
8.005736606| 1.00, 0.0, 0.0, 11033, 0, 0, 0, 0, 8710, 257, 258, 44096.51, 44096.47, 44095.37, 0.00, 0, -25.92
8.006001899| 0.92, 0.0, 0.0, 12036, 0, 0, 0, 0, 8660, 257, 258, 44096.51, 44096.75, 44095.48, 0.00, 0, -23.41
8.007380187| 1.10, 0.0, 0.0, 13039, 0, 0, 0, 0, 8609, 257, 258, 44096.51, 44096.43, 44095.55, 0.00, 0, -21.83
8.005865583| 1.23, -2.8, 2.8, 14042, 0, 0, 0, 0, 8417, 256, 258, 44096.51, 44096.60, 44095.89, 0.00, 0, -14.19
8.006845932| 0.62, 0.0, 0.0, 15045, 0, 0, 0, 0, 8665, 257, 258, 44096.51, 44096.42, 44095.89, 0.58, 9, -14.79
8.005870364| 0.24, 0.0, 0.0, 16048, 0, 0, 0, 0, 8690, 257, 258, 44096.51, 44096.66, 44095.98, 1.09, 10, -13.19
8.007580742| 0.75, 0.0, 0.0, 17051, 0, 0, 0, 0, 8677, 257, 258, 44096.51, 44096.28, 44096.13, 0.58, 11, -9.22
8.005765248| 0.96, 0.0, 0.0, 18054, 0, 0, 0, 0, 8647, 257, 258, 44096.51, 44096.53, 44095.85, 0.58, 11, -15.69
8.005758726| 1.39, 0.0, 0.0, 19057, 0, 0, 0, 0, 8699, 257, 258, 44096.51, 44096.73, 44095.72, 1.38, 12, -19.45
8.006971191| 1.46, -19.8, 19.8, 20060, 0, 0, 0, 0, 8635, 257, 258, 44096.51, 44096.52, 44095.72, 1.38, 12, -19.42
8.006556726| 1.20, 0.0, 0.0, 21063, 0, 0, 0, 0, 8575, 251, 258, 44096.51, 44096.56, 44095.92, 1.15, 14, -14.72
8.006418278| 1.32, 0.0, 0.0, 22066, 0, 0, 0, 0, 8589, 257, 258, 44096.51, 44096.51, 44096.01, 1.15, 14, -12.61
8.006264854| 1.24, -2.8, 2.8, 23069, 0, 0, 0, 0, 8659, 257, 258, 44096.51, 44096.57, 44095.99, 0.88, 16, -12.84
8.005862457| 1.52, -28.3, 28.3, 24072, 0, 0, 0, 0, 8612, 257, 258, 44096.51, 44096.72, 44095.91, 1.33, 17, -15.06
8.006868041| 1.27, -2.8, 2.8, 25075, 0, 0, 0, 0, 8664, 257, 258, 44096.51, 44096.57, 44095.88, 1.60, 18, -15.90
8.008066638| 1.63, -14.2, 14.2, 26078, 0, 0, 0, 0, 8683, 257, 258, 44096.51, 44096.62, 44095.80, 1.63, 19, -17.80
8.004342409| 1.65, -45.3, 45.3, 27081, 0, 0, 0, 0, 8619, 256, 258, 44096.51, 44096.55, 44095.86, 1.82, 21, -16.73
8.006743013| 1.67, -59.5, 59.5, 28084, 0, 0, 0, 0, 8448, 256, 258, 44096.51, 44096.64, 44095.86, 1.65, 22, -16.48
8.006936704| 2.56, -801.6, 801.6, 29087, 0, 0, 0, 0, 4668, 256, 270, 44096.51, 44096.55, 44094.41, 1.91, 23, -49.69
8.008795363| 2.06, -291.7, 291.7, 30090, 0, 0, 0, 0, 8398, 256, 259, 44096.51, 44096.66, 44094.07, 1.91, 23, -57.39
8.007411144| 1.80, -96.3, 96.3, 31093, 0, 0, 0, 0, 8540, 257, 258, 44096.51, 44096.53, 44094.15, 2.07, 24, -55.69
8.002612053| 1.71, -68.0, 68.0, 32096, 0, 0, 0, 0, 8616, 254, 258, 44096.51, 44096.60, 44094.24, 2.13, 25, -53.73
8.006068721| 1.24, 0.0, 0.0, 33099, 0, 0, 0, 0, 8719, 257, 258, 44096.51, 44096.63, 44094.33, 2.13, 25, -51.73
8.006932489| 1.31, -19.8, 19.8, 34102, 0, 0, 0, 0, 8578, 253, 258, 44096.51, 44096.58, 44094.31, 2.15, 26, -52.11
8.005862338| 1.89, -198.3, 198.3, 35105, 0, 0, 0, 0, 8270, 255, 259, 44096.51, 44096.68, 44094.06, 2.36, 27, -57.94
8.007036133| 1.73, -56.6, 56.6, 36108, 0, 0, 0, 0, 8289, 256, 258, 44096.51, 44096.57, 44094.08, 2.52, 28, -57.75
8.005960018| 1.52, -31.2, 31.2, 37111, 0, 0, 0, 0, 8505, 256, 258, 44096.51, 44096.64, 44094.07, 2.43, 30, -57.90
8.009340778| 1.50, -14.2, 14.2, 38114, 0, 0, 0, 0, 8650, 257, 258, 44096.51, 44096.71, 44094.27, 2.65, 32, -53.55
8.003612849| 1.52, -14.2, 14.2, 39117, 0, 0, 0, 0, 8594, 257, 258, 44096.51, 44096.64, 44094.17, 2.73, 33, -55.89
8.008493595| 1.84, -184.1, 184.1, 40120, 0, 0, 0, 0, 8285, 257, 259, 44096.51, 44096.68, 44093.99, 2.73, 33, -60.01
8.004051660| 1.71, -96.3, 96.3, 41123, 0, 0, 0, 0, 6742, 256, 263, 44096.51, 44096.65, 44094.01, 2.79, 34, -59.54
8.006037533| 1.83, -107.6, 113.3, 42126, 0, 0, 0, 0, 6033, 257, 265, 44096.51, 44096.72, 44093.95, 2.91, 35, -61.13
8.007179450| 1.68, -51.0, 51.0, 43129, 0, 0, 0, 0, 8452, 256, 258, 44096.51, 44096.60, 44093.99, 2.91, 35, -60.12
8.005976459| 1.80, -130.3, 136.0, 44132, 0, 0, 0, 0, 7589, 257, 261, 44096.51, 44096.67, 44093.91, 3.00, 36, -61.95
0.016776422|avahi: request to add "_raop._tcp" service with metadata
0.020685286|avahi: service 'AF31192A3A11@Raspberrypi' group is registering.
0.880276623|avahi: service 'AF31192A3A11@Raspberrypi' successfully added.
0.544709199|soxr_delay_index: 22.
7.540158324|Connection 1: new connection from 192.168.11.2:57925 to self at 192.168.11.3:5000.
0.011042618|Connection 1: Received an RTSP Packet of type "ANNOUNCE":
Many thanks. As far as I can see, it all looks pretty good except for that -801.6 ppm correction followed by another large one at -291.7, which are very large and does not look unnecessary – it's not followed by a drift in the opposite direction. The source clock drift is very low and stable, so it looks unlikely that clocks suddenly changed.
If you direct the output to the built-in DAC rather than the Sony USB, does the problem persist? Of course the quality won't be as good, but I wonder if the glitch is there on the built-in DAC.
Rpi built-in DAC always fine, I checked by headphone.
Thanks. This may indicate a problem with the Sony USB system. However, there are a few things to try in Shairport Sync to work around the issue.
One thing to try is to set the use_precision_timing
in the alsa
section of the configuration file to "no"
. (It may be that the information being returned by the Sony driver for precision timing is incorrect.)
Another thing to try is to set the output_format
to "S16"
, i.e. 16-bit operation, to see if the problem persists. If it goes away, then try one of the 24-bit settings, as they will sound somewhat better.
Turning off "Precision timing" resolved my problem. Thanks
I’m glad it worked, and thanks for your efforts.
I have a SONY USB DAC, which reports the wrong timing 44104Hz. I turned on soxr in CONF file,still can hear the glitch for each couple minutes.