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/beta/README.md at main · DKbyo/java-docs-samples

Expand file tree

/

README.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
78 lines (62 loc) · 3.42 KB
/

README.md

Copy path

File metadata and controls

78 lines (62 loc) · 3.42 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

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 text with an audio profile to an output audio file. Java Code

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

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 01402792 — 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.