-
Notifications
You must be signed in to change notification settings - Fork 6
/
model.go
81 lines (73 loc) · 2.37 KB
/
model.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package ivona
// SpeechResponse is the resource representing response from CreateSpeech action.
type SpeechResponse struct {
Audio []byte
RequestID string
ContentType string
}
// ListResponse is the resource representing response from ListVoices action.
type ListResponse struct {
Voices []Voice
RequestID string
ContentType string
}
// SpeechOptions is the set of parameters that can be used on the CreateSpeech action.
// For more details see http://developer.ivona.com/en/speechcloud/api_ref_actions.html#CreateSpeech.
type SpeechOptions struct {
Input *Input
OutputFormat *OutputFormat
Parameters *Parameters
Voice *Voice
}
// NewSpeechOptions is the set of default parameters that can be used the CreateSpeech action.
// For more details see http://developer.ivona.com/en/speechcloud/api_ref_actions.html#CreateSpeech_DefaultValues.
func NewSpeechOptions(data string) SpeechOptions {
return SpeechOptions{
Input: &Input{
Data: data,
Type: "text/plain",
},
OutputFormat: &OutputFormat{
Codec: "MP3",
SampleRate: 22050,
},
Parameters: &Parameters{
Rate: "medium",
Volume: "medium",
SentenceBreak: 400,
ParagraphBreak: 640,
},
Voice: &Voice{
Name: "Salli",
Language: "en-US",
Gender: "Female",
},
}
}
// Input contains attributes describing the user input.
// For more details see http://developer.ivona.com/en/speechcloud/api_ref_data_types.html#DataTypes_Input.
type Input struct {
Data string
Type string
}
// OutputFormat contains attributes describing the audio compression and format in which the returned stream should be encoded.
// For more details see http://developer.ivona.com/en/speechcloud/api_ref_data_types.html#DataTypes_OutputFormat.
type OutputFormat struct {
Codec string
SampleRate int
}
// Parameters contains additional attributes affecting the generated speech.
// For more details see http://developer.ivona.com/en/speechcloud/api_ref_data_types.html#DataTypes_Parameters.
type Parameters struct {
Rate string
Volume string
SentenceBreak int
ParagraphBreak int
}
// Voice contains a filter for the voice selection that should be used for the speech synthesis.
// For more details see http://developer.ivona.com/en/speechcloud/api_ref_data_types.html#DataTypes_Voice.
type Voice struct {
Name string
Language string
Gender string
}