0

How is the recognize method used to send an audio files to Speech-to-Text for transcription? Where is the audio file accessed? Is there somewhere to put a path to a local file, a Google Storage location, or a download URL?

The documentation says:

enter image description here

OK, that's what I want to do! The documentation says that this is the method:

recognize(params, [callback()])

The params I see are:

var params = {
  objectMode: true,
  contentType: 'audio/flac',
  model: 'en-US_BroadbandModel',
  keywords: ['colorado', 'tornado', 'tornadoes'],
  keywordsThreshold: 0.5,
  maxAlternatives: 3
};

Is there a parameter for MediaFileUri?

chughts
  • 4,210
  • 2
  • 14
  • 27
Thomas David Kehoe
  • 10,040
  • 14
  • 61
  • 100

1 Answers1

1

Your link is to the node.js sdk documentation. In which case the audio is sent as the parameter audio, which should be either a NodeJS.ReadableStream or a buffer. You can create a readable stream from a url in which case you could add:


params.audio = fs.createReadStream(url);

that will require the url to point at an audio file, and not a disguised webpage with an audio player.

chughts
  • 4,210
  • 2
  • 14
  • 27