Git Product home page Git Product logo

budspro-headtracking's Introduction

Galaxy Buds Pro Headtracking

Stream head-tracking data from the Samsung Galaxy Buds Pro in real-time

Requirements

Windows

On Windows, make sure to install version 0.22 of PyBluez. The latest version (v0.23) does not work properly and fails to enumerate Bluetooth devices.

pip install PyBluez==0.22

Linux

On Linux, you can just go ahead and install the latest version of PyBluez.

pip install PyBluez

Usage

python Headtracking.py --help
usage: Headtracking.py [-h] [-v] [-t] mac-address

Stream head-tracking data from the Galaxy Buds Pro

positional arguments:
  mac-address    MAC-Address of your Buds

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose  Print debug information
  -t, --trace    Trace Bluetooth serial traffic

Dump raw head-tracking data as a quaternion (4D vector):

python Headtracking.py 64:03:7f:2e:2b:3a
x=0.0159, y=0.0096, z=0.0134, w=0.0245
x=0.0179, y=0.0171, z=0.0127, w=0.0251
x=0.0178, y=0.0172, z=0.0146, w=0.0000
x=0.0168, y=0.0103, z=0.0056, w=0.0226
x=0.0165, y=0.0123, z=0.0149, w=0.0252
x=0.0164, y=0.0122, z=0.0151, w=0.0252
x=0.0153, y=0.0085, z=0.0181, w=0.0000
x=0.0172, y=0.0162, z=0.0178, w=0.0006
x=0.0170, y=0.0156, z=0.0182, w=0.0007
x=0.0177, y=0.0167, z=0.0141, w=0.0255
x=0.0164, y=0.0120, z=0.0148, w=0.0252
x=0.0167, y=0.0143, z=0.0182, w=0.0006

budspro-headtracking's People

Contributors

sebaram avatar timschneeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

budspro-headtracking's Issues

Doesn't work with Galaxy Buds2

Firmware version R177XXU0AVC8 adds support for 360 audio:

I installed the update and ran this script. However, this script can't find the RFCOMM protocol.

python Headtracking.py MAC
Couldn't find the proprietary RFCOMM service

I modified the script to also show the service that it found (I can PM the full rawrecord on Telegram):

python Headtracking.py MAC -v
Galaxy Buds2 (****)
Searching for RFCOMM interface...
[{'host': 'MAC', 'name': b'FACTORY', 'description': '', 'port': 20, 'protocol': 'RFCOMM', 'rawrecord': b'6\x00V...\x01\x00%\x07FACCouldn't find the proprietary RFCOMM service

However, the Galaxy Buds Manager app works:

image

Environment:

  • Windows 11, version 22000.434
  • PyBluez 0.22
  • Python 3.8.2

Values seems different with Galaxy Buds Manager

Thank you for your contributions!

I found that the quaternion values got from this script is different with original works: GalaxyBudsClient(https://github.com/ThePBone/GalaxyBudsClient).

As below attached image, values from this script only shows relatively small values.
It seems there are some mistake on data parsing.
buds_signal

Unfortunately, I couldn't follow up your implementation on data parsing.
If you don't mind, could you check once?

Thank you.

Only able to get data from Right Earbud

When running by entering the mac address of my right earbud, it works fine, but when using the mac address of my left earbud, it fails with the output:
Couldn't find the proprietary RFCOMM service

Any info on why this happens?

Device is found but the connection gets lost.

Hi,

It seems that the connection with the buds pro can't be maintained. Any idea? Thank you in advance!

Best!

PS C:\Users\Utilisateur\Downloads\BudsPro-Headtracking-master\BudsPro-Headtracking-master> python headtracking.py 98:0D:6F:FE:C1:EB -v -t
Galaxy Buds2 Pro
Searching for RFCOMM interface...
RFCOMM interface found. Establishing connection...
Connected to device.
<< OUTGOING: fd 04 00 7c 00 34 4d dd
<< OUTGOING: fd 03 00 c3 2f e9 dd
>> INCOMING: fd 31 00 61 0d 04 53 55 01 01 11 00 00 04 b9 22 02 00 46 01 46 01 07 00 03 66 00 01 00 10 00 01 00 00 11 02 01 01 00 00 00 00 00 00 00 00 00 00 00 00 d6 e8 dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
<< OUTGOING: fd 07 00 c3 00 00 00 00 6a dd dd
Exception in thread Thread-2 (_target):
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Program Files\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Utilisateur\Downloads\BudsPro-Headtracking-master\BudsPro-Headtracking-master\RepeatedTimer.py", line 20, in _target
    self.function(*self.args, **self.kwargs)
  File "C:\Users\Utilisateur\Downloads\BudsPro-Headtracking-master\BudsPro-Headtracking-master\SpatialSensorManager.py", line 44, in __keepAlive
    self.service.sendPacket(self.MSG_SPATIAL_AUDIO_CONTROL, bytes(self.CID_KEEP_ALIVE))
  File "C:\Users\Utilisateur\Downloads\BudsPro-Headtracking-master\BudsPro-Headtracking-master\BluetoothService.py", line 85, in sendPacket
    self.socket.send(bytes(b))
  File "C:\Users\Utilisateur\AppData\Roaming\Python\Python311\site-packages\bluetooth\msbt.py", line 99, in send
    return bt.send (self._sockfd, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: Une connexion établie a été abandonnée par un logiciel de votre ordinateur hôte.

Send BOTH sides IMU data, including raw accelerometer

By default, it starts by using the RIGHT earbud (quaternion).
Sometimes, there is a bug where the RIGHT earbud will suddenly stop sending IMU data, and it switches to use the LEFT earbud instead.
I wonder if you can update it so that it sends BOTH sides IMU at the same time?

If possible, could you also add sending raw accelerometer data (xyz)?

Thank you very much.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.