summaryrefslogtreecommitdiff
path: root/internal/gui
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/gui
parent4727a188102d8166e4acabc4fd62863245e6cdce (diff)
zg: extract shared audio voice lists
Diffstat (limited to 'internal/gui')
-rw-r--r--internal/gui/generator.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/internal/gui/generator.go b/internal/gui/generator.go
index 7964e72..3491db2 100644
--- a/internal/gui/generator.go
+++ b/internal/gui/generator.go
@@ -63,11 +63,8 @@ func (a *Application) generateAudio(ctx context.Context, word string, cardDir st
}
}
- // Always use random voice and speed
- allVoices := []string{"alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"}
-
// Select a random voice
- voice, speed := randomVoiceAndSpeed(allVoices)
+ voice, speed := randomVoiceAndSpeed(audio.OpenAIVoices)
// Create a copy of audio config with selected voice and speed
audioConfig := *a.audioConfig
@@ -127,8 +124,7 @@ func (a *Application) generateAudioFront(ctx context.Context, word string, cardD
return "", fmt.Errorf("card directory not provided")
}
- allVoices := []string{"alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"}
- voice, speed := randomVoiceAndSpeed(allVoices)
+ voice, speed := randomVoiceAndSpeed(audio.OpenAIVoices)
audioConfig := *a.audioConfig
audioConfig.OpenAIVoice = voice
@@ -169,8 +165,7 @@ func (a *Application) generateAudioBack(ctx context.Context, text string, cardDi
return "", fmt.Errorf("card directory not provided")
}
- allVoices := []string{"alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"}
- voice, speed := randomVoiceAndSpeed(allVoices)
+ voice, speed := randomVoiceAndSpeed(audio.OpenAIVoices)
audioConfig := *a.audioConfig
audioConfig.OpenAIVoice = voice
@@ -201,8 +196,7 @@ func (a *Application) generateAudioBgBg(ctx context.Context, front, back, cardDi
return "", "", fmt.Errorf("card directory not provided")
}
- allVoices := []string{"alloy", "ash", "ballad", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer", "verse"}
- voice, speed := randomVoiceAndSpeed(allVoices)
+ voice, speed := randomVoiceAndSpeed(audio.OpenAIVoices)
audioConfig := *a.audioConfig
audioConfig.OpenAIVoice = voice