-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.go
44 lines (34 loc) · 1.47 KB
/
test.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
package main
import (
"fmt"
. "github.com/FaaSTools/GoText2Speech/GoText2Speech"
providers "github.com/FaaSTools/GoText2Speech/GoText2Speech/providers"
. "github.com/FaaSTools/GoText2Speech/GoText2Speech/shared"
"os"
)
// main shows how T2S might be executed.
func main() {
fmt.Println("Starting speech synthesis...")
t2sClient := CreateGoT2SClient(nil, "us-east-1")
options := GetDefaultTextToSpeechOptions()
options.Provider = providers.ProviderAWS
//options.VoiceConfig.VoiceIdConfig = VoiceIdConfig{VoiceId: "en-US-News-N"}
options.VoiceConfig.VoiceParamsConfig = VoiceParamsConfig{
LanguageCode: "en-US",
Gender: VoiceGenderFemale,
Engine: "neural",
}
bucket := "YOUR_BUCKET_HERE"
var err error = nil
t2sClient, err = t2sClient.T2SDirect("<speak><prosody volume=\"10.000dB\">Hello World, how are you today? Lovely day, isn't it?</prosody></speak>", "s3://"+bucket+"/testfile.mp3", *options)
t2sClient, err = t2sClient.T2SDirect("Test", "s3://"+bucket+"/testfile_02.mp3", *options)
t2sClient, err = t2sClient.T2S("https://www.davemeyer.io/GoSpeechLess/T2S_Test_file_01.txt", "s3://"+bucket+"/testfile_03.mp3", *options)
t2sClient.SetTempBucket(providers.ProviderAWS, bucket)
t2sClient, err = t2sClient.T2S("https://"+bucket+".s3.amazonaws.com/T2S_Test_file_01.txt", "D:\\testfile_04.mp3", *options)
err = t2sClient.CloseAllProviderClients()
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
fmt.Println("Speech successfully synthesized!")
}