MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / listVoices

Function listVoices

texttospeech/listVoices.js:17–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15'use strict';
16
17async function listVoices() {
18 // [START tts_list_voices]
19 const textToSpeech = require('@google-cloud/text-to-speech');
20
21 const client = new textToSpeech.TextToSpeechClient();
22
23 const [result] = await client.listVoices({});
24 const voices = result.voices;
25
26 console.log('Voices:');
27 voices.forEach(voice => {
28 console.log(`Name: ${voice.name}`);
29 console.log(` SSML Voice Gender: ${voice.ssmlGender}`);
30 console.log(` Natural Sample Rate Hertz: ${voice.naturalSampleRateHertz}`);
31 console.log(' Supported languages:');
32 voice.languageCodes.forEach(languageCode => {
33 console.log(` ${languageCode}`);
34 });
35 });
36 // [END tts_list_voices]
37}
38
39async function main() {
40require(`yargs`) // eslint-disable-line

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected