summaryrefslogtreecommitdiff
path: root/internal/processor/processor.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-01 20:20:04 +0300
committerPaul Buetow <paul@buetow.org>2026-04-01 20:20:04 +0300
commit4f1d809b83c373aa27cd453bd7b3e04ab9719878 (patch)
treeda49fd3c9a73079eaf41d8fcefee24d16b85e8dc /internal/processor/processor.go
parent4727a188102d8166e4acabc4fd62863245e6cdce (diff)
zg: extract shared audio voice lists
Diffstat (limited to 'internal/processor/processor.go')
-rw-r--r--internal/processor/processor.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/internal/processor/processor.go b/internal/processor/processor.go
index d7025a6..d2a380b 100644
--- a/internal/processor/processor.go
+++ b/internal/processor/processor.go
@@ -241,19 +241,17 @@ func (p *Processor) ProcessWordWithTranslationAndType(word, providedTranslation
// generateAudio generates audio files for a word
func (p *Processor) generateAudio(word string) error {
- allVoicesList := []string{"alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"}
-
// Get list of voices to use
var voices []string
if p.flags.AllVoices {
- voices = allVoicesList
+ voices = audio.OpenAIVoices
} else if p.flags.OpenAIVoice != "" {
// Use explicitly specified voice
voices = []string{p.flags.OpenAIVoice}
fmt.Printf(" Using specified voice: %s\n", p.flags.OpenAIVoice)
} else {
// Select a random voice
- randomVoice := allVoicesList[rand.Intn(len(allVoicesList))]
+ randomVoice := audio.OpenAIVoices[rand.Intn(len(audio.OpenAIVoices))]
voices = []string{randomVoice}
fmt.Printf(" Using random voice: %s\n", randomVoice)
}
@@ -273,10 +271,8 @@ func (p *Processor) generateAudio(word string) error {
// generateAudioBgBg generates audio files for both sides of a bg-bg card
func (p *Processor) generateAudioBgBg(front, back string) error {
- allVoicesList := []string{"alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"}
-
// Select a random voice (same voice for both sides for consistency)
- voice := allVoicesList[rand.Intn(len(allVoicesList))]
+ voice := audio.OpenAIVoices[rand.Intn(len(audio.OpenAIVoices))]
if p.flags.OpenAIVoice != "" {
voice = p.flags.OpenAIVoice
}