Skip to content

Commit

Permalink
samples: updated comments on recognize.js to reflect time limitations… (
Browse files Browse the repository at this point in the history
  • Loading branch information
b-loved-dreamer authored and Ace Nassri committed Nov 17, 2022
1 parent 14fefea commit 4165450
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion speech/recognize.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ async function asyncRecognize(
sampleRateHertz: sampleRateHertz,
languageCode: languageCode,
};

/**
* Note that transcription is limited to 60 seconds audio.
* Use a GCS file for audio longer than 1 minute.
*/
const audio = {
content: fs.readFileSync(filename).toString('base64'),
};
Expand Down Expand Up @@ -528,7 +533,7 @@ async function syncRecognizeModelSelectionGCS(
audio: audio,
};

// Detects speech in the audio file
// Detects speech in the audio file.
const [response] = await client.recognize(request);
const transcription = response.results
.map(result => result.alternatives[0].transcript)
Expand All @@ -549,6 +554,7 @@ async function syncRecognizeWithAutoPunctuation(
* TODO(developer): Update client library import to use new
* version of API when desired features become available
*/

const speech = require('@google-cloud/speech');
const fs = require('fs');

Expand All @@ -568,6 +574,7 @@ async function syncRecognizeWithAutoPunctuation(
languageCode: languageCode,
enableAutomaticPunctuation: true,
};

const audio = {
content: fs.readFileSync(filename).toString('base64'),
};
Expand Down

0 comments on commit 4165450

Please sign in to comment.