voice

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeFirstLine  = "first_line"
	ModeLineLimit  = "line_limit"
	ModeAfterFirst = "after_first"
	ModeFullText   = "full_text"
	ModeCharLimit  = "char_limit"
)

ReadingMode constants

View Source
const (
	EngineVoicevox    = "voicevox"
	EngineAivisSpeech = "aivisspeech"
)

Engine constants

View Source
const (
	VoicevoxURL    = "http://127.0.0.1:50021"
	AivisSpeechURL = "http://127.0.0.1:10101"
)

Default engine URLs

Variables

This section is empty.

Functions

func StripMarkdown

func StripMarkdown(text string) string

StripMarkdown removes markdown formatting using mdstrip if available

Types

type AudioQuery

type AudioQuery struct {
	Text              string  `json:"text"`
	SpeedScale        float64 `json:"speedScale"`
	PitchScale        float64 `json:"pitchScale"`
	VolumeScale       float64 `json:"volumeScale"`
	PrePhonemeLength  float64 `json:"prePhonemeLength"`
	PostPhonemeLength float64 `json:"postPhonemeLength"`
}

AudioQuery represents the audio query for voice synthesis

type Config

type Config struct {
	// Engine settings
	EnginePriority     string `json:"engine_priority"`     // "voicevox" or "aivisspeech"
	VoicevoxSpeaker    int    `json:"voicevox_speaker"`    // VOICEVOX speaker ID
	AivisSpeechSpeaker int64  `json:"aivisspeech_speaker"` // AivisSpeech speaker ID

	// Reading settings
	ReadingMode string `json:"reading_mode"` // first_line, line_limit, after_first, full_text, char_limit
	MaxChars    int    `json:"max_chars"`    // Character limit for char_limit mode
	MaxLines    int    `json:"max_lines"`    // Line limit for line_limit mode

	// Processing settings
	UUIDMode bool `json:"uuid_mode"` // Use UUID search mode (slower but complete)
}

Config represents voice synthesis configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default voice configuration

type TranscriptMessage

type TranscriptMessage struct {
	Type    string `json:"type"`
	UUID    string `json:"uuid,omitempty"`
	Message struct {
		Role    string `json:"role"`
		Content []struct {
			Type string `json:"type"`
			Text string `json:"text,omitempty"`
		} `json:"content"`
	} `json:"message,omitempty"`
}

TranscriptMessage represents a message in Claude Code transcript

type TranscriptReader

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

TranscriptReader reads Claude Code transcript files

func NewTranscriptReader

func NewTranscriptReader(config *Config) *TranscriptReader

NewTranscriptReader creates a new transcript reader

func (*TranscriptReader) FindLatestTranscript

func (tr *TranscriptReader) FindLatestTranscript() (string, error)

FindLatestTranscript finds the most recent transcript file

func (*TranscriptReader) GetLatestAssistantMessage

func (tr *TranscriptReader) GetLatestAssistantMessage(transcriptPath string) (string, error)

GetLatestAssistantMessage extracts the latest assistant message from transcript

func (*TranscriptReader) ProcessText

func (tr *TranscriptReader) ProcessText(text string) string

ProcessText applies reading mode restrictions to the text

type VoiceEngine

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

VoiceEngine handles voice synthesis

func NewVoiceEngine

func NewVoiceEngine(config *Config) *VoiceEngine

NewVoiceEngine creates a new voice engine

func (*VoiceEngine) CheckEngines

func (ve *VoiceEngine) CheckEngines() (voicevoxAvailable, aivisSpeechAvailable bool)

CheckEngines checks which voice engines are available

func (*VoiceEngine) Play

func (ve *VoiceEngine) Play(audioFile string) error

Play plays the audio file

func (*VoiceEngine) SelectEngine

func (ve *VoiceEngine) SelectEngine() (string, error)

SelectEngine selects which engine to use based on availability and priority

func (*VoiceEngine) Synthesize

func (ve *VoiceEngine) Synthesize(text string) (string, error)

Synthesize generates audio from text

Jump to

Keyboard shortcuts

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