Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Speech-synthesis/Go/speech-synthesis.go
Normal file
28
Task/Speech-synthesis/Go/speech-synthesis.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go/build"
|
||||
"log"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/unixpickle/gospeech"
|
||||
"github.com/unixpickle/wav"
|
||||
)
|
||||
|
||||
const pkgPath = "github.com/unixpickle/gospeech"
|
||||
const input = "This is an example of speech synthesis."
|
||||
|
||||
func main() {
|
||||
p, err := build.Import(pkgPath, ".", build.FindOnly)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
d := filepath.Join(p.Dir, "dict/cmudict-IPA.txt")
|
||||
dict, err := gospeech.LoadDictionary(d)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
phonetics := dict.TranslateToIPA(input)
|
||||
synthesized := gospeech.DefaultVoice.Synthesize(phonetics)
|
||||
wav.WriteFile(synthesized, "output.wav")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue