sjdean
Posts: 8
Joined: Tue Sep 20, 2016 4:32 pm

Pulseaudio , BlueZ, Ofono and HFP Problems

Sun Jul 30, 2017 4:51 pm

Hi,

Im building a second car PC. The second one I determined was going to have Bluetooth and FM Radio through an RTL-SDR dongle.

I've read virtually every single guide and now have the following.

I am utilising a USB Bluetooth Dongle

Code: Select all

Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
I've compiled from source and using BlueZ 5.46, Pulseaudio 9.99, Ofono 1.20

So far so good, A2DP works pretty flawlessly. But when it comes to HFP, the result is a bit more lacklustre. I have headset=ofono on the end of the bluetooth-discovery line in default.pa but still no joy.

When I call my mobile, all channels appear to open, and the USB Microphone connected to the raspberry pi, is routed through to the Phone via Bluetooth. So that's a good start. And when I put the microphone into Mono, I do hear audio at the other end of the connection.

I just don't hear any audio through the 3.5mm jack - bear in mind this works flawlessly for A2DP.


For A2DP plaback, I see:

Code: Select all

A2DP Playback
pi@master:~ $ sudo pactl list sinks short
[b]0	alsa_output.platform-soc_audio.analog-stereo	module-alsa-card.c	s16le 2ch 44100Hz	RUNNING[/b]
Assertion 'pthread_mutex_lock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:90, function pa_mutex_lock(). Aborting.
pi@master:~ $ sudo pactl list sources short
0	alsa_input.usb-AKM_AK5371-00-AK5371.analog-stereo	module-alsa-card.c	s16le 2ch 48000Hz	SUSPENDED
1	alsa_output.platform-soc_audio.analog-stereo.monitor	module-alsa-card.c	s16le 2ch 44100Hz	IDLE
5	bluez_source.98_E7_F5_F8_EA_6F.a2dp_source	module-bluez5-device.c	s16le 2ch 44100Hz	RUNNING
Assertion 'pthread_mutex_lock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:90, function pa_mutex_lock(). Aborting.
Note the sink line that says running. I suspect when it comes to HFP, this is the problem:

Code: Select all

pi@master:~ $ sudo pactl list sinks short
0	alsa_output.platform-soc_audio.analog-stereo	module-alsa-card.c	s16le 2ch 44100Hz	SUSPENDED
2	bluez_sink.98_E7_F5_F8_EA_6F.headset_audio_gateway	module-bluez5-device.c	s16le 1ch 8000Hz	RUNNING
Assertion 'pthread_mutex_lock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:90, function pa_mutex_lock(). Aborting.
pi@master:~ $ sudo pactl list sources short
0	alsa_input.usb-AKM_AK5371-00-AK5371.analog-stereo	module-alsa-card.c	s16le 2ch 48000Hz	RUNNING
1	alsa_output.platform-soc_audio.analog-stereo.monitor	module-alsa-card.c	s16le 2ch 44100Hz	SUSPENDED
8	bluez_sink.98_E7_F5_F8_EA_6F.headset_audio_gateway.monitor	module-bluez5-device.c	s16le 1ch 8000Hz	IDLE
9	bluez_source.98_E7_F5_F8_EA_6F.headset_audio_gateway	module-bluez5-device.c	s16le 1ch 8000Hz	RUNNING
Assertion 'pthread_mutex_lock(&m->mutex) == 0' failed at pulsecore/mutex-posix.c:90, function pa_mutex_lock(). Aborting.
Notice here that alsa output is suspended?

Additionally to this

I can't see any trace of headset_head_unit - though this may be a red herring:

Code: Select all

Controller 00:1A:7D:DA:71:13
	Name: master
	Alias: master
	Class: 0xea2420
	Powered: yes
	Discoverable: no
	Pairable: yes
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v1D6Bp0246d052E
	Discovering: no

Code: Select all

Card #3
	Name: bluez_card.98_E7_F5_F8_EA_6F
	Driver: module-bluez5-device.c
	Owner Module: 25
	Properties:
		device.description = "Nexus 6P"
		device.string = "98:E7:F5:F8:EA:6F"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "phone"
		bluez.path = "/org/bluez/hci0/dev_98_E7_F5_F8_EA_6F"
		bluez.class = "0x5a020c"
		bluez.alias = "Nexus 6P"
		device.icon_name = "audio-card-bluetooth"
	Profiles:
		a2dp_source: High Fidelity Capture (A2DP Source) (sinks: 0, sources: 1, priority: 10, available: yes)
		headset_audio_gateway: Headset Audio Gateway (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
		off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
	Active Profile: headset_audio_gateway
	Ports:
		phone-output: Phone (priority: 0, latency offset: 0 usec, available)
			Part of profile(s): headset_audio_gateway
		phone-input: Phone (priority: 0, latency offset: 0 usec, available)
			Part of profile(s): a2dp_source, headset_audio_gateway
Any thoughts would be greatly appreciated. Im just wondering given my experiments with the microhone, silent on stereo, and sound in mono, whether Im getting a mono source from the phone and pulseaudio is unable to explicitly up convert to stereo?

Thanks
Simon

sjdean
Posts: 8
Joined: Tue Sep 20, 2016 4:32 pm

Re: Pulseaudio , BlueZ, Ofono and HFP Problems

Tue Aug 01, 2017 11:04 am

I figured this out in the end.

First the Alsa Stereo out was not being used as default. That was quite trivial.

However the next issue, was that PulseAudio wasn't remixing between Mono and Stereo. So a Mono Source couldn't be send to a Stereo Sink.

There is a setting in daemon.conf for remixing, which many of the guides for getting Bluetooth working, recommend to turn off.

I find that PulseAudio runs quite happily when left to its own devices. Enable yes for remixing.

Simon

vitalic
Posts: 9
Joined: Tue Sep 20, 2016 7:29 pm

Re: Pulseaudio , BlueZ, Ofono and HFP Problems

Sat Aug 26, 2017 11:50 pm

Hey,

found your thread on search via Google. We're working on something similar, raspi car PC with Android Auto. Maybe it is interisting for you too.

At the moment we have the same problem with mic input and output. Maybe you are so gentle to post your settings of the pulseaudio settings here?

The project can be found here:

https://github.com/viktorgino/headunit-desktop

It would be very great if you could help us.
Btw HU as server for Android Auto is working in Alpha stadium right now and gets developed more and more but right now you can also use it via WiFi connection.

Don't if you use kodi at the moment like i did before. But this project offers much posibilities.

What make of car do you have? A BMW with a pibus board?

sjdean
Posts: 8
Joined: Tue Sep 20, 2016 4:32 pm

Re: Pulseaudio , BlueZ, Ofono and HFP Problems

Sun Sep 10, 2017 1:34 pm

Hi There,

I haven't progressed in terms of getting the microphone fully working yet. There's problems with enabling that at the moment. I have lots of things to do, and microphone is a little on the lower priority side.

These were the only changes in the daemon.conf in /etc/pulseaudio:

; resample-method = speex-float-1
enable-remixing = yes
resample-method = ffmpeg
enable-remixing = yes
enable-lfe-remixing = no
; lfe-crossover-freq = 0

default-sample-format = s16le
default-sample-rate = 44100
; alternate-sample-rate = 48000
default-sample-channels = 2
; default-channel-map = front-left,front-right

default-fragments = 10
default-fragment-size-msec = 10



Once you have the audio re-routed, I believe the "enable-remixing" is the key to getting this working. If you have a mono source (microphone) and and a stereo output (ie your speakers), then if pulseaudio cannot remix, it won't output. Many guides say not to enable remixing.

I'm building a new unit based on Raspbian Stretch - but that changes the game completely - pulseaudio is out, and bluezalsa is in. I have not been able to get that working at all. I've installed BlueZ 5.4.6, Ofono 1.2.0 and Pulseaudio 10.99, but getting no bluetooth audio sinks or sources.

Back to the drawing board.

dchang0
Posts: 3
Joined: Fri Sep 08, 2017 6:59 am

Re: Pulseaudio , BlueZ, Ofono and HFP Problems

Sun Nov 12, 2017 8:00 pm

Thanks for the tip to enable remixing to allow the mono microphone to work during calls.
Even though the man page says that enable-remixing = yes is yes by default, that does not seem to be the case. I was able to make calls and hear the remote audio in stereo, but when I spoke through the mic, it was dead silent on the other end until I enabled remixing.

I am running PulseAudio 11.1 built from the latest source at PulseAudio's official git repository.

Bluez is 5.37 and came with the OS. Ofono is 1.17 and came with the OS.

Return to “Graphics, sound and multimedia”

Who is online

Users browsing this forum: No registered users and 5 guests