From 41654505c39f9b5cdb03a587fc6d658c2842ae74 Mon Sep 17 00:00:00 2001 From: Franklin Nunez <69214580+b-loved-dreamer@users.noreply.github.com> Date: Mon, 21 Sep 2020 13:01:25 -0700 Subject: [PATCH] =?UTF-8?q?samples:=20updated=20comments=20on=20recognize.?= =?UTF-8?q?js=20to=20reflect=20time=20limitations=E2=80=A6=20(#650)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- speech/recognize.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/speech/recognize.js b/speech/recognize.js index 61afaa57a0..bf9c5e2686 100644 --- a/speech/recognize.js +++ b/speech/recognize.js @@ -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'), }; @@ -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) @@ -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'); @@ -568,6 +574,7 @@ async function syncRecognizeWithAutoPunctuation( languageCode: languageCode, enableAutomaticPunctuation: true, }; + const audio = { content: fs.readFileSync(filename).toString('base64'), };