Merge branch 'master' of github.com:taigrr/elevenlabs

This commit is contained in:
2023-06-26 20:09:02 -07:00
4 changed files with 30 additions and 4 deletions

View File

@@ -13,11 +13,12 @@ import (
"github.com/taigrr/elevenlabs/client/types"
)
func (c Client) TTSWriter(ctx context.Context, w io.Writer, text, voiceID string, options types.SynthesisOptions) error {
func (c Client) TTSWriter(ctx context.Context, w io.Writer, text, modelID, voiceID string, options types.SynthesisOptions) error {
options.Clamp()
url := fmt.Sprintf(c.endpoint+"/v1/text-to-speech/%s", voiceID)
opts := types.TTS{
Text: text,
ModelID: modelID,
VoiceSettings: options,
}
b, _ := json.Marshal(opts)
@@ -55,12 +56,13 @@ func (c Client) TTSWriter(ctx context.Context, w io.Writer, text, voiceID string
}
}
func (c Client) TTS(ctx context.Context, text, voiceID string, options types.SynthesisOptions) ([]byte, error) {
func (c Client) TTS(ctx context.Context, text, voiceID, modelID string, options types.SynthesisOptions) ([]byte, error) {
options.Clamp()
url := fmt.Sprintf(c.endpoint+"/v1/text-to-speech/%s", voiceID)
client := &http.Client{}
opts := types.TTS{
Text: text,
ModelID: modelID,
VoiceSettings: options,
}
b, _ := json.Marshal(opts)