Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PlayHT to use the latest Websocket connection endpoint #897

Merged
merged 1 commit into from
Dec 21, 2024

Conversation

markbackman
Copy link
Contributor

@markbackman markbackman commented Dec 20, 2024

Please describe the changes in your PR. If it is addressing an issue, please reference that as well.

Updating to support the latest Websocket API from PlayHT: https://docs.play.ht/reference/playht-tts-websocket-api. This new endpoint also appears to solve the missing audio issue where sentences wouldn't be spoken.

Service changes impacting this PR:

  1. Websocket URL:
When you make a POST request to /api/v4/websocket-auth, you get back a response like this:
jsonCopy{
  "websocket_urls": {
    "Play3.0-mini": "wss://ws.fal.run/playht-fal/playht-tts/ws?fal_jwt_token=<token1>",
    "PlayDialog": "wss://ws.fal.run/playht-fal/playht-tts-ldm/ws?fal_jwt_token=<token2>",
    "PlayDialogMultilingual": "wss://ws.fal.run/playht-fal/playht-tts-multilingual-ldm/ws?fal_jwt_token=<token3>"
  },
  "expires_at": "2024-12-11T22:17:37.429Z"
}

We need to get the wss URL from the response.

  1. Also, they now include start and end messages:
For each request, receive, in order, a {"type":"start"} message, followed by audio output as binary messages, and a {"type":"end"} as indicator of end of request.

@aconchillo
Copy link
Contributor

Nice! LGTM

@markbackman markbackman merged commit 503eddf into main Dec 21, 2024
4 checks passed
@markbackman markbackman deleted the mb/update-playht branch December 21, 2024 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants