Solving Mic Of Wireless Earbuds Not Working On Ubuntu 20

TL;DR

My newly purchased set of earbuds had terrible microphone quality in video-conferencing only on my Ubuntu system. The problem was that most earphone/earbuds use A2DP configuration for High Fidelity Playback. This configuration doesn’t support mic as it works unidirectionally (Laptop to Earbuds only). Switching this configuration to HSP/HFP can enable mic support with minor degradation of audio/output quality. This configuration is not available by default in Ubuntu using Pulseaudio drivers. The Pulseaudio drivers that comes pre-loaded with the OS has removed the support for HSP/HFP due to it’s buggy nature. This lead to removed support for mic on most wireless earbuds. To solve the issue of wireless earbuds not working you can jump to ‘Solving The Issue’ section or you can read how I reached to this conclusion below.

Sound panel in Ubuntu
Sound settings panel

The Problem

I recently bought a pair of wireless earbuds that boasted of having 4 microphones for loud and clear call quality. This claim indeed held true on multiple phone calls done using my mobile over the next weekend. The person on other side of the call could definitely hear me better than any of my previous earphones/buds. The problem started when I tried to pair it with my laptop for video conferencing. Surprisingly! the compliments of crystal clear sound from my phone calls suddenly turned into complaints of too much noise on my laptop.

Since everything was working fine on my phone, it didn’t took me long to figure out that the problem was with the Ubuntu system. To dig a bit deeper, I looked into Settings panel under Bluetooth section, nothing much to see there. The only option I got was to disconnect the device or forget connection. No leads so far! Next, I shifted my focus to the Sounds section, to check if there is some problem with my microphone configuration. Voila! there it is, the problem stared right at my face. The output was configured to use my earphones but the input/mic was locked to the laptop’s microphone and the earbud’s mic was not even listed.

The Root Cause

So finally, I got to the problem, half the battle won right? not so fast the problem was not just the missing driver but the missing support. Let’s explore the situation a bit more, the configuration on output was set to A2DP but input is locked to digital microphone. So maybe, if I can somehow add the same configuration for microphone as well, things might work? The answer I got was a huge NO! A2DP only support unidirectional audio transfer and is used to send High Fidelity Playback audio to earbuds. It cannot simply send input from the mic to the laptop.

So this configuration will not work with the on-device microphone. Simply searching ‘Ubuntu mic not working’ brings up only few relevant results, none of them worked completely at the time of writing this. But while searching on our beloved Stack Overflow there are many dead ends for “wireless earbuds not working”. After searching for a while I got another lead or configuration to be precise. HSP (Head Set Profile) or HFP (Head Phone Profile) configuration which supports bi-directional data transfer is required if we want to use the microphone of any Bluetooth device. Support for this configuration was removed in previous versions of Pulseaudio due to the buggy nature of the library. The oFono library that adds support for mobile telephony was used for HSP/HFP configuration in earlier version of Pulseaudio. So I finally reached to the root cause of the problem now time to find the solution.

Solving The Issue

Originally, when I started writing this article, it was going to be about oFono. It added support for HSP/HFP to the existing Pulseaudio drivers instead of replacing them. Though, I had previously heard about another solution named Pipewire. Being an alternative to Pulseaudio, I had to remove the existing drivers and install the Pipewire for it to work. But the idea of replacing the drivers for adding support sounded a bit too extreme at that time. So oFono was my only option left at that time and it did work (for at least a few minutes).

oFono as already mentioned is a bit buggy and that’s why it was removed from Pulseaudio. In my initial testing I was happy with it until it started randomly disconnecting the audio. It was not at all reliable and I had to write system services/configs to get it to work seamlessly. It was just a lot more effort with very little Output. After a 2 days of struggling with this setup, I finally decided to try out Pipewire. After all, being a Software Developer, I cannot leave a problem unsolved, even if it means having to install the drivers again if things go wrong. So far the experience with Pipewire is far better than oFono + Pulseaudio. So, it is the recommended setup from my side to solve the issue of wireless earbuds not working.

Pipewire Installation

Pipewire is an Open Source utility that supports HSP/HFP configuration out of the box. This utility simply replaces the pre-installed Pulseaudio utility without uninstalling it completely. This gives the added advantage of rolling back your changes if things go wrong at any point. Let’s get to the part on how to set it up on your Ubuntu 20 computer.

  1. Open the terminal. You can hit `Ctrl+Alt+T` or look for terminal in global search.
  2. In the terminal run the following command to add the Pipewire package source to your source list:
    sudo add-apt-repository ppa:pipewire-debian/pipewire-upstream
  3. Run the update command to refresh the PPA in the system:
    sudo apt update
  4. Install Pipewire by simply running the command:
    sudo apt install pipewire
  5. Install Pipewire with all dependencies using the command:
    sudo apt install libspa-0.2-bluetooth pipewire-audio-client-libraries
    sudo apt install gstreamer1.0-pipewire libpipewire-0.2-1 libpipewire-0.2-dev libpipewire-0.2-doc
  6. Reload the daemon:
    systemctl --user daemon-reload
  7. Next we will disable Pulseaudio from the system (we are not removing it just disabling):
    systemctl --user --now disable pulseaudio.service pulseaudio.socket
    systemctl --user mask pulseaudio
  8. Restart your system before moving to the next step. Since we have disabled the Pulseaudio service that was pre-loaded in OS, it is crucial that we restart the system. This step help in proper configuration of the new service.
  9. Enable the Pipewire media session service:
    systemctl --user --now enable pipewire-media-session.service
  10. Test your install by running the following command:
    pactl info
    If the text that appears say ‘Pulseaudio (on Pipewire)‘ under server name then your installation is successful else you can try the bellow command to restart the Pipewire serve and check again:
    systemctl --user restart pipewire

Do note that in HSP/HFP configuration the earbuds will work in mono mode (Stereo only works with A2DP configuration).

Sound panel after solving the issue of wireless earbuds not working
Sound Panel After Installation

If you want to rollback all the changes we did just now, you can do it by using:
systemctl --user unmask pulseaudio
systemctl --user --now enable pulseaudio.service pulseaudio.socket

Post Installation Steps (Optional)

After installing Pipewire the connectivity was great but the input volume from the mic was very low. I was barely audible to the other participants (again only happening on Ubuntu). If you face similar issue after installing Pipewire, you can simply install PulseEffects. It’s an audio utility that allow you to change (and boost) the input/output of your system audio. And a cherry on top is that it can also remove the low frequency noise using preset filters. Here is how you can install and configure PulseEffects in your system:

  1. Just like we did for Pipewire, we will simply add the PPA for the PulseEffects package to the system:
    sudo add-apt-repository ppa:mikhailnov/pulseeffects -y
  2. Next install the utility with ‘–install-recommends’ flag to also install any required dependencies:
    sudo apt install pulseeffects --install-recommends
  3. Open PulseEffects and change the configurations by adding audio effects. Below is the configuration that worked for me (your values might vary).
    • Limiter: Change Input to 30.0, leave rest of the settings unchanged.
    • Multiband Compressor: Change input to 2.5, leave everything else unchanged.
    • Filter (for additional noise reduction): Select ’12db/oct Bandpass’ from presets, change Resonance to -1.0 dB, leave everything else unchanged.
    • Equalizer: Change input to 2.5, leave everything else unchanged.

You can test out different configurations and check it on any online mic test utility (Google ‘mic test’). These utilities record your voice from your microphone. Once done you can playback the sound to check audio quality. In my case with these settings the voice is loud and clear.

Pulse Effects interface
PulseEffects interface

Drop a Like if you think this was helpful. Share with others if someone else is facing this issue. Leave a comment If something in this article didn’t work. You can also share what worked for you in the comments.

If you happen to host a WordPress website, you can read how to secure your site:

Is your WordPress website redirecting users to a malicious web page?

Signing off till next article, See you there 🙂

Eternal Geeker

Writer & Blogger

Related Posts:

21 Comments

  • Это позволяет читателям получить разностороннюю информацию и самостоятельно сделать выводы.

  • I want to to thank you for this great read!! I definitely loved every bit of it. I have you book marked to check out new things you post…

  • Статья помогла мне лучше понять контекст и значение проблемы в современном обществе.

  • Hi just wanted to give you a brief heads up and let you know a few of the images aren’t loading correctly. I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show the same results.

  • Hi there, You have done a great job. I抣l certainly digg it and personally recommend to my friends. I am sure they will be benefited from this website.

  • Я оцениваю широту охвата темы в статье.

  • Howdy! This post could not be written any better!
    Reading through this post reminds me of my previous room mate!
    He always kept chatting about this. I will forward this write-up to him.
    Fairly certain he will have a good read.
    Many thanks for sharing!

  • Hi there every one, here every one is sharing these kinds of knowledge,
    therefore it’s good to read this weblog, and I used to go to see this weblog daily.

  • hello there and thanks in your info ?I抳e definitely picked up something new from proper here. I did then again expertise some technical points using this website, as I experienced to reload the website a lot of occasions previous to I could get it to load properly. I were brooding about if your web hosting is OK? No longer that I am complaining, however sluggish loading instances instances will sometimes affect your placement in google and can harm your high-quality ranking if advertising and ***********|advertising|advertising|advertising and *********** with Adwords. Anyway I抦 adding this RSS to my email and can glance out for much extra of your respective interesting content. Make sure you update this again soon..

  • Greetings! Very helpful advice within this article!
    It’s the little changes which will make the most significant
    changes. Thanks a lot for sharing!

  • This is my first time go to see at here and i am really happy to read all at one place.

  • Thanks very nice blog!

  • Hi to every single one, it’s really a fastidious for me to go to see this site, it consists of helpful Information.

  • Your articles are very helpful to me. May I request more information?

  • Thank you for your post. I really enjoyed reading it, especially because it addressed my issue. It helped me a lot and I hope it will also help others.

  • Can you write more about it? Your articles are always helpful to me. Thank you!

  • Your articles are very helpful to me. May I request more information?

  • Thank you for your articles. They are very helpful to me. Can you help me with something?

  • Thank you for sharing this article with me. It helped me a lot and I love it.

  • Good web site! I truly love how it is easy on my eyes and the data are well written. I am wondering how I could be notified whenever a new post has been made. I’ve subscribed to your RSS which must do the trick! Have a nice day!

  • You helped me a lot by posting this article and I love what I’m learning.

  • G

    Hello,

    thanks for the tutorial, got my mic working somehow.
    The issue only is that if I choose A2DP i have a great sound, but no mic at all, when I select the non-A2DP options the sound is worse than 300 years ago with some old bean cans and a piece of string and it’s not even stereo. Any way to fix this bit other than throwing away the headset and/or the OS?

  • Gomaa

    I’ve got to say, this is one of the best tutorials I’ve ever seen, my mic finally works! Thanks!

  • Lester Larkin

    Worked GREAT!!! I’m running Linux Mint 20.3 with Cinnamon desktop on an HP laptop. I just copied and pasted all the necessary steps into my terminal window, including the restart at Step 8.

    Thanks a bunch, E.G. !!!

    • Eternal Geeker

      Good to know it helped 🙂

  • Fire

    Not working for me. First of all, not able to see Configuration under Input section and when I select HSP/HFP, in Output section got no sound. I’ve to switch to A2DP sink to get back sound.
    Using LG Tone-FP9.

    • Eternal Geeker

      Sorry to hear that. This post is for older versions of Pulse Audio, so there might be some update that this post does not cover resulting in it not working. Bluetooth audio is always troublesome with Linux platform and I have tried multiple solution only to find them failing after a few days due to a new update. Though if you do get it working by yourself do let me know and I will update this post.

      Best of Luck!

    • Ryan

      I am facing the same issue as Fire. I got everything installed, and if I select the A2DP sound, it works great. But if I switch to the Handsfree audio source, the “Configuration” section of the Settings screen disappears. If I select “Test”, I get the option to test mono, but I don’t hear anything in my headset.

      • Eternal Geeker

        Sorry to hear that. This post is for older versions of Pulse Audio, so there might be some update that this post does not cover resulting in it not working. Bluetooth audio is always troublesome with Linux platform and I have tried multiple solution only to find them failing after a few days due to a new update. Though if you do get it working by yourself do let me know and I will update this post.

        Best of Luck!

  • Manona

    Thank you. It worked with my Senniheiser headset Ver4.

  • Trish

    Actually, this ended up failing badly. Every time I try to listen to anything now, I get HORRIBLE, garbled sound. Not just static, but even a beep sounds like the way a highly pixelated photo looks, if that makes sense (not sure how else to explain it). The only way to get good sound again was to switch back to A2DP instead of HSP/HFP, which defeats the point.

    I really wish this would get fixed. It’s a known problem affecting enough users that’s a massive hindrance in pandemic times when I need to be making Zoom calls all the time and need the headphones for privacy.

    Though I ended up capitulating and getting a USB bluetooth dongle, and that’s not even working. If I can’t figure this out, I’m going to have to get a Chromebook or something. I’ve been a happy Ubuntu user since 2008, but this has been my nemesis and the one thing I haven’t been able to fix, and it’s crippling my ability to get meetings done. 🙁

    • Eternal Geeker

      Sorry to hear that it didn’t work. This problem is related to software and I highly doubt the dongle would give you any better results. I found an open issue with BOSE headphones on bug forum. It has been there for quite some time with no clear fix in foreseeable future https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1894097.
      Though I might not be able to help you resolve this further, but I have a few suggestions that are cheaper than buying a new laptop.

      • Install Windows alongside linux (Dualboot) – Only downside is that you will have to shutdown Linux and boot to Windows before every meeting.
      • Install Windows in a virtualbox on existing Ubuntu – I have tested it out with the wired headsets and it works. Since the problem is with the software this should solve the headset issue in theory.
      • Buy another noise cancelling wired headset only for calls.

      And if you need help for either of the first two options. I would be happy to post a guide for you in upcoming days, so you can let me know in the reply.

      For the love of Linux, I hope you find a solution for this problem and don’t have to switch to another OS 🙂

      Best of luck!

  • Trish

    So, I tried everything here, and it seems my bluetooth headphones are connected, which is great. However, I have a couple of issues I’m running into.

    1) I’ve got terrible static-like noise that I’m hearing from the headphones. If I switch them over to A2DP in the sound settings, that goes away. As soon as I toggle it over to HSP/HFP, I get static. Is there a way to get rid of that? If it matters, I’m using Bose QC35 headphones.

    One issue I had–and I’m a noob, so maybe this is the problem–when I ran this line in the terminal [sudo apt install gstreamer1.0-pipewire libpipewire-0.2-1 libpipewire-0.2-dev libpipewire-0.2-doc] I got an error message saying that libpipewire-0.2-dev and libpipewire-0.2-doc don’t exist. What do I do about that?

    2) I did a mic test, and the mic quality is not very great. Sounds tinny, though I know my headphones have great mic sound when I’m connected to another device, like my phone. Any thoughts on where to start with PulseEffects to change that? I don’t know a lot about sound settings.

    • Eternal Geeker

      @Trish glad you made it work! I will try to help you with the issues you are facing.

      • Static can be due to a lot of variables so it is difficult to exactly say why this is happening. Are you using pulse audio on output (speakers)? If yes, then try turning it out off. If your speaker volume is over amplified it can lead to minor static sound also getting amplified to irritating levels. Also, can you try turning off noise cancellation on the headphones and see if anything changes? As for the libraries you can try and download the deb file (just like .exe for windows) and install it manually from https://pkgs.org/download/libpipewire-0.2-dev and https://pkgs.org/download/libpipewire-0.2-doc
      • In the PulseEffects make sure you are on the microphone menu and not speaker menu (this could be the reason for static). You can switch it by clicking on the top left microphone button. Once in the menu you will see many options like Gate, Limiter, Equalizer, etc. You just need to change the input slider to amplify the microphone sensitivity. See the image I have posted in the article for the options I am using. I am posting the input value I an using for your reference but your values might differ and you might have set it by trial and error.
        Limiter => Input - 30
        Multiband Compressor => Input - 2
        Filter => Input - 4
        Equalizer => Input - 2

      You can also set “Filter” to “6dB/oct Bandpass” with Resonance value of -3.0 dB to reduce noise from your microphone. If that doesn’t make sense here no issues you will know what to do once you open the filter option. Again, these values worked for me and you might have to tweak these according to your case.

      Best of Luck 🙂

  • Aditya Singh

    Stand-ups will be easier now 😛

Leave a Reply

Your email address will not be published. Required fields are marked *

About Me

I convert Coffee  to Code </>

Game Travel Eat Sleep Repeat

Popular Posts

  • All Post
  • Announcements
  • Development
  • Everything Tech.
  • Experiences
  • TIL - Today I Learned
  • Wanderlust
  • World Of Web

Newsletter

JOIN THE EG FAMILY!

Get a access to posts as soon as they are live on the blog.

You have been successfully Subscribed! Something went wrong please try again later.

Featured Posts

  • All Post
  • Announcements
  • Development
  • Everything Tech.
  • Experiences
  • TIL - Today I Learned
  • Wanderlust
  • World Of Web

Instagram

Edit Template

A website by a Geek for the Geeks!

© 2024 Eternal Geeking