Versions in this module Expand all Collapse all v0 v0.1.1 Aug 20, 2026 v0.1.0 Aug 20, 2026 Changes in this version + const CompressionGZIP + const CompressionNone + const DefaultSampleRate + const FlagEventWithSequence + const FlagNegWithSequence + const FlagNoSequence + const FlagPosSequence + const MessageTypeClientAudioOnlyRequest + const MessageTypeClientFullRequest + const MessageTypeServerAck + const MessageTypeServerErrorResponse + const MessageTypeServerFullResponse + const ProtocolVersionV1 + const SerializationJSON + const SerializationNone + const SerializationRaw + var ErrClientClosed = errClientClosed("asr client closed") + func BuildAuthHeader(auth AuthConfig) http.Header + func ComputeSampleByteCount(sampleRate, bitDepth, channels int) int + func DefaultVolcEndWindowMs() int + func GzipCompress(input []byte) []byte + func GzipDecompress(input []byte) []byte + func NewAudioOnlyRequest(seq int, segment []byte) []byte + func NewFullClientRequest(config *Config) []byte + func RegisterAllVendors(f *DefaultFactory, registrations map[Vendor]Creator) + func SetGlobalFactory(factory *DefaultFactory) + func VendorString(v Vendor) string + type AudioConfig struct + Bits int + Channel int + Codec string + Format string + Rate int + type AudioFrame struct + Data []byte + IsEnd bool + type AudioMeta struct + Bits int + Channel int + Codec string + Format string + Rate int + type AuthConfig struct + AccessKey string + AppKey string + ResourceId string + type BaseEngine struct + func NewBaseEngine(vendorName string) *BaseEngine + func (b *BaseEngine) Callbacks() (ResultFunc, ErrorFunc) + func (b *BaseEngine) DialogID() string + func (b *BaseEngine) EmitError(err error, isFatal bool) + func (b *BaseEngine) EmitFinal(text string) + func (b *BaseEngine) EmitPartial(text string) + func (b *BaseEngine) HasSentence() bool + func (b *BaseEngine) Init(tr ResultFunc, er ErrorFunc) + func (b *BaseEngine) MarkEnd() + func (b *BaseEngine) ResetState() + func (b *BaseEngine) Sentence() string + func (b *BaseEngine) SetDialogID(id string) + func (b *BaseEngine) SinceSend() time.Duration + func (b *BaseEngine) Vendor() string + type BufferConfig struct + MaxBufferSize int + SegmentDurationMs int + type Client struct + func NewClient(config *Config) *Client + func (c *Client) Close() + func (c *Client) Connect(ctx context.Context) error + func (c *Client) GetTraceID() string + func (c *Client) IsClosed() bool + func (c *Client) ReceiveResult() (*Response, error) + func (c *Client) SendAudioFrame(frame *AudioFrame) error + func (c *Client) SetErrorCallback(handler func(error)) + func (c *Client) SetTimeouts(sendTimeout, recvTimeout time.Duration) + type CompressionType byte + type Config struct + Audio AudioConfig + Auth AuthConfig + Buffer BufferConfig + Request RequestConfig + URL string + User UserConfig + func DefaultConfig() *Config + func (c *Config) CalculateBufferSize() int + func (c *Config) WithAudio(audio AudioConfig) *Config + func (c *Config) WithAuth(auth AuthConfig) *Config + func (c *Config) WithBuffer(buffer BufferConfig) *Config + func (c *Config) WithRequest(request RequestConfig) *Config + func (c *Config) WithURL(url string) *Config + func (c *Config) WithUser(user UserConfig) *Config + type CorpusConfig struct + BoostingTableName string + Context string + CorrectTableName string + type CorpusMeta struct + BoostingTableName string + Context string + CorrectTableName string + type Creator func(TranscriberConfig) (Engine, error) + type DefaultFactory struct + func GetGlobalFactory() *DefaultFactory + func NewFactory() *DefaultFactory + func (f *DefaultFactory) CreateTranscriber(config TranscriberConfig) (Engine, error) + func (f *DefaultFactory) GetSupportedVendors() []Vendor + func (f *DefaultFactory) IsVendorSupported(vendor Vendor) bool + func (f *DefaultFactory) RegisterCreator(vendor Vendor, creator Creator) + type Engine interface + Activity func() bool + ConnAndReceive func(dialogID string) error + Init func(resultCallback ResultFunc, errorCallback ErrorFunc) + RestartClient func() + SendAudioBytes func(data []byte) error + SendEnd func() error + StopConn func() error + Vendor func() string + func Create(config TranscriberConfig) (Engine, error) + func MustCreate(config TranscriberConfig) Engine + type ErrorFunc func(err error, isFatal bool) + type Factory interface + CreateTranscriber func(config TranscriberConfig) (Engine, error) + GetSupportedVendors func() []Vendor + IsVendorSupported func(vendor Vendor) bool + RegisterCreator func(vendor Vendor, creator Creator) + type HotWord struct + Weight int + Word string + type MessageType byte + type MessageTypeSpecificFlags byte + type ProtocolHeader struct + func NewDefaultHeader() *ProtocolHeader + func (h *ProtocolHeader) Serialize() []byte + func (h *ProtocolHeader) SetCompressionType(compType CompressionType) *ProtocolHeader + func (h *ProtocolHeader) SetMessageType(msgType MessageType) *ProtocolHeader + func (h *ProtocolHeader) SetMessageTypeFlags(flags MessageTypeSpecificFlags) *ProtocolHeader + func (h *ProtocolHeader) SetReservedData(data []byte) *ProtocolHeader + func (h *ProtocolHeader) SetSerializationType(serType SerializationType) *ProtocolHeader + type ProtocolVersion byte + type Recognizer struct + func NewRecognizer(config *Config) *Recognizer + func (r *Recognizer) GetTraceID() string + func (r *Recognizer) OnError(callback onErrorFunc) + func (r *Recognizer) OnResult(callback onResultFunc) + func (r *Recognizer) SendAudioFrame(frame *AudioFrame) error + func (r *Recognizer) Start() error + func (r *Recognizer) Stop() + type RequestConfig struct + Corpus CorpusConfig + EnableDDC bool + EnableITN bool + EnableNonstream bool + EnablePUNC bool + EndWindowSize int + ModelName string + ShowUtterances bool + type RequestMeta struct + Corpus CorpusMeta + EnableDDC bool + EnableITN bool + EnableNonstream bool + EnablePUNC bool + EndWindowSize int + ModelName string + ShowUtterances bool + type RequestPayload struct + Audio AudioMeta + Request RequestMeta + User UserMeta + type Response struct + Code int + Err error + Event int + IsLastPackage bool + PayloadMsg *ResponsePayload + PayloadSequence int32 + PayloadSize int + func ParseResponse(msg []byte) *Response + type ResponsePayload struct + AudioInfo struct{ ... } + Error string + Result struct{ ... } + type Result struct + Error error + IsFinal bool + Text string + Timestamp time.Time + type ResultCallback func(*Result) + type ResultFunc func(text string, isLast bool, duration time.Duration, dialogID string) + type SerializationType byte + type TimeoutConfig struct + Read time.Duration + Send time.Duration + func DefaultTimeoutConfig() TimeoutConfig + type TranscriberConfig interface + GetVendor func() Vendor + type UserConfig struct + APPVersion string + DID string + Platform string + SDKVersion string + UID string + type UserMeta struct + APPVersion string + DID string + Platform string + SDKVersion string + UID string + type Vendor string + const VendorAWS + const VendorAliyun + const VendorBaidu + const VendorDeepgram + const VendorFunASR + const VendorFunASRRealtime + const VendorGladia + const VendorGoogle + const VendorLocal + const VendorQCloud + const VendorVoiceAPI + const VendorVolcengine + const VendorVolcengineLLM + const VendorWhisper + const VendorXfyunMul + func AllVendors() []Vendor + func GetVendor(provider string) Vendor