openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

[audio] Add pcm audio websocket with dialog support

Open GiviMAD opened this issue 1 year ago • 17 comments

These PR adds a WebSocket Adapter that allows transferring PCM audio to a sink and source whose existence will be tied to the WebSocket connection (register/unregister the components on connection/disconnection) also allows to spawn a dialog processor instance connected to those (will also be tear down on disconnection).

The PR is incomplete and untested, I'll try to add a client to the UI and develop both PR in parallel.

Also IDK if placing the code in the voice bundle is correct, I did it there because it already requires the audio bundle. For me it makes more sense to do it on the audio bundle but I'll have to require both the voice and websocket bundles there.

Best regards!

GiviMAD avatar Jan 10 '24 20:01 GiviMAD

Also IDK if placing the code in the voice bundle is correct

As the websocket adapter is for audio streams in general, I would say that it should ideally be placed in the audio bundle. The dependency on the voice manager is very small; maybe you could come up with some small hook, which could be used by the voice bundle to register the dialog processing logic into the websocket adapter?

kaikreuzer avatar Jan 13 '24 09:01 kaikreuzer

Also IDK if placing the code in the voice bundle is correct

As the websocket adapter is for audio streams in general, I would say that it should ideally be placed in the audio bundle. The dependency on the voice manager is very small; maybe you could come up with some small hook, which could be used by the voice bundle to register the dialog processing logic into the websocket adapter?

Yes, having it on the voice bundle is quite unintuitive, I haven't though on that solution seems like the correct one.

Thank you for the feedback!

GiviMAD avatar Jan 13 '24 18:01 GiviMAD

I have to refactor the code into the websocket.io bundle for it to build without modifying the BOM features, but I think it also makes sense to have it there with the other WebSocketAdapter implementations.

GiviMAD avatar Jan 14 '24 23:01 GiviMAD

I think these is ready for the review.

I was able to write a POC in the UI and everything seems to work.

A quick video recorded with my mobile:

https://github.com/openhab/openhab-core/assets/9007708/04a033ed-0996-4a92-aa4d-7b5794420e04

Still need a lot of work on the UI side, I'm going to create a linked issue there asking for some guidance, I wanted to first have a POC to know there are no big issues with the integration.

Best regards!

GiviMAD avatar Jan 16 '24 18:01 GiviMAD