A2DP agent for promiscuous/permissive audio sinc.

Overview

Promiscuous Bluetooth audio sinc

A2DP agent for promiscuous/permissive audio sinc for Linux. Once installed, a Bluetooth client, such as a smart phone, should be able to discover, pair, and subsequently play audio without any manual interaction. This is perfect for those with headless media boxes wanting to expand their connective options and saves explaining things to the kids 8)

This project assumes the use of PulseAudio and should be tested with PortAudio if required.

This project is heavily based on the Gist and comments at https://gist.github.com/mill1000/74c7473ee3b4a5b13f6325e9994ff84c#gistcomment-4032842

Caveats and roadmap

At this stage the Bluetooth device is hard coded, so please check that it matches your device. In the future such options should be set by a configuration file...

Installation

NOTE: This is very much a WIP, please comment on any additional steps required in your distro/version.

This documentation is based on my experience using Ubuntu 21.04.

Install required packages

Ensure that the required Bluetooth, Bluetooth audio, and Python 3 dependencies are installed.

sudo apt install pulseaudio-module-bluetooth bluez

Ensure Bluetooth is always discoverable

If you are using a desktop version of your OS, ensure that Bluetooth is set to visible.

Alternatively you can set the DiscoverableTimeout and PairableTimeout in /etc/bluetooth/main.conf to 0

# How long to stay in discoverable mode before going back to non-discoverable
# The value is in seconds. Default is 180, i.e. 3 minutes.
# 0 = disable timer, i.e. stay discoverable forever
DiscoverableTimeout = 0

# How long to stay in pairable mode before going back to non-discoverable
# The value is in seconds. Default is 0.
# 0 = disable timer, i.e. stay pairable forever
PairableTimeout = 0

NOTE: The above steps were not required for me.

Install the A2DP Bluetooth agent

A Bluetooth agent is a piece of software that handles pairing and authorization of Bluetooth devices. The following agent allows a client to automatically pair and accept A2DP connections from Bluetooth devices. All other Bluetooth services are rejected.

Copy the included file a2dp-agent to /usr/local/bin and make the file executable with

sudo cp -a a2dp-agent /usr/local/bin/
sudo chmod +x /usr/local/bin/a2dp-agent

Testing the agent

Before continuing, verify that the agent is functional. Bluetooth audio should be discoverable, pairable and recognised as an audio device.

  1. Manually run the agent by executing
sudo /usr/local/bin/a2dp-agent
  1. Attempt to pair and connect with using your phone or computer. You will be asked to verify a pairing key, just accept it and move on.
  2. Check on the client which profiles are available. SBC is likely your best choice quality wise. If you do not see any services then something has gone wrong 8(
  3. The agent should output the accepted and rejected Bluetooth UUIDs
Setting device to 'discoverable' and 'pairable'...
Agent registered
RequestConfirmation (/org/bluez/hci0/dev_04_B1_67_56_62_C3, 263837)
Auto confirming...
AuthorizeService (/org/bluez/hci0/dev_04_B1_67_56_62_C3, 0000110d-0000-1000-8000-00805f9b34fb)
Authorized A2DP Service

Play some audio on the client device, you should hear or see something happening on the server side 8)

Install the A2DP Bluetooth Agent as a service

To make the A2DP Bluetooth Agent run on boot copy the included file bt-agent-a2dp.service to /etc/systemd/system. Now run the following command to enable the A2DP Agent service

sudo cp -a bt-agent-a2dp.service /etc/systemd/system/
sudo systemctl enable bt-agent-a2dp.service
sudo systemctl start bt-agent-a2dp.service
systemctl status bt-agent-a2dp.service

The status should show green:

● bt-agent-a2dp.service - A2DP Bluetooth Agent
     Loaded: loaded (/etc/systemd/system/bt-agent-a2dp.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-01-19 10:26:30 NZDT; 1s ago
   Main PID: 17527 (python3)
      Tasks: 2 (limit: 18760)
     Memory: 8.9M
        CPU: 55ms
     CGroup: /system.slice/bt-agent-a2dp.service
             └─17527 /usr/bin/python3 -u /usr/local/bin/a2dp-agent

You can follow the logs of the agent with:

journalctl -fu bt-agent-a2dp.service

Higher quality audio

SBC has a bad reputation compared with other codes, but it turns out that good old SBC has a dual channel mode which can be enabled in the Developer options in recent LineageOS based Android phones. See Bluetooth SBC Dual Channel HD audio mode – LineageOS – LineageOS Android Distribution for a breakdown.

Owner
Jasper Aorangi
Jasper Aorangi
Welcome to Nexus. Your personal virtual assistant

AI Voice Assistant Welcome to Nexus voice assistant Description Have you ever heard of voice assistants like Cortana, Siri, Google assistant, and Alex

Mustafah Zacs 1 Jan 10, 2022
Library for working with sound files of the format: .ogg, .mp3, .wav

Library for working with sound files of the format: .ogg, .mp3, .wav. By work is meant - playing sound files in a straight line and in the background, obtaining information about the sound file (auth

Romanin 2 Dec 15, 2022
This is a short program that takes the input from your microphone and uses OpenGL to draw a live colourful pattern

Visual-Music This is a short program that takes the input from your microphone and uses OpenGL to draw a live colourful pattern Installation and Setup

Tom Jebbo 1 Dec 26, 2021
A simple voice detection system which can be applied practically for designing a device with capability to detect a baby’s cry and automatically turning on music

Auto-Baby-Cry-Detection-with-Music-Player A simple voice detection system which can be applied practically for designing a device with capability to d

2 Dec 15, 2021
Desktop music recognition application for windows

MusicRecognizer Music recognition application for windows You can choose from which of the devices the recording will be made. If you choose speakers,

Nikita Merzlyakov 28 Dec 13, 2022
voice assistant made with python that search for covid19 data(like total cases, deaths and etc) in a specific country

covid19-voice-assistant voice assistant made with python that search for covid19 data(like total cases, deaths and etc) in a specific country installi

Miguel 2 Dec 05, 2021
NovaMusic is a music sharing robot. Users can get music and music lyrics using inline queries.

A music sharing telegram robot using Redis database and Telebot python library using Redis database.

Hesam Norin 7 Oct 21, 2022
Music player - endlessly plays your music

Music player First, if you wonder about what is supposed to be a music player or what makes a music player different from a simple media player, read

Albert Zeyer 482 Dec 19, 2022
Music generation using ml / dl

Data analysis Document here the project: deep_music Description: Project Description Data Source: Type of analysis: Please document the project the be

0 Jul 03, 2022
:notes: Cross-platform music player

Exaile Exaile is a music player with a simple interface and powerful music management capabilities. Features include automatic fetching of album art,

Exaile 327 Dec 19, 2022
:sound: Play and Record Sound with Python :snake:

Play and Record Sound with Python This Python module provides bindings for the PortAudio library and a few convenience functions to play and record Nu

spatialaudio.net 750 Dec 31, 2022
A Python 3 script for capturing and recording a SDR stream to a WAV file (or serving it to a HTTP audio stream).

rfsoapyfile A Python 3 script for capturing and recording a SDR stream to a WAV file (or serving it to a HTTP audio stream). The script is threaded fo

4 Dec 19, 2022
AudioDVP:Photorealistic Audio-driven Video Portraits

AudioDVP This is the official implementation of Photorealistic Audio-driven Video Portraits. Major Requirements Ubuntu = 18.04 PyTorch = 1.2 GCC =

232 Jan 03, 2023
無料で使える中品質なテキスト読み上げソフトウェア、VOICEVOXのコア

無料で使える中品質なテキスト読み上げソフトウェア、VOICEVOXのコア

Hiroshiba 0 Aug 29, 2022
Supysonic is a Python implementation of the Subsonic server API.

Supysonic Supysonic is a Python implementation of the Subsonic server API. Current supported features are: browsing (by folders or tags) streaming of

Alban 228 Nov 19, 2022
Speech Algorithms Collections

Speech Algorithms Collections

Ryuk 498 Jan 06, 2023
A Simple Script that will help you to Play / Change Songs with just your Voice

Auto-Spotify using Voice Recognition A Simple Script that will help you to Play / Change Songs with just your Voice Explore the docs » Table of Conten

Mehul Shah 1 Nov 21, 2021
GNU Radio – the Free and Open Software Radio Ecosystem

GNU Radio is a free & open-source software development toolkit that provides signal processing blocks to implement software radios. It can be used wit

GNU Radio 4.1k Jan 06, 2023
Oliva music bot help to play vc music

OLIVA V2 🎵 Requirements 📝 FFmpeg NodeJS nodesource.com Python 3.7+ PyTgCalls Commands 🛠 For all in group /play - reply to youtube url or song file

SOUL々H҉A҉C҉K҉E҉R҉ 2 Oct 22, 2021
Any-to-any voice conversion using synthetic specific-speaker speeches as intermedium features

MediumVC MediumVC is an utterance-level method towards any-to-any VC. Before that, we propose SingleVC to perform A2O tasks(Xi → Ŷi) , Xi means utter

谷下雨 47 Dec 25, 2022