LydByDissing / stroem

The Strøm open source speaker project have been started with the main goal of creating a fully functional "wifi speaker", but as an open sourced product.
Creative Commons Attribution Share Alike 4.0 International
103 stars 2 forks source link

Implement True Wireless Stereo (TWS) #23

Open TooDissing opened 2 years ago

TooDissing commented 2 years ago

The current scope for STRØM 1.0 are mono playback only. For an enhanced listening experience stereo playback should be possible.

Describe the solution you'd like It should be possible to support stereo playback using two STRØM speakers. This feature should be implemented using a wireless connection.

The main problem are how to synchronize the clock of the two speakers, as this is required in order to minimize any delay between the playback from each speaker.

The "classic" TWS implementation in Bluetooth can't be used here, as this will require a proprietary Bluetooth chip and software stack. This is not part of the µVox hardware platform.

There seems to have been done some serious research within this area, which are worth looking further into. The following research promise a clock drift across multiple devices of under 1µs. That must be more than enough for this use case.

In the below paper two interesting concepts are mentioned: X-Sync and X-Burst. Poster: Accurate Cross-Technology Clock Synchronization Among Off-the-Shelf Wireless Devices

Describe alternatives you've considered A wired connection is possible, but isn't really considered as a solution.

TooDissing commented 2 years ago

I had a short talk with the researcher behind the above study and it seems that the X-Sync / X-Burst isn't the most ideal solution for this application. Their main focus are on syncing devices using different network stacks; i.e. mixing Bluetooth and Wifi.

A few suggestions on a different approach:

TooDissing commented 2 years ago

another great paper about this topic: https://www.usenix.org/system/files/atc21-chen.pdf

TooDissing commented 2 years ago

Maybe also of relevans? https://gitlab.com/painlessMesh/painlessMesh

TooDissing commented 2 years ago

FTM seems to be support in some chips. Should be able to utilize this somehow: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/network/esp_wifi.html#_CPPv424wifi_ftm_initiator_cfg_t

TooDissing commented 2 years ago

An ESP32 FTM example: https://github.com/espressif/esp-idf/blob/a82e6e63d9/examples/wifi/ftm/README.md.

When utilizing this (FTM) the ESP32 devices are likely required to be setup as station+AP, so they are in "direct contact". At least this should yield a better result.

The resulting timing should then be used as a base for clock-sync.