summaryrefslogtreecommitdiff
path: root/internal/audio/voices.go
blob: 2f6b5aa543ef222d813e6fef125fa9d865903a4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package audio

import "strings"

// OpenAIVoices lists the OpenAI voices supported by the app.
var OpenAIVoices = []string{
	"alloy",
	"ash",
	"ballad",
	"coral",
	"echo",
	"fable",
	"onyx",
	"nova",
	"sage",
	"shimmer",
	"verse",
}

// GeminiVoices lists the Gemini prebuilt voices supported by the app.
var GeminiVoices = []string{
	"Zephyr",
	"Puck",
	"Charon",
	"Kore",
	"Fenrir",
	"Leda",
	"Orus",
	"Aoede",
	"Callirrhoe",
	"Autonoe",
	"Enceladus",
	"Iapetus",
	"Umbriel",
	"Algieba",
	"Despina",
	"Erinome",
	"Gacrux",
	"Pulcherrima",
	"Achernar",
	"Rasalgethi",
	"Laomedeia",
	"Sadachbia",
	"Schedar",
	"Sulafat",
	"Vindemiatrix",
	"Zubenelgenubi",
}

// GeminiVoiceFallbacks returns the selected voice first, followed by the remaining known Gemini voices.
func GeminiVoiceFallbacks(selected string) []string {
	selected = strings.TrimSpace(selected)
	if selected == "" {
		return append([]string(nil), GeminiVoices...)
	}

	fallbacks := []string{selected}
	seen := map[string]struct{}{selected: {}}
	for _, voice := range GeminiVoices {
		voice = strings.TrimSpace(voice)
		if voice == "" {
			continue
		}
		if _, ok := seen[voice]; ok {
			continue
		}
		fallbacks = append(fallbacks, voice)
		seen[voice] = struct{}{}
	}

	return fallbacks
}