pollydent

package module
v0.0.0-...-3d3c0c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2018 License: MIT Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

pollydent

pollydent is a wrapper of text-to-speech for Amazon Polly and Google Cloud Text-To-Speech

Requirement

pollydent needs AWS account, and GCP account. Please sign up AWS, and GCP. if you want to use Google Cloud Text-To-Speech, please install gcloud in your PC. Please install SoX if you are using Linux or OS X.

Install

$ go get github.com/bamchoh/pollydent

Usage

package main

import (
	"log"
	polly "github.com/bamchoh/pollydent"
)

func main() {
	p := polly.NewPollydent(
		"<ACCESS_KEY>",
		"<SECRET_KEY>",
		nil,
	)
	p.ReadAloud("こんにちは世界")
}

ACCESS_KEY, SECRET_KEY

If you have no these keys, please create according to https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html

How to enable Google Cloud Text-To-Speech

Please see Quick Start guide, https://cloud.google.com/text-to-speech/docs/quickstart-protocol

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioConfig

type AudioConfig interface {
	SampleRate() int
	NumOfChanel() int
	ByteParSample() int
}

type GCTTSAudioConfig

type GCTTSAudioConfig struct {
}

func (*GCTTSAudioConfig) ByteParSample

func (c *GCTTSAudioConfig) ByteParSample() int

func (*GCTTSAudioConfig) NumOfChanel

func (c *GCTTSAudioConfig) NumOfChanel() int

func (*GCTTSAudioConfig) SampleRate

func (c *GCTTSAudioConfig) SampleRate() int

type GCTTSSpeaker

type GCTTSSpeaker struct {
	// contains filtered or unexported fields
}

func (*GCTTSSpeaker) Send

func (p *GCTTSSpeaker) Send(config SpeechParams) (io.Reader, error)

type MP3Wrapper

type MP3Wrapper struct {
	io.Reader
}

func (*MP3Wrapper) Close

func (w *MP3Wrapper) Close() error

type PollyAudioConfig

type PollyAudioConfig struct {
}

func (*PollyAudioConfig) ByteParSample

func (c *PollyAudioConfig) ByteParSample() int

func (*PollyAudioConfig) NumOfChanel

func (c *PollyAudioConfig) NumOfChanel() int

func (*PollyAudioConfig) SampleRate

func (c *PollyAudioConfig) SampleRate() int

type PollyConfig

type PollyConfig struct {
	Region   string `yaml:"region"`
	Format   string `yaml:"format"`
	Voice    string `yaml:"voice"`
	TextType string `yaml:"type"`
	Speed    int
}

PollyConfig is configuration structure for Polly

func Load

func Load(filepath string) (*PollyConfig, error)

type PollySpeaker

type PollySpeaker struct {
	// contains filtered or unexported fields
}

func (*PollySpeaker) Send

func (p *PollySpeaker) Send(config SpeechParams) (io.Reader, error)

type Pollydent

type Pollydent struct {
	// contains filtered or unexported fields
}

Pollydent is structure to manage read aloud

func NewPollydentWithCloudTextToSpeech

func NewPollydentWithCloudTextToSpeech(config *PollyConfig) (*Pollydent, error)

func NewPollydentWithPolly

func NewPollydentWithPolly(accessKey, secretKey string, config *PollyConfig) (*Pollydent, error)

NewPollydent news Polly structure

func (*Pollydent) Play

func (p *Pollydent) Play(reader io.Reader) (err error)

func (*Pollydent) ReadAloud

func (p *Pollydent) ReadAloud(msg string) (err error)

ReadAloud reads aloud msg by Polly

func (*Pollydent) SendToServer

func (p *Pollydent) SendToServer(param SpeechParams) (io.Reader, error)

type Request

type Request struct {
	Input       input       `json:"input"`
	Voice       voice       `json:"voice"`
	AudioConfig audioConfig `json:"audioConfig"`
}

type Response

type Response struct {
	AudioContent string `json:"audioContent"`
}

type Speaker

type Speaker interface {
	Send(SpeechParams) (io.Reader, error)
}

type SpeechParams

type SpeechParams struct {
	Message string
	Voice   string
	Speed   int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址