Skip to content

Use Microsoft Edge's online text-to-speech service from go WITHOUT needing Microsoft Edge or Windows or an API key

License

Notifications You must be signed in to change notification settings

xiaolibuzai-ovo/edge-tts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

edge-tts

Use Microsoft Edge's online text-to-speech service from go WITHOUT needing Microsoft Edge or Windows or an API key

Getting started

go get -u github.com/xiaolibuzai-ovo/edge-tts

Example

Text-to-Speech

package main

import (
	edgeTTS "github.com/xiaolibuzai-ovo/edge-tts/pkg/wrapper"
	"golang.org/x/net/context"
	"io"
	"os"
)

func main() {
	tts := edgeTTS.NewEdgeTTS()
	voice := "zh-CN-XiaoxiaoNeural"
	speech, err := tts.TextToSpeech(context.Background(), "hello,world", voice)
	if err != nil {
		return
	}

	// speech is io.ReaderCloser
	// such as
	filePath := "./output.mp3"
	file, err := os.Create(filePath)
	if err != nil {
		return
	}
	defer file.Close()
	io.Copy(file, speech)
}

voice-list

package main

import (
	"fmt"
	edgeTTS "github.com/xiaolibuzai-ovo/edge-tts/pkg/wrapper"
	"golang.org/x/net/context"
)

func main() {
	tts := edgeTTS.NewEdgeTTS()
	voiceList, err := tts.VoiceList(context.Background())
	if err != nil {
		return
	}

	fmt.Println(voiceList)
}

refer

About

Use Microsoft Edge's online text-to-speech service from go WITHOUT needing Microsoft Edge or Windows or an API key

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages