volcvoice

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package volcvoice implements engine.Engine for Volcengine Speech (火山语音 / openspeech.bytedance.com) TTS and ASR.

TTS uses POST /api/v1/tts with voice_type and encoding parameters. ASR uses POST /api/v1/asr with audio data in base64.

Authentication requires an AppID and Access Token, which can be set via Config or environment variables VOLC_SPEECH_APPID and VOLC_SPEECH_ACCESS_TOKEN.

Index

Constants

View Source
const (
	// TTS models (voice_type values).
	ModelTTSMega    = "volcano_mega"    // 大模型语音合成
	ModelTTSIcl     = "volcano_icl"     // 复刻音色
	ModelTTSDefault = "volcano_tts"     // 通用语音合成
	ModelASR        = "volcano_asr"     // 语音识别
	ModelASRLarge   = "volcano_asr_pro" // 语音识别 Pro
)

Model constants for TTS and ASR.

Variables

View Source
var (
	ErrMissingAppID       = errors.New("volcvoice: missing AppID (set Config.AppID or VOLC_SPEECH_APPID)")
	ErrMissingAccessToken = errors.New("volcvoice: missing AccessToken (set Config.AccessToken or VOLC_SPEECH_ACCESS_TOKEN)")
	ErrMissingText        = errors.New("volcvoice: missing text for TTS (set prompt)")
	ErrMissingAudioURL    = errors.New("volcvoice: missing audio_url for ASR")
	ErrMissingVoice       = errors.New("volcvoice: missing voice (set voice option)")
)

Functions

func ConfigSchema

func ConfigSchema() []engine.ConfigField

ConfigSchema returns the configuration fields required by the Volcengine Speech engine.

func ModelsByCapability

func ModelsByCapability() map[string][]string

ModelsByCapability returns all known Volcengine Speech models grouped by capability.

Types

type Config

type Config struct {
	AppID       string // Volcengine Speech AppID
	AccessToken string // Access token for authentication
	BaseURL     string // e.g. "https://openspeech.bytedance.com"
	Model       string // Model identifier, e.g. "volcano_mega"
	Cluster     string // TTS cluster override (default: auto-detected)

	HTTPClient *http.Client
}

Config configures the Volcengine Speech engine.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine implements engine.Engine for Volcengine Speech TTS/ASR.

func New

func New(cfg Config) *Engine

New creates a Volcengine Speech engine instance.

func (*Engine) Capabilities

func (e *Engine) Capabilities() engine.Capability

Capabilities implements engine.Describer.

func (*Engine) Execute

func (e *Engine) Execute(ctx context.Context, g workflow.Graph) (engine.Result, error)

Execute performs TTS or ASR based on the model.

Jump to

Keyboard shortcuts

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