.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "BLUEALSA" 8 "January 2023" "BlueALSA v4.1.1" "System Manager's Manual"
.SH NAME
bluealsa \- Bluetooth Audio ALSA Backend
.SH SYNOPSIS
.sp
\fBbluealsa\fP \-p \fIPROFILE\fP [\fIOPTION\fP]...
.SH DESCRIPTION
.sp
\fBbluealsa\fP is a Linux daemon to give applications access to Bluetooth audio
streams using the Bluetooth A2DP, HFP and/or HSP profiles.
It provides a D\-Bus API to applications, and can be used by ALSA applications
via libasound plugins (see \fBbluealsa\-plugins(7)\fP for details).
.SH OPTIONS
.INDENT 0.0
.TP
.B \-h\fP,\fB \-\-help
Output a usage message and exit.
.TP
.B \-V\fP,\fB \-\-version
Output the version number and exit.
.TP
.B \-S\fP,\fB \-\-syslog
Send output to system logger (\fBsyslogd(8)\fP).
By default, log output is sent to stderr.
.TP
.BI \-B \ NAME\fR,\fB \ \-\-dbus\fB= NAME
BlueALSA D\-Bus service name suffix.
Without this option, \fBbluealsa\fP registers itself as an \(dqorg.bluealsa\(dq
D\-Bus service. For more information see the \fI\%EXAMPLES\fP below.
.TP
.BI \-i \ hciX\fR,\fB \ \-\-device\fB= hciX
HCI device to use. Can be specified multiple times to select more than one
HCI. Because HCI numbering can change after a system reboot, this option
also accepts HCI MAC address for the \fIhciX\fP value, for example:
\fB\-\-device=00:11:22:33:44:55\fP
.sp
Without this option, the default is to use all available HCI devices.
.TP
.BI \-p \ NAME\fR,\fB \ \-\-profile\fB= NAME
Enable \fINAME\fP Bluetooth profile.
May be given multiple number of times to enable multiple profiles.
.sp
It is mandatory to enable at least one Bluetooth profile.
For the list of supported profiles see \fI\%Profiles\fP in the \fBNOTES\fP section
below.
.TP
.BI \-c \ NAME\fR,\fB \ \-\-codec\fB= NAME
Enable or disable \fINAME\fP Bluetooth audio codec.
May be given multiple number of times to enable (or disable) multiple
codecs.
.sp
In order to disable given audio codec (remove it from the list of audio
codecs enabled by default), the \fINAME\fP has to be prefixed with \fB\-\fP
(minus) character. It is not possible to disable SBC and CVSD codecs which
are mandatory for A2DP and HFP/HSP respectively.
.sp
By default BlueALSA enables SBC, AAC (if AAC support is compiled\-in), CVSD
and mSBC (if mSBC support is compiled\-in).
For the list of supported audio codecs see the \(dqAvailable BT audio codecs\(dq
section of the \fBbluealsa\fP command\-line help message.
.TP
.BI \-\-initial\-volume\fB= NUM
Set the initial volume to \fINUM\fP % when a device is first connected.
\fINUM\fP must be an integer in the range from \fB0\fP to \fB100\fP\&.
.sp
By default the volume of all PCMs of a device is set to 100% (full volume)
when the device is first connected. For some devices, particularly
headphones, this can lead to an unpleasant experience. This option allows
the user to choose an alternative initial volume level. Only one value can
be specified and each device on first connect will have the volume level of
all its PCMs set to this value. However, a device with native volume
control may then immediately override this level. On subsequent connects
the volume will be set to the remembered value from the last disconnection.
See \fI\%Volume control\fP in the \fBNOTES\fP section below for more information.
.TP
.BI \-\-keep\-alive\fB= SEC
Keep Bluetooth transport alive for \fISEC\fP number of seconds after streaming
was closed.
.sp
This option is required when using \fBbluealsa\fP with applications that
close and then immediately re\-open the same PCM as part of their
initialization; for example applications built with the \fBportaudio\fP
portability library and many other \(dqportable\(dq applications.
.sp
It can also be useful when playing short audio files in quick succession.
It will reduce the gap between playbacks caused by Bluetooth audio
transport acquisition.
.TP
.B \-\-disable\-realtek\-usb\-fix
Since Linux kernel 5.14 Realtek USB adapters have required \fBbluealsa\fP to
apply a fix for mSBC. This option disables that fix and may be necessary
when using an earlier kernel.
.TP
.B \-\-a2dp\-force\-mono
Force monophonic sound for A2DP profile.
.TP
.B \-\-a2dp\-force\-audio\-cd
Force 44.1 kHz sampling frequency for A2DP profile.
Some Bluetooth devices can handle streams sampled at either 48kHz or
44.1kHz, in which case they normally default to using 48kHz.
With this option, \fBbluealsa\fP will request such a device uses only 44.1
kHz sample rate.
.TP
.B \-\-a2dp\-volume
Enable native A2DP volume control.
By default \fBbluealsa\fP will use its own internal scaling algorithm to
attenuate the volume. This option disables that internal scaling and
instead passes the volume change request to the A2DP device.
This feature can also be controlled during runtime for individual PCMs via
the BlueALSA D\-Bus API or by the BlueALSA ALSA plugins; and if so the
changed setting will be remembered. See \fI\%Volume control\fP in the \fBNOTES\fP
section below for more information.
Note that this feature might not work with all Bluetooth headsets.
.TP
.BI \-\-sbc\-quality\fB= MODE
Set SBC encoder quality.
Default value is \fBhigh\fP\&.
.sp
The \fIMODE\fP can be one of:
.INDENT 7.0
.IP \(bu 2
\fBlow\fP \- low audio quality (mono: 114 kbps, stereo: 213 kbps)
.IP \(bu 2
\fBmedium\fP \- medium audio quality (mono: 132 kbps, stereo: 237 kbps)
.IP \(bu 2
\fBhigh\fP \- high audio quality (mono: 198 kbps, stereo: 345 kbps)
.IP \(bu 2
\fBxq\fP \- SBC Dual Channel HD (SBC XQ) (452 kbps)
.IP \(bu 2
\fBxq+\fP \- SBC Dual Channel HD (SBC XQ+) (551 kbps)
.UNINDENT
.TP
.BI \-\-mp3\-algorithm\fB= TYPE
Select LAME encoder internal algorithm.
Default value is \fBexpensive\fP\&.
.sp
The \fITYPE\fP can be one of:
.INDENT 7.0
.IP \(bu 2
\fBfast\fP \- OK quality, really fast
.IP \(bu 2
\fBcheap\fP \- good quality, fast
.IP \(bu 2
\fBexpensive\fP \- near\-best quality, not too slow
.IP \(bu 2
\fBbest\fP \- best quality, slow
.UNINDENT
.sp
If CPU power consumption is not an issue, one might safely select \fBbest\fP
as the algorithm type.
Also, please note that the true quality is determined by the selected bit
rate or used VBR quality option (\fB\-\-mp3\-vbr\-quality\fP).
.TP
.BI \-\-mp3\-vbr\-quality\fB= MODE
Set variable bit rate (VBR) quality.
Default value is \fBstandard\fP\&.
.sp
The \fIMODE\fP can be one of:
.INDENT 7.0
.IP \(bu 2
\fBlow\fP \- low audio quality (100\-130 kbps)
.IP \(bu 2
\fBmedium\fP \- medium audio quality (140\-185 kbps)
.IP \(bu 2
\fBstandard\fP \- standard audio quality (170\-210 kbps)
.IP \(bu 2
\fBhigh\fP \- high audio quality (190\-250 kbps)
.IP \(bu 2
\fBextreme\fP \- best audio quality, no low\-pass filter (220\-260 kbps)
.UNINDENT
.TP
.B \-\-aac\-afterburner
Enables Fraunhofer AAC afterburner feature, which is a type of analysis by
synthesis algorithm.
This feature increases the audio quality at the cost of increased
processing power and overall memory consumption.
.TP
.BI \-\-aac\-bitrate\fB= BPS
Set the target bit rate for constant bit rate (CBR) mode or the maximum
peak bit rate for variable bit rate (VBR) mode.
Default value is \fB220000\fP bits per second.
.TP
.BI \-\-aac\-latm\-version\fB= NUM
Select LATM syntax version used for AAC audio transport.
Default value is \fB1\fP\&.
.sp
The \fINUM\fP can be one of:
.INDENT 7.0
.IP \(bu 2
\fB0\fP \- LATM syntax specified by ISO\-IEC 14496\-3 (2001), should work with
all older BT devices
.IP \(bu 2
\fB1\fP \- LATM syntax specified by ISO\-IEC 14496\-3 (2005), should work with
newer BT devices
.UNINDENT
.TP
.B \-\-aac\-true\-bps
Enable true \(dqbit per second\(dq bit rate.
.sp
A2DP AAC specification requires that for the constant bit rate (CBR) mode
every RTP frame has the same bit rate and for the variable bit rate (VBR)
mode the maximum peak bit rate limit is also per RTP frame.
However, a single RTP frame does not contain a single full second of audio.
This option enables true bit rate calculation (per second), which means
that per RTP frame bit rate may vary even for CBR mode.
This feature is not enabled by default, because it violates A2DP AAC
specification.
Enabling it should result in an enhanced audio quality, but will for sure
produce fragmented RTP frames.
If RTP fragmentation is not supported by used A2DP sink device (e.g.,
headphones) one might hear clearly audible clicks in the playback audio.
In such case, please do not enable this option.
.TP
.B \-\-aac\-vbr
Prefer variable bit rate mode over constant bit rate mode.
.sp
Please note, that this option does not necessarily mean that the variable
bit rate (VBR) mode will be used.
Used AAC configuration depends on a remote Bluetooth device capabilities.
.TP
.BI \-\-lc3plus\-bitrate\fB= BPS
Set LC3plus encoder bit rate for constant bit rate mode (CBR) as \fIBPS\fP\&.
Default value is \fB396800\fP bits per second.
.TP
.B \-\-ldac\-abr
Enables LDAC adaptive bit rate, which will dynamically adjust encoder
quality based on the connection stability.
.TP
.BI \-\-ldac\-quality\fB= MODE
Specifies LDAC encoder quality.
Default value is \fBstandard\fP\&.
.sp
The \fIMODE\fP can be one of:
.INDENT 7.0
.IP \(bu 2
\fBmobile\fP \- mobile quality (44.1 kHz: 303 kbps, 48 kHz: 330 kbps)
.IP \(bu 2
\fBstandard\fP \- standard quality (44.1 kHz: 606 kbps, 48 kHz: 660 kbps)
.IP \(bu 2
\fBhigh\fP \- high quality (44.1 kHz: 909 kbps, 48 kHz: 990 kbps)
.UNINDENT
.TP
.BI \-\-xapl\-resp\-name\fB= NAME
Set the product name send in the XAPL response message.
By default, the name is set as \(dqBlueALSA\(dq.
However, some devices (reported with e.g., Sony WM\-1000XM4) will not
provide battery level notification unless the product name is set as
\(dqiPhone\(dq.
.UNINDENT
.SH NOTES
.SS Profiles
.sp
\fBbluealsa\fP provides support for Bluetooth Advanced Audio Distribution Profile
(A2DP), Hands\-Free Profile (HFP) and Headset Profile (HSP).
A2DP profile is dedicated for streaming music (i.e., stereo, 48 kHz or more
sampling frequency), while HFP and HSP for two\-way voice transmission (mono, 8
kHz or 16 kHz sampling frequency).
.sp
The Bluetooth audio profiles are not peer\-to\-peer; they each have a source or
gateway role (a2dp\-source, hfp\-ag, or hsp\-ag) and a sink or target role
(a2dp\-sink, hfp\-hf, hsp\-hs). The source/gateway role is the audio player (e.g.,
mobile phone), the sink/target role is the audio renderer (e.g., headphones or
speaker). The \fBbluealsa\fP daemon can perform any combination of profiles and
roles, although it is most common to use it either as a source/gateway:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bluealsa \-p a2dp\-source \-p hfp\-ag \-p hsp\-ag
.EE
.UNINDENT
.UNINDENT
.sp
or as a sink/target:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bluealsa \-p a2dp\-sink \-p hfp\-hf \-p hsp\-hs
.EE
.UNINDENT
.UNINDENT
.sp
or with oFono for HFP support,
.sp
source/gateway:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bluealsa \-p a2dp\-source \-p hfp\-ofono \-p hsp\-ag
.EE
.UNINDENT
.UNINDENT
.sp
sink/target:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bluealsa \-p a2dp\-sink \-p hfp\-ofono \-p hsp\-hs
.EE
.UNINDENT
.UNINDENT
.sp
With A2DP, \fBbluealsa\fP always includes the mandatory SBC codec and may also
include various optional codecs like AAC, aptX, and other.
.sp
With HFP, \fBbluealsa\fP always includes the mandatory CVSD codec and may also
include the optional mSBC codec.
.sp
The full list of available optional codecs, which depends on selected
compilation options, will be shown with \fBbluealsa\fP command\-line help message.
.sp
The list of profile \fINAME\fP\-s accepted by the \fB\-\-profile=NAME\fP option:
.INDENT 0.0
.IP \(bu 2
\fBa2dp\-source\fP \- Advanced Audio Source (streaming audio to connected device)
.IP \(bu 2
\fBa2dp\-sink\fP \- Advanced Audio Sink (receiving audio from connected device)
.IP \(bu 2
\fBhfp\-ofono\fP \- Hands\-Free AG/HF handled by oFono
.IP \(bu 2
\fBhfp\-ag\fP \- Hands\-Free Audio Gateway
.IP \(bu 2
\fBhfp\-hf\fP \- Hands\-Free
.IP \(bu 2
\fBhsp\-ag\fP Headset Audio Gateway
.IP \(bu 2
\fBhsp\-hs\fP \- Headset
.UNINDENT
.sp
The \fBhfp\-ofono\fP is available only when \fBbluealsa\fP was compiled with oFono
support. Enabling HFP over oFono will automatically disable \fBhfp\-hf\fP and
\fBhfp\-ag\fP\&.
.sp
BlueZ permits only one service to register the HSP and HFP profiles, and that
service is automatically registered with every HCI device.
.sp
For the A2DP profile, BlueZ allows each HCI device to be registered to a
different service, so it is possible to have multiple instances of
\fBbluealsa\fP offering A2DP support, each with a unique service name given with
the \fB\-\-dbus=\fP option, so long as they are registered to different HCI devices
using the \fB\-\-device=\fP option. See the \fI\%EXAMPLES\fP below.
.sp
A profile connection does not immediately initiate the audio stream(s); audio
can only flow when the profile transport is \(dqacquired\(dq. Acquisition can only be
performed by the source/gateway role. When acting as source/gateway,
\fBbluealsa\fP acquires the profile transport (i.e., initiates the audio
connection) when a client opens a PCM. When \fBbluealsa\fP is acting as target,
a client can open a PCM as soon as the profile is connected, but the audio
stream(s) will not begin until the remote source/gateway has acquired the
transport.
.SS Volume control
.sp
The Bluetooth specifications for HFP and HSP include optional support
for volume control of the target by the gateway device. For A2DP, volume
control is optionally provided by the AVRCP profile. \fBbluealsa\fP provides a
single, consistent, abstracted interface for volume control of PCMs. This
interface can use the native Bluetooth features or alternatively \fBbluealsa\fP
also implements its own internal volume control, called \(dqsoft\-volume\(dq. For A2DP
the default is to use soft\-volume, but this can be overridden to use the
Bluetooth native support where available by using the \fB\-\-a2dp\-volume\fP command
line option. For HFP/HSP the default is to use Bluetooth native volume control.
.sp
When using soft\-volume, \fBbluealsa\fP scales PCM samples before encoding, and
after decoding, and does not interact with the Bluetooth AVRCP volume property
or HFP/HSP volume control. Volume can only be modified by local clients. (Note
that Bluetooth headphones or speakers with their own volume controls will still
be able to alter their own volume, but this change will not be notified to
\fBbluealsa\fP local clients, they will only see the soft\-volume setting).
.sp
When using native volume control, \fBbluealsa\fP links the PCM volume setting to
the AVRCP volume property or HFP/HSP volume control. No scaling of PCM samples
is applied. Volume can be modified by both local clients and the remote device.
Local clients will be notified of volume changes made by controls on the
remote device.
.sp
A2DP native volume control does not permit independent values for left and
right channels, so when a client sets such values \fBbluealsa\fP will set the
Bluetooth volume as the average of the two channels.
.sp
Volume level, mute status, and soft\-volume selection can all be controlled for
each PCM by using the D\-Bus API (or by using ALSA plugins, see
\fBbluealsa\-plugins(7)\fP for more information). The current value of these
settings for each PCM is stored in the filesystem so that the device can be
disconnected and later re\-connected without losing its volume settings.
.sp
When a device is connected, the volume level of its PCMs is set according to
the following criteria (highest priority first):
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP 1. 3
saved value from previous connection of the device
.IP 2. 3
value set by the \fB\-\-initial\-volume\fP command line option
.IP 3. 3
\fB100%\fP
.UNINDENT
.UNINDENT
.UNINDENT
.sp
its mute status according to:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP 1. 3
saved value from previous connection
.IP 2. 3
\fBfalse\fP
.UNINDENT
.UNINDENT
.UNINDENT
.sp
and its soft\-volume status according to:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP 1. 3
saved value from previous connection
.IP 2. 3
\fBfalse\fP for SCO (i.e., use native volume control).
.IP 3. 3
\fBfalse\fP for A2DP if the \fB\-\-a2dp\-volume\fP command line option is given
.IP 4. 3
\fBtrue\fP for A2DP (i.e., use soft\-volume control).
.UNINDENT
.UNINDENT
.UNINDENT
.sp
When native volume control is enabled, then the remote device may also
modify the volume level after this initial setting. Mute and soft\-volume are
implemented locally by the \fBbluealsa\fP daemon and cannot be modified by the
remote device.
.sp
Note that \fBbluealsa\fP relies on support from BlueZ to implement native volume
control for A2DP using AVRCP, and BlueZ has not always provided robust support
here. It is recommended to use BlueZ release 5.65 or later to be certain that
native A2DP volume control will always be available with those devices which
provide it.
.SH FILES
.INDENT 0.0
.TP
.B /etc/dbus\-1/system.d/bluealsa.conf
BlueALSA service D\-Bus policy file.
D\-Bus will deny all access to the \fBorg.bluealsa\fP service (even to \fIroot\fP)
unless permission is granted by a policy file. The default file permits
only \fIroot\fP to own this service, and only members of the \fIaudio\fP group to
exchange messages with it.
.TP
.B /var/lib/bluealsa/\fIXX:XX:XX:XX:XX:XX\fP
BlueALSA volume persistent state storage. Files are named after the
Bluetooth device address to which they refer.
.UNINDENT
.SH EXAMPLES
.sp
Emulate Bluetooth headset with A2DP and HSP support:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bluealsa \-p a2dp\-sink \-p hsp\-hs
.EE
.UNINDENT
.UNINDENT
.sp
On systems with more than one HCI device, it is possible to expose different
profiles on different HCI devices.
A system with three HCI devices might (for example) use \fIhci0\fP for an A2DP sink
service named \(dqorg.bluealsa.sink\(dq and both \fIhci1\fP and \fIhci2\fP for an A2DP source
service named \(dqorg.bluealsa.source\(dq.
Such a setup might be created as follows:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
bluealsa \-B sink \-i hci0 \-p a2dp\-sink &
bluealsa \-B source \-i hci1 \-i hci2 \-p a2dp\-source &
.EE
.UNINDENT
.UNINDENT
.sp
Setup like this will also require a change to the BlueALSA D\-Bus configuration
file in order to allow connection with BlueALSA services with suffixed names.
Please add following lines to the BlueALSA D\-Bus policy:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
\&...
\&...
.EE
.UNINDENT
.UNINDENT
.SH COPYRIGHT
.sp
Copyright (c) 2016\-2023 Arkadiusz Bokowy.
.sp
The bluez\-alsa project is licensed under the terms of the MIT license.
.SH SEE ALSO
.sp
\fBbluealsa\-aplay(1)\fP, \fBbluealsa\-cli(1)\fP, \fBbluealsa\-rfcomm(1)\fP,
\fBbluetoothctl(1)\fP, \fBbluealsa\-plugins(7)\fP, \fBbluetoothd(8)\fP
.INDENT 0.0
.TP
.B Project web site
\fI\%https://github.com/arkq/bluez\-alsa\fP
.UNINDENT
.\" Generated by docutils manpage writer.
.