论坛风格切换切换到宽版
  • 39阅读
  • 7回复

shairport-sync [复制链接]

上一主题 下一主题
离线北斗星
 

只看楼主 倒序阅读 使用道具 楼主   发表于: 2025-06-23
离线北斗星

只看该作者 沙发   发表于: 2025-06-24
- 输入 aplay -L  查看声卡:

root@armbian:~# aplay -L


null
    Discard all samples (playback) or generate zero samples (capture)
hw:CARD=P230Q200,DEV=0
    P230-Q200,
    Direct hardware device without any conversions
hw:CARD=P230Q200,DEV=1
    P230-Q200,
    Direct hardware device without any conversions
plughw:CARD=P230Q200,DEV=0
    P230-Q200,
    Hardware device with all software conversions
plughw:CARD=P230Q200,DEV=1
    P230-Q200,
    Hardware device with all software conversions
default:CARD=P230Q200
    P230-Q200,
    Default Audio Device
sysdefault:CARD=P230Q200
    P230-Q200,
    Default Audio Device
dmix:CARD=P230Q200,DEV=0
    P230-Q200,
    Direct sample mixing device
dmix:CARD=P230Q200,DEV=1
    P230-Q200,
    Direct sample mixing device
root@armbian:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
hw:CARD=P230Q200,DEV=0
    P230-Q200,
    Direct hardware device without any conversions
hw:CARD=P230Q200,DEV=1
    P230-Q200,
    Direct hardware device without any conversions
plughw:CARD=P230Q200,DEV=0
    P230-Q200,
    Hardware device with all software conversions
plughw:CARD=P230Q200,DEV=1
    P230-Q200,
    Hardware device with all software conversions
default:CARD=P230Q200
    P230-Q200,
    Default Audio Device
sysdefault:CARD=P230Q200
    P230-Q200,
    Default Audio Device
dmix:CARD=P230Q200,DEV=0
    P230-Q200,
    Direct sample mixing device
dmix:CARD=P230Q200,DEV=1
    P230-Q200,
    Direct sample mixing device
hw:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    Direct hardware device without any conversions
plughw:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    Hardware device with all software conversions
default:CARD=AUDIO
    SUCA AUDIO, USB Audio
    Default Audio Device
sysdefault:CARD=AUDIO
    SUCA AUDIO, USB Audio
    Default Audio Device
front:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    Front output / input
surround21:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    Direct sample mixing device
离线北斗星

只看该作者 板凳   发表于: 2025-06-24
离线北斗星

只看该作者 地板   发表于: 2025-06-24

apt update&&apt upgrade

apt install --no-install-recommends build-essential git autoconf automake libtool \
    libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev \
    libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt-dev xxd


(2)先下载并构建源代码安装 NQPTP:

    如果没有 Git ,请先安装好 Git 。

    autoreconf 可能要等待一会完成。

    shairport-sync 的 airplay2 需要 nqptp 的支持。

git clone https://github.com/mikebrady/nqptp.git
cd nqptp
autoreconf -fi
./configure --with-systemd-startup
make
make install
    (3)下载并构建shairport-sync的源代码安装:

    autoreconf 可能要等待一会完成。

git clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync
autoreconf -fi
./configure --sysconfdir=/etc --with-alsa \
    --with-soxr --with-avahi --with-ssl=openssl --with-systemd --with-airplay-2
make
make install


-  启用服务:

#nqptp:
systemctl enable nqptp
systemctl start nqptp

#shairport-sync:
systemctl enable shairport-sync


2. 查看播放的声卡设备

- 输入 aplay -L  查看声卡:

root@armbian:~# aplay -L
离线北斗星

只看该作者 4楼  发表于: 2025-06-24
https://www.bilibili.com/opus/838888519748288569


apt update&&apt upgrade

apt install --no-install-recommends build-essential git autoconf automake libtool \
    libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev \
    libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt-dev xxd

https://github.com/mikebrady/alac

(2)先下载并构建源代码安装 NQPTP:

    如果没有 Git ,请先安装好 Git 。

    autoreconf 可能要等待一会完成。

    shairport-sync 的 airplay2 需要 nqptp 的支持。

git clone https://github.com/mikebrady/nqptp.git
cd nqptp
autoreconf -fi
./configure --with-systemd-startup
make
make install
    (3)下载并构建shairport-sync的源代码安装:

    autoreconf 可能要等待一会完成。

git clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync
autoreconf -fi
./configure --sysconfdir=/etc --with-alsa \
    --with-soxr --with-avahi --with-ssl=openssl --with-systemd --with-airplay-2
make
make install


-  启用服务:

#nqptp:
systemctl enable nqptp
systemctl start nqptp

#shairport-sync:
systemctl enable shairport-sync


2. 查看播放的声卡设备

- 输入 aplay -L  查看声卡:

root@armbian:~# aplay -L
离线北斗星

只看该作者 5楼  发表于: 2025-06-24
我选择的是 hw:CARD=P230Q200,DEV=1 可以简用成 hw:1,后续这个值会用到。
- 输入 alsamixer ,按F6选择我们的USB声卡(F6: Select sound card)查看该USB声卡的音频混音器控制名称:


alsamixer
" Speaker " 为我买的声卡音频混音器控制名称(mixer_control_name),不同的声卡的名称可能不同,按实际名称取用记录,后续用到。
测试插上的音箱是否能发声,可以输入以下命令测试:
aplay -D hw:1 /usr/share/sounds/alsa/Front_Center.wav

3. 配置 shairport-sync
- shairport-sync 的配置文件在  /etc/shairport-sync.conf ,你可以使用vi命令或nano命令对配置文件修改( vi  /etc/shairport-sync.conf )( nano /etc/shairport-sync.conf )或者直接 SFTP 到机子,找到 /etc/shairport-sync.conf 修改该配置文件保存上传:


shairport-sync 的配置文件
- 配置条目比较多,我们只使用基本的,删除条目前的双斜杠 " //  " 即可激活当前一条配置:
general [backcolor=rgba(255, 255, 255, 0.5)]={name [backcolor=rgba(255, 255, 255, 0.5)]= "N1 Airplay";volume_range_db [backcolor=rgba(255, 255, 255, 0.5)]= 60;};alsa [backcolor=rgba(255, 255, 255, 0.5)]={output_device [backcolor=rgba(255, 255, 255, 0.5)]= "hw:1";mixer_control_name [backcolor=rgba(255, 255, 255, 0.5)]= "Speaker";};- 其中 :
"name" 为设置的AirPlay服务器名称,可以任取个你喜欢的名字。
"output_device" 设置为 hw:1 ,因为第二步查看声卡时我们要使用的声卡是 hw:1 。
"mixer_control_name" 设置为 Speaker ,即为第二步时我们要使用的音频混音器控制名称,这样配置好 shairport-sync 就能找到我们的声卡设备输出。
如果使用 airplay2 的多设备播放特性,请修改配置文件中的 airplay_device_id ,格式为 0x + 六位十六进制数字 + L ,如 “ 0xA4BE703EB7529201L ”,每个设备设置好不同的值防止一个传递播放后另一个设备就掉线。
最后记得保存好配置文件。

4. 重启 shairport-sync 开始使用
- 执行下面语句为shairport-sync 添加音频设备权限:
sudo usermod -aG audio shairport-sync- 插上音响,重启 shairport-sync 服务:
sudo systemctl restart shairport-sync.service- 查看 shairport-sync 服务的状态:
sudo systemctl status shairport-sync.service如果进行尝试隔空投送时,查看 shairport-sync 服务的状态日志如果没有出现 Error 错误,并能够发声,应该就可以正常使用了,在同一局域网你的苹果设备或者 Owntone、Music Assistant 音乐资源库就可以找到你的 AirPlay 设备名称进行播放。
离线北斗星

只看该作者 6楼  发表于: 2025-06-24
https://github.com/mikebrady/shairport-sync/issues/1548

null
    Discard all samples (playback) or generate zero samples (capture)
hw:CARD=P230Q200,DEV=0
    P230-Q200,
    Direct hardware device without any conversions
hw:CARD=P230Q200,DEV=1
    P230-Q200,
    Direct hardware device without any conversions
plughw:CARD=P230Q200,DEV=0
    P230-Q200,
    Hardware device with all software conversions
plughw:CARD=P230Q200,DEV=1
    P230-Q200,
    Hardware device with all software conversions
default:CARD=P230Q200
    P230-Q200,
    Default Audio Device
sysdefault:CARD=P230Q200
    P230-Q200,
    Default Audio Device
dmix:CARD=P230Q200,DEV=0
    P230-Q200,
    Direct sample mixing device
dmix:CARD=P230Q200,DEV=1
    P230-Q200,
    Direct sample mixing device
root@armbian:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
hw:CARD=P230Q200,DEV=0
    P230-Q200,
    Direct hardware device without any conversions
hw:CARD=P230Q200,DEV=1
    P230-Q200,
    Direct hardware device without any conversions
plughw:CARD=P230Q200,DEV=0
    P230-Q200,
    Hardware device with all software conversions
plughw:CARD=P230Q200,DEV=1
    P230-Q200,
    Hardware device with all software conversions
default:CARD=P230Q200
    P230-Q200,
    Default Audio Device
sysdefault:CARD=P230Q200
    P230-Q200,
    Default Audio Device
dmix:CARD=P230Q200,DEV=0
    P230-Q200,
    Direct sample mixing device
dmix:CARD=P230Q200,DEV=1
    P230-Q200,
    Direct sample mixing device
hw:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    Direct hardware device without any conversions
plughw:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    Hardware device with all software conversions
default:CARD=AUDIO
    SUCA AUDIO, USB Audio
    Default Audio Device
sysdefault:CARD=AUDIO
    SUCA AUDIO, USB Audio
    Default Audio Device
front:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    Front output / input
surround21:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=AUDIO,DEV=0
    SUCA AUDIO, USB Audio
    Direct sample mixing device



apt install --no-install-recommends build-essential git autoconf automake libtool \
    libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev \
    libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt-dev xxd


shairport-sync -h
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)
    pipe
    stdout

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:P230Q200"
      "hw:AUDIO"

Settings and options for the audio backend "pipe":
    Provide the pipe's pathname. The default is "/tmp/shairport-sync-audio".

There are no settings or options for the audio backend "stdout".
快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个