This library allows simple interfacing to the Kyutai production rust server for both TTS and STT.
The rust server uses websocket connections with message pack payloads. The purpose of this library is to abstract the websocket connection and message pack serialization to provide a simple API to send text to the TTS server or send audio to the STT server using only go channels.
go get github.com/hekmon/kyutai-rs- Create a TTS or STT client
- Use the client to create a connection with
Connect() - The return connection object will have 3 importants methods to call after that:
GetWriteChan(): to send data to the serverGetReadChan(): to receive data from the serverGetContext(): the connection context linked to the background websockets workers, only use the read and write channels while this context is valid.
- Once you are done, you must close the write channel to inform the library to prepare a clean stop.
- Wait for the read channel to be closed by its background worker.
- Wait for the full stop of workers on the connection closure with the
Done()connection's method. This will ensure all backgrounds workers are properly stopped and resources are freed. If any errors occured during the websocket connection (and caused the connection context to be canceled), this is where you will get the error.
See the TTS client and the STT client for complete example on how to use the library.