Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Samples - updated with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebecca Taylor committed Mar 24, 2018
1 parent fced808 commit fea561e
Showing 1 changed file with 36 additions and 40 deletions.
76 changes: 36 additions & 40 deletions samples/synthesize.js
Expand Up @@ -34,21 +34,20 @@ function synthesizeText(text, outputFile) {
audioConfig: {audioEncoding: 'MP3'},
};

client
.synthesizeSpeech(request, (err, response) => {
client.synthesizeSpeech(request, (err, response) => {
if (err) {
console.error('ERROR:', err);
return;
}

fs.writeFile(outputFile, response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
return;
}

fs.writeFile(outputFile, response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
return;
}
console.log(`Audio content written to file: ${outputFile}`);
});
console.log(`Audio content written to file: ${outputFile}`);
});
});
// [END tts_synthesize_text]
}

Expand All @@ -71,21 +70,20 @@ function synthesizeSsml(ssml, outputFile) {
audioConfig: {audioEncoding: 'MP3'},
};

client
.synthesizeSpeech(request, (err, response) => {
client.synthesizeSpeech(request, (err, response) => {
if (err) {
console.error('ERROR:', err);
return;
}

fs.writeFile(outputFile, response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
return;
}

fs.writeFile(outputFile, response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
return;
}
console.log(`Audio content written to file: ${outputFile}`);
});
console.log(`Audio content written to file: ${outputFile}`);
});
});
// [END tts_synthesize_ssml]
}

Expand All @@ -108,21 +106,20 @@ function synthesizeTextFile(textFile, outputFile) {
audioConfig: {audioEncoding: 'MP3'},
};

client
.synthesizeSpeech(request, (err, response) => {
client.synthesizeSpeech(request, (err, response) => {
if (err) {
console.error('ERROR:', err);
return;
}

fs.writeFile(outputFile, response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
return;
}

fs.writeFile(outputFile, response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
return;
}
console.log(`Audio content written to file: ${outputFile}`);
});
console.log(`Audio content written to file: ${outputFile}`);
});
});
// [END tts_synthesize_text_file]
}

Expand All @@ -145,21 +142,20 @@ function synthesizeSsmlFile(ssmlFile, outputFile) {
audioConfig: {audioEncoding: 'MP3'},
};

client
.synthesizeSpeech(request, (err, response) => {
client.synthesizeSpeech(request, (err, response) => {
if (err) {
console.error('ERROR:', err);
return;
}

fs.writeFile(outputFile, response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
return;
}

fs.writeFile(outputFile, response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
return;
}
console.log(`Audio content written to file: ${outputFile}`);
});
console.log(`Audio content written to file: ${outputFile}`);
});
});
// [END tts_synthesize_ssml_file]
}

Expand Down

0 comments on commit fea561e

Please sign in to comment.