livekit / agents

Build real-time multimodal AI applications šŸ¤–šŸŽ™ļøšŸ“¹
https://docs.livekit.io/agents
Apache License 2.0
3.9k stars 394 forks source link

[BUGS]: PlayHT Plugin: Wrong encoding calculation and sample rate being ignored #846

Open divyanshu-shortloop opened 1 month ago

divyanshu-shortloop commented 1 month ago

I get a Value Error: Unknown format: wav error when using defaults for the playht plugin.

tts=playht.TTS()

I found the following line:

https://github.com/livekit/agents/blob/ff2b6605cb61f26f51a3d64024babd0e747123c2/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py#L163

_encoding_from_format expects an argument of type TTSEncoding whereas a _TTSEncoding arg is being passed. Both are different types and don't have any overlaps.

https://github.com/livekit/agents/blob/ff2b6605cb61f26f51a3d64024babd0e747123c2/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/tts.py#L58

https://github.com/livekit/agents/blob/ff2b6605cb61f26f51a3d64024babd0e747123c2/livekit-plugins/livekit-plugins-playht/livekit/plugins/playht/models.py#L5-L15

Above TTSEncoding values are also incorrect for PlayHT API and seem to be copied from elevenlab plugin. Also the sample rate provided in the top level config is never provided to the PlayHT api (in the json payload).

Is the plugin a Work In Progress? I think it should be removed from the README if it is.

davidzhao commented 1 month ago

this was contributed by a community member. would you like to submit a PR to improve/fix the issues?