sami

package
v1.0.107 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultRegion          = "cn-north-1"
	ServiceVersion20210727 = "2021-07-27"
	ServiceName            = "sami"
	SamiDomain             = "https://sami.bytedance.com"
)

Variables

View Source
var (
	ServiceInfo = &base.ServiceInfo{
		Timeout: 10 * time.Second,
		Host:    "open.volcengineapi.com",
		Header:  http.Header{},
	}

	ApiInfoList = map[string]*base.ApiInfo{
		"GetToken": {
			Method: http.MethodPost,
			Path:   "/",
			Query: url.Values{
				"Action":  []string{"GetToken"},
				"Version": []string{ServiceVersion20210727},
			},
		},
	}
)
View Source
var DefaultInstance = NewInstance()

DefaultInstance 默认的实例

Functions

This section is empty.

Types

type AudioConfig

type AudioConfig struct {
	Format          string `json:"format"`
	SampleRate      int    `json:"sample_rate"`
	SpeechRate      int    `json:"speech_rate"`
	PitchRate       int    `json:"pitch_rate"`
	EnableTimestamp bool   `json:"enable_timestamp"`
}

type GetTokenReq

type GetTokenReq struct {
	Version    string `json:"token_version"`
	Appkey     string `json:"appkey"`
	Expiration int64  `json:"expiration"`
}

type GetTokenResponse

type GetTokenResponse struct {
	StatusCode int32  `form:"status_code,required" json:"status_code,required" query:"status_code,required"`
	StatusText string `form:"status_text,required" json:"status_text,required" query:"status_text,required"`
	TaskId     string `form:"task_id,required" json:"task_id,required" query:"task_id,required"`
	Token      string `form:"token,required" json:"token,required" query:"token,required"`
	ExpiresAt  int64  `form:"expires_at,required" json:"expires_at,required" query:"expires_at,required"`
}

type InvokeRequest

type InvokeRequest struct {
	Data    []byte  `json:"data,omitempty"`
	Payload *string `json:"payload,omitempty"`
}

type InvokeResponse

type InvokeResponse struct {
	StatusCode int32   `form:"status_code,required" json:"status_code,required" query:"status_code,required"`
	StatusText string  `form:"status_text,required" json:"status_text,required" query:"status_text,required"`
	TaskId     string  `form:"task_id,required" json:"task_id,required" query:"task_id,required"`
	Namespace  string  `form:"namespace,required" json:"namespace,required" query:"namespace,required"`
	Payload    *string `form:"payload,omitempty" json:"payload,omitempty" query:"payload,omitempty"`
	Data       []byte  `form:"data,omitempty" json:"data,omitempty" query:"data,omitempty"`
	State      *string `form:"state,omitempty" json:"state,omitempty" query:"state,omitempty"`
}

type PhoneInfo

type PhoneInfo struct {
	Phone     string  `json:"phone"`
	StartTime float32 `json:"start_time"`
	EndTime   float32 `json:"end_time"`
}

PhoneInfo includes phone information

type Sami

type Sami struct {
	Client *base.Client
}

IAM .

func NewInstance

func NewInstance() *Sami

NewInstance 创建一个实例

func (*Sami) GetAPIInfo

func (p *Sami) GetAPIInfo(api string) *base.ApiInfo

GetAPIInfo interface

func (*Sami) GetServiceInfo

func (p *Sami) GetServiceInfo() *base.ServiceInfo

GetServiceInfo interface

func (*Sami) GetToken

func (p *Sami) GetToken(req GetTokenReq) (*GetTokenResponse, int, error)

func (*Sami) SetHost

func (p *Sami) SetHost(host string)

SetHost .

func (*Sami) SetRegion

func (p *Sami) SetRegion(region string)

SetRegion

func (*Sami) SetSchema

func (p *Sami) SetSchema(schema string)

SetSchema .

func (*Sami) TTS

func (p *Sami) TTS(req SpeechSynthesisReq, appkey string, token string) (*InvokeResponse, int, error)

type SpeechSynthesisReq

type SpeechSynthesisReq struct {
	Text    string      `json:"text"`
	SSML    string      `json:"ssml"`
	Speaker string      `json:"speaker,omitempty"`
	Config  AudioConfig `json:"audio_config"`
}

type SpeechSynthesisResponse

type SpeechSynthesisResponse struct {
	AudioDuration float32     `json:"duration,omitempty"`
	Words         []WordInfo  `json:"words,omitempty"`
	Phonemes      []PhoneInfo `json:"phonemes,omitempty"`
}

type WordInfo

type WordInfo struct {
	Word      string  `json:"word"`
	StartTime float32 `json:"start_time"`
	EndTime   float32 `json:"end_time"`
}

WordInfo includes ASR word information

Jump to

Keyboard shortcuts

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