-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.go
66 lines (56 loc) · 1.17 KB
/
config.go
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
package azure_tts
import (
"os"
"runtime"
. "github.com/qieqieplus/azure-tts-go/protocol"
)
type SubscriptionConfig struct {
Key string
Region string
}
func (c *SubscriptionConfig) Valid() bool {
return c.Key != "" && c.Region != ""
}
func NewSubscriptionConfig(key, region string) *SubscriptionConfig {
return &SubscriptionConfig{
Key: key,
Region: region,
}
}
func NewDefaultSubscriptionConfig() *SubscriptionConfig {
return &SubscriptionConfig{
Key: os.Getenv("SPEECH_KEY"),
Region: os.Getenv("SPEECH_REGION"),
}
}
type SystemConfig SpeechConfig
func NewDefaultSystemConfig() *SystemConfig {
return &SystemConfig{
Context: SpeechConfigContext{
System: SystemInfo{
Name: "SpeechSDK",
Version: "1.34.0",
Build: "azure-tts-go",
Lang: "Go",
},
OS: OSInfo{
Platform: runtime.GOOS,
Name: "Go",
Version: runtime.Version(),
},
},
}
}
type AudioConfig SynthesisContext
func NewDefaultAudioConfig() *AudioConfig {
return &AudioConfig{
Synthesis: Synthesis{
Audio: AudioOptions{
OutputFormat: "audio-24khz-160kbitrate-mono-mp3",
},
Language: Language{
AutoDetection: true,
},
},
}
}