Categorygithub.com/milosgajdos/go-playht
modulepackage
0.1.2
Repository: https://github.com/milosgajdos/go-playht.git
Documentation: pkg.go.dev

# README

go-playht

Build Status go.dev reference License: Apache-2.0

Unofficial Go module for play.ht API client.

The official play.ht API documentation, upon which this Go module has been built, can be found here.

In order to use this Go module you must create an account with play.ht and generate API secret and retrieve your User ID. See the official docs here.

Get started

Get the module

go get ./...

Run tests:

go test -v ./...

There are a few code samples available in the examples directory so please do have a look. They could give you some idea about how to use this Go module.

[!IMPORTANT] Before you attempt to run the samples you must set a couple of environment variables These are automatically read by the client when it gets created; you can override them in your own code.

  • PLAYHT_SECRET_KEY: API secret key
  • PLAYHT_USER_ID: Play.HT User ID

Nix

There is a Nix flake file vailable which lets you work on the Go module using nix.

Just run the following command and you are in the business:

nix develop

Basics

There are two ways to create audio/speech from the text using the API:

  • Job: audio generation is done in async; when you create a job you can monitor its progress via SSE
  • Stream: a real-time audio stream available immediately as soon as the stream has been created via the API

The API also allows you to clone a voice using a small sample of limited size. See the docs.

[!NOTE] the proto code was generated by running protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative proto/api.proto

TODO

  • Lease refresh for gRPC streaming

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

Float32Ptr returns pointer to f.
Int32Ptr returns pointer to i.
MakeGrpcStreamRequest creates a new gRPC stream request from lease and req.
NewClient creates a new HTTP API client and returns it.
ToPbFormat converts OutputFormat to its proto representation.
ToPbQuality converts Quality to its proto representation.
WithBaseURL sets the API base URL.
WithGRPCClient sets the gRPC client.
WithHTTPClient sets the HTTP client.
WithSecretKey sets the secret key.
WithUserID sets the user ID.
WithVersion sets the API version.

# Constants

APIV2 V1 version.
APIV2 V2 version.
BaseURL is OpenAI HTTP API base URL.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GrpcAddr is the default gRPC endpoint.
No description provided by the author
2018-02-21 23:58:00 UTC.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
UserIDHeader.
No description provided by the author

# Variables

ErrUnknown is returned when an unknown error occurrs.

# Structs

APIError is a pseudo-sum type API error type.
Client is an OpenAI HTTP API client.
ClonedVoice data.
CloneVoiceFileRequest is used to create a voice clone.
CloneVoiceURLRequest is used to create a voice clone via file URL.
CreateLeaseReq is used to create a nw Lease.
CreateTTSJobReq is used to create a new TTS.
CreateTTSStreamReq is used to create TTS stream.
DeleteVoiceRequest is used to deleted cloned voice.
DeleteClonedVoiceResp is returned when the cloned voice has been deleted.
ErrGeneric is a generic API error.
ErrInternal is an error returned when the API responds with 50x status code.
ErrRateLimit is an error returned when the API rate limit is exceeded.
Lease for gRPC stream.
No description provided by the author
No description provided by the author
TTSJob is returned when a new TTS async job has been created.
TTSStreamURL is returned when the stream URL is requested.
Voice is the stock PlayHT voice.

# Type aliases

No description provided by the author
Option is functional graph option.
No description provided by the author
No description provided by the author
No description provided by the author