Skip to main content

Thread: AudIO (A2DP) streaming from device to Ubuntu host using ALSA


hi,

i've succeeded streaming audio android device ubuntu 12.04 host pc of pulseaudio. needed using command line commands (i.e. no ui helpers), since next step make on embedded system.

these steps followed in case useful:

a) edit /etc/bluetooth/audio.conf , add
code:
enable=source
on general section (read somewhere if fails enable=socket might work).

b) pair device using:
code:
hcitool dev -> bluetooth device <bt_dev> hcitool scan ->get device mac address bluez-simple-agent <bt_dev> xx:xx:xx:xx:xx:xx -> xx:xx:xx:xx:xx:xx device mac address
note: previous steps stopped working after while (still working on embedded system), i'm still trying figure out why. output get:

code:
requestconfirmation (/org/bluez/955/hci0/dev_xx_xx_xx_xx_xx_xx, 357756) confirm passkey (yes/no): yes release creating device failed: org.freedesktop.dbus.error.noreply: did not receive reply. possible causes include: remote application did not send reply, message bus security policy blocked reply, reply timeout expired, or network connection broken.
anyway, after setting device blueman (sudo apt-get install blueman) next steps still work.

c) configure android device use ubuntu host media media audio (on htc 1 x go settings->bluetooth->select device->select use media audio.

d) bluetooth device object path. can output on step b or use:
code:
adapter=`dbus-send --print-reply --system --dest=org.bluez / org.bluez.manager.defaultadapter | cut -d'"' -f 2 | grep org`  device_path=`dbus-send --system --dest=org.bluez --print-reply $adapter org.bluez.adapter.listdevices | grep path | cut -d'"' -f 2`
e) connect device audio source
code:
dbus-send --print-reply --system --dest=org.bluez $device_path org.bluez.audiosource.connect
f) bluez audio source , alsa audio sink
code:
source=`pacmd list-sources | grep bluez | grep card | cut -d"<" -f2` sink=`pacmd list-sinks | grep alsa | grep card | grep pci | cut -d"<" -f2` (note: 1 might not work on side, use list-sinks , yours)
g) connect bluez audio source alsa output
code:
id=`pactl load-module module-loopback source=$source sink=$sink`
h) play audio on mobile device , listen on speakers

i) stop playback
code:
pactl unload-module $id
j) disconnect audio source:
code:
dbus-send --print-reply --system --dest=org.bluez $device_path org.bluez.audiosource.disconnect
now, using alsa only. tried doing going through steps e , created/modified file /etc/asound.conf:

code:
#/etc/asound.conf pcm.btheadset {     type plug     slave {         pcm {             type bluetooth             device xx:xx:xx:xx:xx:xx             profile "auto"         }        }         hint {         show on         description "bt headset"     }    }  ctl.btheadset {   type bluetooth }
but when do

code:
arecord -d btheadset test.wav
i get:
code:
recording wave 'test.wav' : unsigned 8 bit, rate 8000 hz, mono alsa lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) slave pcm not usable arecord: set_params:1059: broken configuration pcm: no configurations available
i've looked around apparently people want stream host device (headset model) , posts ~3 years old. suggestions welcome

i trying achieve same result varying levels of success.

1 thing have noticed think asound.conf set bluetooth output, not input. have yet find way of configuring bluez output directly alsa (which holy grail both seeking).

managed better quality result pulseaudio using pacat in example http://thelinuxexperiment.com/guinea-pigs/tyler-b/fix-pulseaudio-loopback-delay/

nice rid of pa adds processing overhead underpowered raspberry pi.


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] AudIO (A2DP) streaming from device to Ubuntu host using ALSA


Ubuntu

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues