我的NAS基于Cubie载重(Ubuntu和ArmbianLinux3.4.113-sun7i)和集成蓝牙。现在我正试图通过蓝色的方式向我的蓝牙扬声器发送音频。
最初,我使用了这个手册来安装和安装https://forum.armbian.com/topic/6480-bluealsa-bluetooth-audio-using-alsa-not-pulseaudio/
在使用本手册重新编译和设置青蒿素之后,我以同样的问题结束了:https://raspberrypi.stackexchange.com/questions/90267/how-to-stream-sound-to-a-bluetooth-device-from-a-raspberry-pi-zero
这给了我更多的进步,例如,在连接到蓝牙扬声器:[BH129]# bluealsa: D: ../../src/bluez.c:1267: Signal: org.freedesktop.DBus.Objec tManager.InterfacesAdded()时,我可以看到这样的消息。
我没有看到这样的信息时,安装和安装根据第一手册。
启动后我会先手动启动蓝帘。顺便问一下,蓝牙配置文件是否正确:- hsp-hs耳机(v1.2)?
bluealsa -p hsp-hs &布卢伊拉萨似乎在奔跑:
root@Artisan:~# ps -ef | grep bluealsa
root 2591 2557 0 15:16 pts/0 00:00:00 bluealsa -p hsp-hs
root 2803 2557 1 15:58 pts/0 00:00:00 grep --color=auto bluealsa下面是我与演讲者的联系方式:
[bluetooth]# scan on
Discovery started
[CHG] Controller 43:29:B1:55:01:01 Discovering: yes
[NEW] Device EB:06:EF:47:83:A6 BH129
[bluetooth]# pair EB:06:EF:47:83:A6
Attempting to pair with EB:06:EF:47:83:A6
[CHG] Device EB:06:EF:47:83:A6 Class: 0x240404
[CHG] Device EB:06:EF:47:83:A6 Icon: audio-card
[CHG] Device EB:06:EF:47:83:A6 Connected: yes
[CHG] Device EB:06:EF:47:83:A6 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device EB:06:EF:47:83:A6 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device EB:06:EF:47:83:A6 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device EB:06:EF:47:83:A6 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device EB:06:EF:47:83:A6 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device EB:06:EF:47:83:A6 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
[CHG] Device EB:06:EF:47:83:A6 Paired: yes
Pairing successful
[CHG] Device EB:06:EF:47:83:A6 Connected: no
[bluetooth]# trust EB:06:EF:47:83:A6
[CHG] Device EB:06:EF:47:83:A6 Trusted: yes
Changing EB:06:EF:47:83:A6 trust succeeded
[bluetooth]# connect EB:06:EF:47:83:A6
Attempting to connect to EB:06:EF:47:83:A6
[CHG] Device EB:06:EF:47:83:A6 Connected: yes
[BH129]# bluealsa: D: ../../src/bluez.c:1267: Signal: org.freedesktop.DBus.ObjectManager.InterfacesAdded()
Connection successful
[BH129]# exit
[DEL] Controller 43:29:B1:55:01:01 BlueZ 5.37 [default]这是蓝牙状态
root@Artisan:~# systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-12-18 15:13:37 UTC; 36min ago
Docs: man:bluetoothd(8)
Main PID: 1307 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
└─1307 /usr/lib/bluetooth/bluetoothd --noplugin=sap --plugin=a2dp
Dec 18 15:13:37 Artisan bluetoothd[1307]: Ignoring (cli) thermometer
Dec 18 15:13:37 Artisan bluetoothd[1307]: Ignoring (cli) heartrate
Dec 18 15:13:37 Artisan bluetoothd[1307]: Ignoring (cli) cyclingspeed
Dec 18 15:13:37 Artisan bluetoothd[1307]: Ignoring (cli) sixaxis
Dec 18 15:13:37 Artisan bluetoothd[1307]: Bluetooth management interface 1.0 initialized
Dec 18 15:13:37 Artisan bluetoothd[1307]: Failed to obtain handles for "Service Changed" characterist
Dec 18 15:13:37 Artisan systemd[1]: Started Bluetooth service.
Dec 18 15:14:36 Artisan bluetoothd[1307]: Endpoint registered: sender=:1.52 path=/MediaEndpoint/A2DPS
Dec 18 15:14:36 Artisan bluetoothd[1307]: Endpoint registered: sender=:1.52 path=/MediaEndpoint/A2DPS
Dec 18 15:14:40 Artisan bluetoothd[1307]: Ignoring unsupported UUID for addition我对"Alsa config“部分有点困惑,最后以这样的方式配置它:
root@Artisan:~# cat /usr/share/alsa/alsa.conf.d/20-bluealsa.conf # BlueALSA integration setup
defaults.bluealsa.service "org.bluealsa"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 20000
defaults.bluealsa.battery "yes"
ctl.bluealsa {
@args [ SRV BAT ]
@args.SRV {
type string
default {
@func refer
name defaults.bluealsa.service
}
}
@args.BAT {
type string
default {
@func refer
name defaults.bluealsa.battery
}
}
type bluealsa
service $SRV
battery $BAT
}
pcm.bluealsa {
@args [ SRV DEV PROFILE DELAY ]
@args.SRV {
type string
default {
@func refer
name defaults.bluealsa.service
}
}
@args.DEV {
type string
default {
@func refer
name defaults.bluealsa.device
}
}
@args.PROFILE {
type string
default {
@func refer
name defaults.bluealsa.profile
}
}
@args.DELAY {
type integer
default {
@func refer
name defaults.bluealsa.delay
}
}
type plug
slave.pcm {
type bluealsa
service $SRV
device $DEV
profile $PROFILE
delay $DELAY
}
hint {
show {
@func refer
name defaults.namehint.extended
}
description "Bluetooth Audio Hub"
}
}
pcm {
type bluealsa
interface "hci0"
device EB:06:EF:47:83:A6
profile "a2dp"
}
ctl.!default {
type bluealsa
interface "hci0"
}这是~/asoundrc
root@Artisan:~# cat ~/.asoundrc
defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "EB:06:EF:47:83:A6"
defaults.bluealsa.profile "a2dp"下面是我尝试用aplay播放mp3文件时得到的结果:
root@Artisan:~# aplay -D bluealsa:DEV=EB:06:EF:47:83:A6,PROFILE=a2dp,HCI=hci0 /ncsdata/Music/night.mp3
ALSA lib conf.c:4622:(parse_args) Unknown parameter HCI
ALSA lib conf.c:4755:(snd_config_expand) Parse arguments error: No such file or directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM bluealsa:DEV=EB:06:EF:47:83:A6,PROFILE=a2dp,HCI=hci0
aplay: main:722: audio open error: No such file or directory
root@Artisan:~# aplay -D bluealsa:DEV=EB:06:EF:47:83:A6,PROFILE=a2dp /ncsdata/Music/night.mp3
bluealsa: D: ../../src/bluealsa-dbus.c:139: Called: org.bluealsa.Manager1.GetPCMs()
ALSA lib ../../../src/asound/bluealsa-pcm.c:755:(_snd_pcm_bluealsa_open) Couldn't get BlueALSA PCM: PCM not found
aplay: main:722: audio open error: No such devicempd被配置为蓝色a
audio_output {
type "alsa"
name "ALSA Bluetooth Headset"
device "bluealsa"
mixer_type "software"
}下面是我尝试用mpd玩mp3的方法:
root@Artisan:~# /etc/init.d/mpd start
[ ok ] Starting mpd (via systemctl): mpd.service.
root@Artisan:~# mpc clear
volume: 90% repeat: off random: off single: off consume: off
ERROR: Failed to open audio output
root@Artisan:~# mpc add night.mp3
root@Artisan:~# mpc play
Unknown artist - Night (Original)
[playing] #1/1 0:00/2:46 (0%)
volume: 90% repeat: off random: off single: off consume: off
root@Artisan:~# mpc stop
volume: 90% repeat: off random: off single: off consume: off
ERROR: Failed to open audio output错误信息在设置第一和第二手册之后是相同的。演讲者当然不会发出任何声音。我觉得我已经接近解决方案了,但我不知道我错过了什么。谷歌游戏或mpd信息-没有运气。我很感谢你的帮助。
发布于 2019-12-21 20:17:05
那么,在跳舞和购买另一个蓝牙接收器后,我设法通过蓝伊莎和mpd在上面播放音频。
下面是我编辑过的一些秘密:
/usr/share/alsa/alsa.con.d/20-青壮年
# BlueALSA integration setup
defaults.bluealsa.service "org.bluealsa"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000
defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "EB:06:EF:A6:A9:D4"
ctl.bluealsa {
@args [ SRV BAT ]
@args.SRV {
type string
default {
@func refer
name defaults.bluealsa.service
}
}
@args.BAT {
type string
default {
@func refer
name defaults.bluealsa.battery
}
}
type bluealsa
service $SRV
battery $BAT
}
pcm.bluealsa {
@args [ SRV DEV PROFILE DELAY ]
@args.SRV {
type string
default {
@func refer
name defaults.bluealsa.service
}
}
@args.DEV {
type string
default {
@func refer
name defaults.bluealsa.device
}
}
@args.PROFILE {
type string
default {
@func refer
name defaults.bluealsa.profile
}
}
@args.DELAY {
type integer
default {
@func refer
name defaults.bluealsa.delay
}
}
type plug
slave.pcm {
type bluealsa
service $SRV
device $DEV
profile $PROFILE
delay $DELAY
}
hint {
show {
@func refer
name defaults.namehint.extended
}
description "Bluetooth Audio Hub"
}
}
pcm {
type bluealsa
interface "hci0"
device "EB:06:EF:A6:A9:D4"
profile "a2dp"
}
ctl.!default {
type bluealsa
interface "hci0"
}/lib/systemd/system/蓝牙.system
[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)
ConditionPathIsDirectory=/sys/class/bluetooth
[Service]
Type=dbus
BusName=org.bluez
ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap --plugin=a2dp
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
[Install]
WantedBy=bluetooth.target
Alias=dbus-org.bluez.service/lib/systemd/system/blearsa.service
[Unit]
Description=BluezAlsa proxy
Requires=bluetooth.service
After=bluetooth.service
[Service]
Type=simple
#User=
#Group=audio
ExecStart=/usr/bin/bluealsa -i hci0 -p a2dp-source -S
[Install]
WantedBy=multi-user.target不要忘记启用bluealsa.service:
systemctl enable bluealsa.service~/..asoundrc是不必要的,而且是删除的。
重新启动这件事对我有用。另一件事是它是如何工作的-不幸的是,音频是极不正常的。它每半秒中断一次,不取决于NAS和蓝牙接收器之间的距离,也不取决于文件格式。不明白为什么和寻找解决办法。有什么想法吗?
https://askubuntu.com/questions/1197072
复制相似问题