简体   繁体   中英

IBM Watson Speech-to-Text "Recognize audio" method?

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:

在此处输入图片说明

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM