Bluetooth audio local-echo

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bluetooth audio local-echo

1,709 Views
sergio_dorazio
Contributor IV

Hi,

I am working with imx6ull-evk with a bluetooth board . I use bluez and HSP profile . When I connect a smartphone(TEL0) over bluetooth, tha board imx6 is the audio interface of the smarphone. When I do a call from an other telephone (TEL1), I can speak on imx6ull-evk microphone and listen on TEL1 , and I can speak on TEL1 and listen on imx6ull-evk headset. Seems all work but in this configuration I have a little think that not work well: when I speak from TEL1 , I listen on TEL1 the local-echo of my voice. This local-echo have a latency of about 1 second at init call but increase over time. 

Have you an idea about this problem ?

Sergio

0 Kudos
10 Replies

1,533 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

What Bluetooth chip are you using?

Best regards,

Diego.

0 Kudos

1,533 Views
sergio_dorazio
Contributor IV

Hi Diego,

I am using texas CC2564.

Regards,

Sergio.

0 Kudos

1,532 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Could you please tell in which audio profile are you configuring the virtual audio Bluetooth card?

Is in a2dp or hsp?

Best regards,

Diego.

0 Kudos

1,533 Views
sergio_dorazio
Contributor IV

I Diego,

I have hsp profile , I send you my "sdptool browse local" result:

root@imx6ull14x14evk:~# sdptool browse local
Browsing FF:FF:FF:00:00:00 ...
Service RecHandle: 0x10000
Service Class ID List:
  "PnP Information" (0x1200)
Profile Descriptor List:
  "PnP Information" (0x1200)
    Version: 0x0103

Browsing FF:FF:FF:00:00:00 ...
Service Search failed: Invalid argument
Service Name: Serial Port
Service Description: COM Port
Service Provider: BlueZ
Service RecHandle: 0x10001
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Serial Port" (0x1101)
    Version: 0x0100

Service Name: Network Access Point Service
Service RecHandle: 0x10002
Service Class ID List:
  "Network Access Point" (0x1116)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 15
  "BNEP" (0x000f)
    Version: 0x0100
    SEQ16: 10 20 30 40
Profile Descriptor List:
  "Network Access Point" (0x1116)
    Version: 0x0100

Service Name: hfp_hf
Service RecHandle: 0x10003
Service Class ID List:
  "Handsfree" (0x111e)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 7
Profile Descriptor List:
  "Handsfree" (0x111e)
    Version: 0x0107

Service Name: Network service
Service Description: Network service
Service RecHandle: 0x10004
Service Class ID List:
  "Network Access Point" (0x1116)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 15
  "BNEP" (0x000f)
    Version: 0x0100
    SEQ16: 800 806
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Network Access Point" (0x1116)
    Version: 0x0100

Service Name: Headset Voice gateway
Service RecHandle: 0x10007
Service Class ID List:
  "Headset Audio Gateway" (0x1112)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 12
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0102

root@imx6ull14x14evk:~#

Sergio

0 Kudos

1,533 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Could you please try modifying the /etc/pulse/daemon.conf file as below and restart the pulseaudio service:

; log-backtrace = 0

 

resample-method = trivial

enable-remixing = no

enable-lfe-remixing = no

; flat-volumes = no

 

; rlimit-fsize = -1

This will lower the sound resolution. But it could solve some sound latency problems.

Best regards,

Diego.

0 Kudos

1,532 Views
sergio_dorazio
Contributor IV

Hi Diego,

with your modifications I have the same problem...

Have you other suggestions ?

Sergio.

0 Kudos

1,533 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Could you please try the following:

pactl set-card-profile $BLUEZCARD hsp
pactl set-card-profile $BLUEZCARD a2dp 
pactl set-card-profile $BLUEZCARD hsp

Best regards,

Diego.

0 Kudos

1,533 Views
sergio_dorazio
Contributor IV

Hi Diego ,

when I connect bluetooth I have the following pulseaudio cards:

root@RCA2:~# pactl list cards
Card #0
Name: alsa_card.platform-sound
Driver: module-alsa-card.c
Owner Module: 6
Properties:
alsa.card = "0"
alsa.card_name = "wm8960-audio"
alsa.long_card_name = "wm8960-audio"
device.bus_path = "platform-sound"
sysfs.path = "/devices/soc0/sound/sound/card0"
device.form_factor = "internal"
device.string = "0"
device.description = "Built-in Audio"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card"
Profiles:
input:analog-mono: Analog Mono Input (sinks: 0, sources: 1, priority: 2, available: yes)
output:analog-mono: Analog Mono Output (sinks: 1, sources: 0, priority: 200, available: yes)
output:analog-mono+input:analog-mono: Analog Mono Duplex (sinks: 1, sources: 1, priority: 202,
available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: output:analog-mono+input:analog-mono
Ports:
analog-input: Analog Input (priority: 10000, latency offset: 0 usec)
Part of profile(s): input:analog-mono, output:analog-mono+input:analog-mono
analog-output-speaker: Speakers (priority: 10000, latency offset: 0 usec, not available)
Properties:
device.icon_name = "audio-speakers"
Part of profile(s): output:analog-mono, output:analog-mono+input:analog-mono
analog-output-headphones: Headphones (priority: 9000, latency offset: 0 usec, available)
Properties:
device.icon_name = "audio-headphones"
Part of profile(s): output:analog-mono, output:analog-mono+input:analog-mono

Card #1
Name: bluez_card.BC_A5_8B_A3_8C_3A
Driver: module-bluez5-device.c
Owner Module: 20
Properties:
device.description = "SDO Galaxy J6"
device.string = "BC:A5:8B:A3:8C:3A"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "phone"
bluez.path = "/org/bluez/hci0/dev_BC_A5_8B_A3_8C_3A"
bluez.class = "0x5a020c"
bluez.alias = "SDO Galaxy J6"
device.icon_name = "audio-card-bluetooth"
Profiles:
a2dp_source: High Fidelity Capture (A2DP Source) (sinks: 0, sources: 1, priority: 10, availabl
e: no)
headset_audio_gateway: Headset Audio Gateway (HSP/HFP) (sinks: 1, sources: 1, priority: 20, av
ailable: 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)
Part of profile(s): headset_audio_gateway
phone-input: Phone (priority: 0, latency offset: 0 usec)
Part of profile(s): a2dp_source, headset_audio_gateway

I can do the following command :

root@RCA2:~#
root@RCA2:~# pactl set-card-profile 1 headset_audio_gateway
root@RCA2:~#

root@RCA2:~# pactl set-card-profile 1 a2dp_source
Failure: Input/Output error

root@RCA2:~#

In my test I want hsp/hfp profile and not a2dp profile.

In any case the result is the same : I have the audio local-echo on TEL1.

Have you other suggestion ?

Sergio.

0 Kudos

1,533 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Could you please try adding the echo cancelation module by yourself? Please modify the following file:

/etc/pulse/default.pa
### Enable Echo/Noise-Cancellation
load-module module-echo-cancel use_master_format=1 aec_method=webrtc aec_args="analog_gain_control=0\ digital_gain_control=1" source_name=echoCancel_source sink_name=echoCancel_sink
set-default-source echoCancel_source
set-default-sink echoCancel_sink‍‍‍‍‍

then restart Pulseaudio

$ pulseaudio -k
$ pulseaudio --start

Hope this can solve the problem.

Best regards,

Diego.

0 Kudos

1,533 Views
sergio_dorazio
Contributor IV

I Diego,

I found the problem:

when pulse audio see a bluetooth connection load a module loopback from analog card to bluetooth card. This loopback not work well because work only in a single way and not in both way (I need both way). In this situation if I add other loopback module , the loop work in both way but there is the  local-echo. If I unload the module loopback of pulseaudio but not remove my loopback module the local-echo disappear  and the loopback from bluetooth card and analog card work well.

By

thank you for all.

Sergio D'Orazio.