Closed teelekkung closed 10 months ago
Thanks for the post.
Let me suggest you set the output device as described here. You do not need to use the .asound
method.
Also, your output device must be capable of working at 44100 frames per second. You can check with speaker-test
using the extra -r44100
argument.
```bash ● shairport-sync.service - Shairport Sync - AirPlay Audio Receiver Loaded: loaded (/lib/systemd/system/shairport-sync.service; disabled; vendor preset: enabled) Active: inactive (dead) since Sun 2023-08-13 16:32:12 +07; 1min 2s ago Process: 863 ExecStart=/usr/local/bin/shairport-sync --log-to-syslog (code=exited, status=0/SUCCESS) Main PID: 863 (code=exited, status=0/SUCCESS) CPU: 1.866s Aug 13 16:32:12 raspi shairport-sync[863]: ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory Aug 13 16:32:12 raspi shairport-sync[863]: ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings Aug 13 16:32:12 raspi shairport-sync[863]: ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory Aug 13 16:32:12 raspi shairport-sync[863]: ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name Aug 13 16:32:12 raspi shairport-sync[863]: ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory Aug 13 16:32:12 raspi shairport-sync[863]: ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory Aug 13 16:32:12 raspi shairport-sync[863]: ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default Aug 13 16:32:12 raspi shairport-sync[863]: fatal error: An unrecoverable error, "output_device_error_2", has been detected. Doing an emergency exit, as no run_this_if_an_unfixable_error_is_detected program. Aug 13 16:32:12 raspi systemd[1]: shairport-sync.service: Succeeded. Aug 13 16:32:12 raspi systemd[1]: shairport-sync.service: Consumed 1.866s CPU time. ```
```bash 0.001385703 "shairport.c:2253" Startup in AirPlay 2 mode, with features 0x405fca00,0x1c340 on device "dc:a6:32:55:bf:a7". 0.000104723 "shairport.c:2292" Version String: "4.2.1d0-55-g8821ec28-AirPlay2-smi9-alac-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc" 0.000021759 "shairport.c:2311" Command Line: "shairport-sync -v". 0.000305018 "shairport.c:2347" Log Verbosity is 1. 0.000047612 "audio_alsa.c:1020" alsa: alsa_maximum_stall_time of 0.200000 sec. 0.000047944 "audio_alsa.c:1309" alsa: disable_standby_mode is "never". 0.000018630 "audio_alsa.c:1313" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds. 0.000017407 "audio_alsa.c:1315" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds. 0.000021889 "audio_alsa.c:1355" alsa: output device name is "default". 0.000229111 "shairport.c:2395" disable_resend_requests is off. 0.000026407 "shairport.c:2396" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately. 0.000047556 "shairport.c:2400" statistics_requester status is 0. 0.000017630 "shairport.c:2405" rtsp listening port is 7000. 0.000014222 "shairport.c:2406" udp base port is 6001. 0.000013944 "shairport.c:2407" udp port range is 10. 0.000014037 "shairport.c:2408" player name is "Sahakiyat's HiFi Speaker". 0.000015186 "shairport.c:2409" backend is "alsa". 0.000016870 "shairport.c:2410" run_this_before_play_begins action is "(null)". 0.000016463 "shairport.c:2411" run_this_after_play_ends action is "(null)". 0.000016092 "shairport.c:2412" wait-cmd status is 0. 0.000016315 "shairport.c:2413" run_this_before_play_begins may return output is 0. 0.000016185 "shairport.c:2414" run_this_if_an_unfixable_error_is_detected action is "(null)". 0.000016426 "shairport.c:2416" run_this_before_entering_active_state action is "(null)". 0.000016408 "shairport.c:2418" run_this_after_exiting_active_state action is "(null)". 0.000016407 "shairport.c:2420" active_state_timeout is 10.000000 seconds. 0.000019296 "shairport.c:2421" mdns backend "(null)". 0.000016112 "shairport.c:2423" interpolation setting is "auto". 0.000016407 "shairport.c:2427" interpolation soxr_delay_threshold is 30000000. 0.000016426 "shairport.c:2428" resync time is 0.050000 seconds. 0.000016574 "shairport.c:2429" resync recovery time is 0.100000 seconds. 0.000016611 "shairport.c:2430" allow a session to be interrupted: 0. 0.000015982 "shairport.c:2431" busy timeout time is 0. 0.000015740 "shairport.c:2432" drift tolerance is 0.002000 seconds. 0.000016760 "shairport.c:2433" password is "(null)". 0.000015666 "shairport.c:2434" default airplay volume is: -24.000000. 0.000017352 "shairport.c:2435" high threshold airplay volume is: -16.000000. 0.000017056 "shairport.c:2437" check for higher-than-threshold volume for new play session is disabled. 0.000016555 "shairport.c:2443" ignore_volume_control is 0. 0.000015982 "shairport.c:2447" volume_max_db is not set 0.000016037 "shairport.c:2448" volume range in dB (zero means use the range specified by the mixer): 0. 0.000017092 "shairport.c:2450" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0. 0.000016797 "shairport.c:2454" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right). 0.000016351 "shairport.c:2456" disable_synchronization is 0. 0.000015852 "shairport.c:2457" use_mmap_if_available is 1. 0.000015889 "shairport.c:2458" output_format automatic selection is enabled. 0.000015963 "shairport.c:2462" output_rate automatic selection is enabled. 0.000015982 "shairport.c:2466" audio backend desired buffer length is 0.200000 seconds. 0.000016870 "shairport.c:2468" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds. 0.000017093 "shairport.c:2470" audio backend latency offset is 0.000000 seconds. 0.000016833 "shairport.c:2472" audio backend silence lead-in time is "auto". 0.000016463 "shairport.c:2476" zeroconf regtype is "_raop._tcp". 0.000016037 "shairport.c:2477" decoders_supported field is 3. 0.000015778 "shairport.c:2478" use_apple_decoder is 1. 0.000015703 "shairport.c:2479" alsa_use_hardware_mute is 0. 0.000015778 "shairport.c:2483" no special mdns service interface was requested. 0.000038945 "shairport.c:2486" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf". 0.000020796 "shairport.c:2493" metadata enabled is 1. 0.000016278 "shairport.c:2494" metadata pipename is "/tmp/shairport-sync-metadata". 0.000016259 "shairport.c:2495" metadata socket address is "(null)" port 0. 0.000016222 "shairport.c:2497" metadata socket packet size is "500". 0.000016371 "shairport.c:2498" get-coverart is 1. 0.000015944 "shairport.c:2516" loudness is 0. 0.000016204 "shairport.c:2517" loudness reference level is -20.000000 0.000181555 "rtsp.c:4183" metadata pipe name is "/tmp/shairport-sync-metadata". 0.005859037 "shairport.c:2618" NQPTP is online. 1.497354851 "shairport.c:255" "soxr" interpolation has been chosen. 3.381536758 "rtsp.c:2919" Connection 1: AP2 PTP connection from fe80::8a9:c46f:919c:2e83:53110 ("Sahakiyat’s MacBook Air") to self at fe80::fd5e:d767:e34b:cb0:7000. 0.152908240 "rtsp.c:3335" Connection 1. AP2 Buffered Audio Stream. 0.014218519 "audio_alsa.c:178" *fatal error: An unrecoverable error, "output_device_error_2", has been detected. Doing an emergency exit, as no run_this_if_an_unfixable_error_is_detected program. 0.004015703 "shairport.c:1729" emergency exit ```
Log From reodering card and unplug dac by systemctl start Log From reodering card and unplug dac by manual run in terminal
You don't need to do any of that!
My dac is Fiio btr5 2021 which is support up to 384k for this I put here because I forgot to put in issue at the first place
this is result after I use your guide to output
0.007504666 "audio_alsa.c:637" *fatal error: audio_alsa: Unable to set hw parameters for device "hw:BTR5": Protocol error.
but showup in shairport-sync -h
```bash Please use the configuration file for settings where possible. Many more settings are available in the configuration file. Usage: shairport-sync [options...] or: shairport-sync [options...] -- [audio output-specific options] Options: -h, --help Show this help. -V, --version Show version information -- the version string. -X, --displayConfig Output OS information, version string, command line, configuration file and active settings to the log. --statistics Print some interesting statistics. More will be printed if -v / -vv / -vvv are also chosen. -v, --verbose Print debug information; -v some; -vv more; -vvv lots -- generally too much. -c, --configfile=FILE Read configuration settings from FILE. Default is /etc/shairport-sync.conf. -a, --name=NAME Set service name. Default is the hostname with first letter capitalised. --password=PASSWORD Require PASSWORD to connect. Default is no password. (Classic AirPlay only.) -p, --port=PORT Set RTSP listening port. Default 5000; 7000 for AirPlay 2./ -L, --latency=FRAMES [Deprecated] Set the latency for audio sent from an unknown device. The default is to set it automatically. -S, --stuffing=MODE Set how to adjust current latency to match desired latency, where: "basic" inserts or deletes audio frames from packet frames with low processor overhead, and "soxr" uses libsoxr to minimally resample packet frames -- moderate processor overhead. The default "auto" setting chooses basic or soxr depending on processor capability. The "soxr" option is only available if built with soxr support. -B, --on-start=PROGRAM Run PROGRAM when playback is about to begin. -E, --on-stop=PROGRAM Run PROGRAM when playback has ended. For -B and -E options, specify the full path to the program and arguments, e.g. "/usr/bin/logger". Executable scripts work, but the file must be marked executable have the appropriate shebang (#!/bin/sh) on the first line. -w, --wait-cmd Wait until the -B or -E programs finish before continuing. -o, --output=BACKEND Select audio backend. They are listed at the end of this text. The first one is the default. -m, --mdns=BACKEND Use the mDNS backend named BACKEND to advertise the AirPlay service through Bonjour/ZeroConf. They are listed at the end of this text. If no mdns backend is specified, they are tried in order until one works. -r, --resync=THRESHOLD [Deprecated] resync if error exceeds this number of frames. Set to 0 to stop resyncing. -t, --timeout=SECONDS Go back to idle mode from play mode after a break in communications of this many seconds (default 120). Set to 0 never to exit play mode. --tolerance=TOLERANCE [Deprecated] Allow a synchronization error of TOLERANCE frames (default 88) before trying to correct it. --logOutputLevel Log the output level setting -- a debugging option, useful for determining the optimum maximum volume. -M, --metadata-enable Ask for metadata from the source and process it. Much more flexibility with configuration file settings. --metadata-pipename=PIPE send metadata to PIPE, e.g. --metadata-pipename=/tmp/shairport-sync-metadata. The default is /tmp/shairport-sync-metadata. -g, --get-coverart Include cover art in the metadata to be gathered and sent. --log-to-syslog Send debug and statistics information through syslog If used, this should be the first command line argument. -u, --use-stderr [Deprecated] This setting is not needed -- stderr is now used by default and syslog is selected using --log-to-syslog. Available mDNS backends: avahi Available audio backends: alsa (default) Settings and options for the audio backend "alsa": -d output-device set the output device, default is "default". -c mixer-control set the mixer control name, default is to use no mixer. -m mixer-device set the mixer device, default is the output device. -i mixer-index set the mixer index, default is 0. hardware output devices: "hw:BTR5" "hw:Headphones" "hw:vc4hdmi0" "hw:vc4hdmi1" ```
Thanks, so the output device name to use is ”hw:BTR5”
.
It may be that the device can not do a frame rate of 44100. Can you check with speaker-test
? Another thing to do is to try to use sps-alsa-explore
to check the devices available.
This issue has been inactive for 28 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.
What happened?
re from #1715 shairport-sync that start from systemctl will always choose card0 expect to output to card default from .asoundrc (raspi-config also edit this file when change audio output device) manual start by terminal
shairport-sync
seem to use what .asoundrc has set forreodering from /etc/modprobe.d/alsa-base.conf will fix just fine but problem is when unplug dac , shairport-sync will refuse to start because of can't find output (safety protocol something)
Relevant log output
Output From speaker-test
```bash speaker-test 1.2.4 Playback device is default Stream parameters are 48000Hz, S16_LE, 2 channels WAV file(s) Rate set to 48000Hz (requested 48000Hz) Buffer size range from 32 to 96000 Period size range from 16 to 48000 Using max buffer size 96000 Periods = 4 was set period_size = 24000 was set buffer_size = 96000 0 - Front Left 1 - Front Right Time per period = 1.518432 0 - Front Left 1 - Front Right Time per period = 3.000092 0 - Front Left 1 - Front Right ```
My .asoundrc
```bash pcm.!default { type asym playback.pcm { type plug slave.pcm "output" } capture.pcm { type plug slave.pcm "input" } } pcm.output { type hw card 3 } ctl.!default { type hw card 3 } ```
my aplay -l
```bash **** List of PLAYBACK Hardware Devices **** card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: BTR5 [FiiO BTR5], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 ```
Configuration Information.
Output From shairport-sync -X
```bash >> Display Config Start. From "uname -a": Linux raspi 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 4 Model B Rev 1.1 Shairport Sync Version String: 4.2.1d0-55-g8821ec28-AirPlay2-smi9-alac-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc Command Line: shairport-sync -X Configuration File: /etc/shairport-sync.conf Configuration File Settings: general : { name = "Sahakiyat's HiFi Speaker"; }; >> Display Config End. >> Goodbye! ```
How did you install Shairport Sync?
Built from source
Check previous issues