elevenlabs

package
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Elevenlabs API Client

This package provides a client for the Elevenlabs API, which is used to interact with the Elevenlabs Text-to-Speech service.

References:

Documentation

Overview

elevenlabs implements an API client for elevenlabs (https://elevenlabs.io/docs/api-reference/text-to-speech)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
}

func New

func New(ApiKey string, opts ...client.ClientOpt) (*Client, error)

func (*Client) Models added in v1.0.4

func (c *Client) Models() ([]Model, error)

Return models

func (*Client) SetVoiceSettings added in v1.0.4

func (c *Client) SetVoiceSettings(Id string, v VoiceSettings) error

Set voice settings for a voice

func (*Client) TextToSpeech added in v0.0.3

func (c *Client) TextToSpeech(w io.Writer, voice, text string, opts ...Opt) (int64, error)

Converts text into speech, returning the number of bytes written to the writer

func (*Client) Voice added in v0.0.3

func (c *Client) Voice(Id string) (Voice, error)

Return a single voice

func (*Client) VoiceSettings added in v1.0.4

func (c *Client) VoiceSettings(Id string) (VoiceSettings, error)

Return voice settings. If Id is empty, then return the default voice settings

func (*Client) Voices added in v0.0.3

func (c *Client) Voices() ([]Voice, error)

Return current set of voices

type Model added in v1.0.4

type Model struct {
	Id                   string  `json:"model_id" writer:",width:30"`
	Name                 string  `json:"name" writer:",width:30,wrap"`
	Description          string  `json:"description,omitempty" writer:",wrap"`
	CanBeFineTuned       bool    `json:"can_be_fine_tuned" writer:",width:5"`
	CanDoTextToSpeech    bool    `json:"can_do_text_to_speech" writer:",width:5"`
	CanDoVoiceConversion bool    `json:"can_do_voice_conversion" writer:",width:5"`
	CanUseStyle          bool    `json:"can_use_style" writer:",width:5"`
	CanUseSpeakerBoost   bool    `json:"can_use_speaker_boost" writer:",width:5"`
	ServesProVoices      bool    `json:"serves_pro_voices" writer:",width:5"`
	TokenCostFactor      float32 `json:"token_cost_factor" writer:",width:5,right"`
	RequiresAlphaAccess  bool    `json:"requires_alpha_access,omitempty" writer:",width:5"`
	Languages            []struct {
		Id   string `json:"language_id"`
		Name string `json:"name"`
	} `json:"languages,omitempty" writer:",wrap"`
}

type Opt added in v0.0.3

type Opt func(*opts) error

Opt is a function which can be used to set options on a request

func OptFormat added in v1.0.4

func OptFormat(v string) Opt

Set the output format

func OptFormatMP3 added in v1.0.4

func OptFormatMP3(bitrate, samplerate uint) Opt

Set the output format to MP3 given bitrate and samplerate

func OptFormatPCM added in v1.0.4

func OptFormatPCM(samplerate uint) Opt

Set the output format to PCM

func OptFormatULAW added in v1.0.4

func OptFormatULAW() Opt

Set the output format to ULAW

func OptModel added in v0.0.3

func OptModel(v string) Opt

Set the voice model

func OptSeed added in v0.0.3

func OptSeed(v uint) Opt

Set the deterministic seed

type Voice added in v0.0.3

type Voice struct {
	Id          string `json:"voice_id" writer:",width:20"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty" writer:",wrap"`
	PreviewUrl  string `json:"preview_url,omitempty" writer:",width:40,wrap"`
	Category    string `json:"category,omitempty" writer:",width:10"`
	Samples     []struct {
		Id       string `json:"sample_id"`
		Filename string `json:"file_name"`
		MimeType string `json:"mime_type"`
		Size     int64  `json:"size_bytes"`
		Hash     string `json:"hash"`
	} `json:"samples,omitempty" writer:"samples,wrap"`
	Settings VoiceSettings `json:"settings" writer:"settings,wrap,width:20"`
}

type VoiceSettings added in v0.0.3

type VoiceSettings struct {
	SimilarityBoost float32 `json:"similarity_boost"`
	Stability       float32 `json:"stability"`
	Style           float32 `json:"style,omitempty"`
	UseSpeakerBoost bool    `json:"use_speaker_boost"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL