Socket
Socket
Sign inDemoInstall

github.com/shrotavre/gotts

Package Overview
Dependencies
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/shrotavre/gotts

Package gotts is a text-to-speech package made using Google Translate's functionalities underhood.


Version published

Readme

Source

Gotts GoDoc Go Report Card

Golang Text To Speech package. Included CLI tool to generate sound file from text.

Basically a text-to-speech, and save it for you to a file. This tool works over Google Translate's API hence needing internet to actually work.

Usage

// main.go
package main

import (
	"fmt"

	"github.com/shrotavre/gotts"
)

func main() {
	g := gotts.NewGotts()

	// Make Speech URL
	opt := gotts.Options{}.FillDefaults()
	url, err := g.MakeSpeechURL("Hello world!", opt)
	if err != nil {
		panic(err)
	}

	fmt.Println("Speech URL acquired: ", url)
	// Output: Speech URL acquired: https://translate.google.com/translate_tt...

	// Make Speech File
	opt = gotts.Options{Lang: "id"}.FillDefaults()
	err = g.MakeSpeechFile("Halo dunia!", opt)
	if err != nil {
		panic(err)
	}

	fmt.Println("Speech file generated!")
	// Output: Speech file generated!
}

CLI Usage

Installation

Download binary version from release page matching your operating system.

Usage

You can use gotts by executing the downloaded binary via your cli and supply the required arguments.

# BASIC ARGS:
# run this command for the most basic usage
# this will create 'Hello from Shrotavre.mpg' in your current directory
$ ./gotts text="Hello from Shrotavre!"


# OTHER ARGS:
# 'dir' and 'name' args to set where to save the files
$ ./gotts text="Hello!" dir="/Documents/voices" name="test.mpg" 

# 'lang' arg to set voice language/locale
# see here for more information on available locales:
$ ./gotts text="Halo, apa kabar?" lang="id"

# 'speed' arg to set voice talking speed. default value is 2.5
$ ./gotts text="Hello!" speed=6

Contributing

Documentation is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit.

FAQs

Last updated on 20 Nov 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc