How to integrate Bluetooth headphones to control playback on Linux (Mint) players? - bluetooth

My headphones are WH-1000xm3. System being used is Linux Mint.
How to make playback work?

install playerctl
wget http://ftp.nl.debian.org/debian/pool/main/p/playerctl/libplayerctl2_2.0.1-1_amd64.deb
wget http://ftp.nl.debian.org/debian/pool/main/p/playerctl/playerctl_2.0.1-1_amd64.deb
sudo dpkg -i libplayerctl2_2.0.1-1_amd64.deb playerctl_2.0.1-1_amd64.deb
install xbindkeys
Add command to a ~/.xbindkeysrc file:
"playerctl play-pause"
m:0x0 + c:208
XF86AudioMute
This way you can control chrome, vlc, video/audio players playback remotely via your headphones
This is tested for Linux Mind 19.3 Tricia with Sony WH-1000XM3

Related

Manjaro Linux KDE - no sound

I have a problem with my Manjaro Linux. I have no sound. I have tried everything (I have installed sof-firmware, unmuted soundcard, rebooted alsa). What should I do?
Here is the output of the inxi:
System: Host: cWillNeverDie Kernel: 5.13.19-2-MANJARO x86_64 bits: 64 Desktop: KDE Plasma 5.22.5 Distro: Manjaro Linux Machine: Type: Desktop Mobo: Micro-Star model: MAG Z490 TOMAHAWK (MS-7C80) v: 1.0 serial: <superuser required> UEFI: American Megatrends v: 1.80 date: 04/19/2021 Audio: Device-1: Intel driver: snd_hda_intel Sound Server-1: ALSA v: k5.13.19-2-MANJARO running: yes Sound Server-2: PulseAudio v: 15.0 running: yes Sound Server-3: PipeWire v: 0.3.38 running: yes
Try to open terminal and run aplay -l. You'll get something like:
card 1: Generic [HD-Audio Generic], device 0: ALC236 Analog [ALC236 Analog]
Take notes each of card numbers and device numbers. For above example: card number 1 and device number 0.
Then run speaker-test -D hw:CardNumb,DeviceNumb -c 2. For above example become:
speaker -D hw:1,0 -c 2
If you get an error mentioning device busy, close all current active windows, wait a moment and run again. Do this for all cards and devices shown from aplay -l.
Take note which card and device that give you a sound.
After that, find on how to create .asoundrc on the internet.
Hope this give a clue how to debug your sound card.
Sorry if this reply is too late. I was having the same problem, tried every input I could find, and nothing worked. Until...
Go to:
audio system settings
playback devices
change to: analog stereo duplex
That fixed it for me, fwiw.
I have the same issue whenever my laptop comes out of sleep mode.
The following workaround works for me:
unplug Headset (if there is any)
switch sound output to another Device (e.g. from monitor to internal speaker)
Then everything works again for me
For proper analysis of the problem have a look into the answer by oprizal

How to create a virtual Mic on MacOS with pulseaudio

I am trying to use pulseaudio with MacOS (Big sur) to create a virtual mic that can be recognised by apps systemwide.I am able to install pulseaudio without any error.
Even the following command is executing:
pacmd load-module module-null-sink sink_name=MySink
But I am not able to see any virtual device created in my device.
What am I missing? Is there any other way to do this?

Error while trying to run HRTF example from PyAL (File descriptor in bad state) on Raspberry Pi

I am trying to experiment with HRTF audio spatialization using PyAL library on the Raspberry Pi
https://github.com/NicklasTegner/PyAL/tree/master/examples/HRTF
PyAL depends on OpenAL. I have installed necessary dependencies using sudo apt-get install to ensure the library works: libopenal-dev libopenal1 libopenal-data libmysofa-dev libmysofa0 libmysofa-utils qt5-default alsa-utils alsa-oss alsaplayer-jack g++ gstreamer1.0-python3-plugin-loader gstreamer1.0-alsa
Additionally, I installed pyglet using: sudo pip3 install pyglet
All examples (3D audio, playback, efx, audiplayer, player) work except the HRTF example. When I try to run the HRTF example, I get the following error:
AL lib: (EE) ALCplaybackAlsa_reset: snd_pcm_hw_params(self->pcmHandle, hp) failed: File descriptor in bad state
I know for a fact that this is being caused by PulseAudio not being present in the system (https://unix.stackexchange.com/questions/467193/error-while-running-the-gstreamer-example-on-development-kit-file-descriptor). So I installed pulseaudio and its corresponding tools (e.g. pavucontrol using sudo apt-get install pulseaudio.
After installing pulseaudio and rebooting, when I run that example, the example executes without error. However, I do not hear any audio output in the headphones. In fact, audio output from the entire system stops. I made sure the audio output is headphones from sudo raspi-config and alsamixer does show pulseaudio as a audio driver (when it is installed).
I am getting conflicting information from the Internet. The above link suggests using pulseaudio to mitigate the error (which is correct), whereas this link: https://www.youtube.com/watch?v=stvc7ehCWUU and https://raspberrypi.stackexchange.com/questions/1621/no-sound-output-in-vlc say to remove pulseaudio (which is also correct in the sense it brings my audio back but I can't run the HRTF example).
Any suggestions?
This is very odd, but I solved the problem by connecting a cheap external USB audio card (https://www.amazon.com/gp/product/B00IRVQ0F8/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1). Apparently, ALSA keeps control of 3.5mm jack and doesn't surrender control to Pulseaudio of that jack. Simplest solution is to use an external audio card.

Pulse audio doesn't start on boot unless i run some commands

as the title says, pulse audio doesn't start when booting. I need to run
rm -rf /tmp/pulse* ~/.pulse* ~/.config/pulse
pulseaudio -k
pulseaudio --start
in order for it to start. I have even put these commands on an .sh and made this script to run on boot but it doesn's work unless i execute this file manually, sometimes i even have to run it twice.
OS: Manjaro Linux with i3
Pulseaudio: pulseaudio 13.0-dirty
Audio Devices: 00:03.0 Audio device: Intel Corporation Broadwell-U Audio Controller (rev 09) 00:1b.0 Audio device: Intel Corporation Wildcat Point-LP High Definition Audio Controller (rev 03)
[+] Discord and Godot Engine can find any input or output devices!
Have you set up pulseaudio daemon in startup?
If not you can set up using following (depending on your linux version)
systemctl enable pulseaudio and systemctl start pulseaudio
I had the same issue with pulseaudio on my Manjaro with i3. The problem was with .i3/config, I just commented line:
exec --no-startup-id pulseaudio
Also, you can try to restart pulseaudio after boot by adding this line to .i3/config:
exec --no-startup-id systemctl --user restart pulseadio

Pulseaudio no audio via bluetooth a2dp connection buildroot

Edit:
I discovered, that if I run parec | paplay --raw it does play back properly.
How is this possible? There should be just a simple module-loopback error or something like that.
I´m using the CHIP SBC from getchip.com to build an embedded bluetooth audio receiver.
getchip.com offers a debian linux and a customizable buildroot distribution.
I got everything working on the debian distribution with one exception. The volume control with iOS devices don´t work because of the lack of uinput inside the debian kernel.
That´s why i tried to get it to work with the buildroot distribution. It took me a while to get bluetoothd running with simple-agent, as well as pulseaudio built with bluetooth support and the dbus configuration.
I finally got everything ready.
But:
I can connect to the sbc, but there is no sound playing on the headphone jack.
My debugging steps so far:
I´m able to play a local .wav file via paplay
just fine.
I allowed every communication via dbus
the pulseaudio logs show, that sound is coming from the bluetooth source.
the module-switch-on-connect does spawn a loopback from the bluetooth source to the same audio sink as paplay uses.
Debug Logs:
Boot log
Pulseaudio verbose startup
/usr/bin/pulseaudio -vvvv --system --daemonize --disallow-exit
Bluetoothd verbose connection
/usr/libexec/bluetooth/bluetoothd -C -d &
and the bt-agent:
/usr/bin/bt-agent -d -c NoInputNoOutput -p /home/cubbo/.config/bluetooth-default-pin
Pulseaudio verbose connection
Configuration:
Pulseaudio system.pa
Pulseaudio daemon.conf
dbus system.conf
dbus-1/system.d/bluetooth.conf
dbus-1/system.d/pulseaudio-bluetooth.conf
bluetooth/audio.conf
bluetooth/main.conf
I´m pretty sure that I just miss some little configuration and it´ll play just fine. But after nearly one week of debugging I wanted to ask you for help.
I hope I´ve done everything right with attaching the logs via pastebin.
I would appreciate your help!
Thanks!
Greetings, Phil.
I had a similar problem on Antergos, A2DP was not available in pulseaudio.
A2DP was available only when restarting bluethooth service by "systemctl restart bluethooth"
It resulted to be a problem caused by GDM that opened another instance of pulseaudio and captured the bluethooth device. I prevented pulseaudio capturing bluethooth device by masking it for GDM user.
https://wiki.archlinux.org/index.php/Bluetooth_headset#Connecting_works.2C_but_I_cannot_play_sound
$ mkdir -p ~/.config/systemd/user
$ ln -s /dev/null ~/.config/systemd/user/pulseaudio.socket
[restart required]

Resources