NetBSD-Docs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Guide instructions for a2dp bluetooth connections
Hi,
Attached is the text with instructions for a2dp connections which should be
added to the guide. It's just the text as I don't know how to do the markup
and would like a second pair of eyes to look at it first.
Feel free to omit any sections which you believe are duplicated or mentioned
in previous sections within the bluetooth audio section.
Best regards,
Nat
21.7.3 A2DP Audio:
It is possible to use A2DP speakers and microphones with bta2dpd(8). A2DP
connections are handled in userland using ACL connecions only.
First use btconfig(1) to perfom a device inqury:
# btconfig ubt0 inquiry
Device Discovery from device: ubt0 ... 1 response
1: bdaddr 42:91:7f:56:32:55 (unknown)
: name "jukebox"
: class [0x260404] Wearable Headset <Networking> <Rendering> <Audio>
: page scan rep mode 0x01
: clock offset 5957
: rssi 0
Add the appropriate host address and alias to /etc/bluetooth/hosts:
# echo "42:91:7f:56:32:55 juke" >>/etc/bluetooth/hosts
Check the device supports A2DP by performing an SDP query on the device
looking for "Advanced Audio" using spdquery(1):
# sdpquery -d ubt0 -a juke Browse | grep Advanced\ Audio
Advanced Audio Distribution, v1.2
Put the device into discoverable mode and use btpin(1) to pair with the device:
# btpin -d ubt0 -a juke -P -p 0000
Pairing.. done
*Note: Consult your user manual for the appropriate pin when paring.
21.7.3.1 A2DP speakers and headphones
Once paired it is possible to send 16 bit 44100 stereo audio to your speakers.
$ bta2dpd -a juke test.wav
*Note: Some devices play from files rapidly dropping data when used this way.
The recomended way to playback is to use the pad(4) device which is throttled,
sending audio data only as it is produced and gives a fully functioning
audio(4) device.
$ bta2dpd -V2 -na juke /dev/pad
This will send using the maximum possible volume (-V2) and wont close when
the corresponding pad(4) audio(4) device is closed with the (-n) switch.
It is possible to play audio using audioplay(1):
$ audioplay -d /dev/audio1 test.wav
All audio applications will work with A2DP provided the appropriate audio
device is selected using audiocfg(1).
# audiocfg list
0: [*] audio0 @ hdafg0: Realtek ALC269
playback: 2ch, 48000Hz
record: 2ch, 48000Hz
(PR) slinear_le 16/16, 2ch, { 32000, 44100, 48000, 88200, 96000, 192000 }
(PR) slinear_le 20/32, 2ch, { 32000, 44100, 48000, 88200, 96000, 192000 }
(PR) slinear_le 24/32, 2ch, { 32000, 44100, 48000, 88200, 96000, 192000 }
( ) ac3 16/16, 2ch, { 32000, 44100, 48000, 88200, 96000, 192000 }
1: [ ] audio1 @ pad0: Virtual Audio 10.99.4
playback: 2ch, 44100Hz
record: unavailable
(P-) slinear_le 16/16, 2ch, { 44100 }
# audiocfg default 1
21.7.3.2 A2DP microphones and input sources.
Once the device is paired it is possible to record to a file (raw audio) only.
$ bta2dpd -Ka juke record.dat
This will write 16 bit 44100 Hz stereo audio to record.dat can be played back
with the correspondin audioplay(1) command:
$ audioplay -f -e slinear_le -P 16 -c 2 -s 44100 record.dat
21.7.3.2 A2DP Network audio.
As the audio codec for A2DP compresses audio it is possible to use it to create
low latency, low bandwith network audio connections:
This is possible using bta2dpd(8)s test mode (-t) and nc(1).
On the local machine:
$ nc -ulk 54321 | bta2dpd -tK | audioplay -f -e slinear_le -P 16 -s 44100 \
-c 2 --
On the remote machine:
$ bta2dpd -V 2 -nt /dev/pad | nc -u "client" 54321
It is possible to lower the bandwith (and quality) of the audio by specifying
a lower bitpool value (-B)
bta2dpd -V 2 -nt -B 16 /dev/pad | nc -u "client" 54321
The default bitpool quality is 32.
Home |
Main Index |
Thread Index |
Old Index