ivona

package module
v0.0.0-...-4018c8a Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2015 License: MIT Imports: 6 Imported by: 4

README

Go IVONA Build Status

Go client library for IVONA Speech Cloud API.

Supported API Calls

  • CreateSpeech

Versioning

Each revision of the binding is tagged and the version is updated accordingly.

Given Go's lack of built-in versioning, it is highly recommended you use a package management tool in order to ensure a newer version of the binding does not affect backwards compatibility.

To see the list of past versions, run git tag. To manually get an older version of the client, clone this repo, checkout the specific tag and build the library:

git clone https://github.com/jpadilla/ivona-go.git
cd ivona-go
git checkout api_version_tag
make build

Installation

go get github.com/jpadilla/ivona-go

Documentation

For details on all the functionality in this library, see the GoDoc documentation.

Example usage

package main

import (
    "log"

    ivona "github.com/jpadilla/ivona-go"
)

func main() {
    client := ivona.New("IVONA_ACCESS_KEY", "IVONA_SECRET_KEY")
    options := ivona.NewSpeechOptions("Hello World")
    r, err := client.CreateSpeech(options)

    if err != nil {
        log.Fatal(err)
    }

    log.Printf("%v\n", len(r.Audio))
    log.Printf("%v\n", r.ContentType)
    log.Printf("%v\n", r.RequestID)
}

Documentation

Overview

Package ivona provides the binding for IVONA Speech Cloud API

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	Data string
	Type string
}

Input contains attributes describing the user input. For more details see http://developer.ivona.com/en/speechcloud/api_ref_data_types.html#DataTypes_Input.

type Ivona

type Ivona struct {
	AccessKey string
	SecretKey string
}

Ivona is used to invoke API calls

func New

func New(accessKey string, secretKey string) *Ivona

New returns a new Ivona client.

func (*Ivona) CreateSpeech

func (client *Ivona) CreateSpeech(options SpeechOptions) (*SpeechResponse, error)

CreateSpeech performs a synthesis of the requested text and returns the audio stream containing the speech.

Example
package main

import (
	"log"

	ivona "github.com/jpadilla/ivona-go"
)

func main() {
	client := ivona.New("IVONA_ACCESS_KEY", "IVONA_SECRET_KEY")
	options := ivona.NewSpeechOptions("Hello World")
	r, err := client.CreateSpeech(options)

	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%v\n", len(r.Audio))
	log.Printf("%v\n", r.ContentType)
	log.Printf("%v\n", r.RequestID)
}
Output:

func (*Ivona) ListVoices

func (client *Ivona) ListVoices(options Voice) (*ListResponse, error)

ListVoices retrieves list of voices from the api

Example
package main

import (
	"log"

	ivona "github.com/jpadilla/ivona-go"
)

func main() {
	client := ivona.New("IVONA_ACCESS_KEY", "IVONA_SECRET_KEY")

	r, err := client.ListVoices(ivona.Voice{})
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%v\n", len(r.Voices))
}
Output:

type ListResponse

type ListResponse struct {
	Voices      []Voice
	RequestID   string
	ContentType string
}

ListResponse is the resource representing response from ListVoices action.

type OutputFormat

type OutputFormat struct {
	Codec      string
	SampleRate int
}

OutputFormat contains attributes describing the audio compression and format in which the returned stream should be encoded. For more details see http://developer.ivona.com/en/speechcloud/api_ref_data_types.html#DataTypes_OutputFormat.

type Parameters

type Parameters struct {
	Rate           string
	Volume         string
	SentenceBreak  int
	ParagraphBreak int
}

Parameters contains additional attributes affecting the generated speech. For more details see http://developer.ivona.com/en/speechcloud/api_ref_data_types.html#DataTypes_Parameters.

type SpeechOptions

type SpeechOptions struct {
	Input        *Input
	OutputFormat *OutputFormat
	Parameters   *Parameters
	Voice        *Voice
}

SpeechOptions is the set of parameters that can be used on the CreateSpeech action. For more details see http://developer.ivona.com/en/speechcloud/api_ref_actions.html#CreateSpeech.

func NewSpeechOptions

func NewSpeechOptions(data string) SpeechOptions

NewSpeechOptions is the set of default parameters that can be used the CreateSpeech action. For more details see http://developer.ivona.com/en/speechcloud/api_ref_actions.html#CreateSpeech_DefaultValues.

type SpeechResponse

type SpeechResponse struct {
	Audio       []byte
	RequestID   string
	ContentType string
}

SpeechResponse is the resource representing response from CreateSpeech action.

type Voice

type Voice struct {
	Name     string
	Language string
	Gender   string
}

Voice contains a filter for the voice selection that should be used for the speech synthesis. For more details see http://developer.ivona.com/en/speechcloud/api_ref_data_types.html#DataTypes_Voice.

Jump to

Keyboard shortcuts

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