GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java-docs-samples/texttospeech/cloud-client at master · micheldavid/java-docs-samples

Expand file tree

/

cloud-client

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

cloud-client

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
resources
resources
 
 
src
src
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Google Cloud Text-To-Speech API Java examples

The Cloud Text To Speech API enables you to generate and customize synthesized speech from text or SSML.

These samples show how to list all supported voices, synthesize raw text, and synthesize a file.

Prerequisites

Download Maven

To get started, download and install it.

Setup

  • Create a project with the Google Cloud Console, and enable the TextToSpeech API.

  • Set up authentication. For example, from the Cloud Console, create a service account, download its json credentials file, then set the appropriate environment variable:

    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json
  • Build the samples

    mvn clean package
    

Quckstart

Synthesize text to an output audio file. Java Code

mvn exec:java -DQuickstart

List Voices

This sample lists all the supported voices. Java Code

mvn exec:java -DListVoices

Synthesize Text

This sample synthesizes text to an output audio file. Java Code

mvn exec:java -DSynthesizeText -Dexec.args='--text "hello"'

This sample synthesizes ssml to an output audio file. Java Code

mvn exec:java -DSynthesizeText -Dexec.args='--ssml "<speak>Hello there.</speak>"'

Synthesize File

This sample synthesizes a text file to an output audio file. Java Code

mvn exec:java -DSynthesizeFile -Dexec.args='--text resources/hello.txt'

This sample synthesizes a ssml file to an output audio file. Java Code

mvn exec:java -DSynthesizeFile -Dexec.args='--ssml resources/hello.ssml'
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.