After creating an async speech recognition operation, the progressPercent of the AsyncRecognizeMetadata (when listening to the progress event) is always 0. It's supposed to be range from 0 to 100.
"@google-cloud/speech": "^0.5.0"$ wget https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/speech/resources/audio2.raw?raw=true -O audio2.rawvar speech = require('@google-cloud/speech')();
const config = {
encoding: 'LINEAR16',
sampleRate: 16000
};
speech.startRecognition('audio2.raw', config, (err, operation) => {
if (err) {
return;
}
operation
.on('progress', (progress) => {
console.log("progress")
console.log(progress)
})
.on('complete', (result) => {
console.log("result")
console.log(result)
})
.on('error', (err) => {
console.log("error")
console.log(err)
})
})
$ GCLOUD_PROJECT= GOOGLE_APPLICATION_CREDENTIALS= node progressPercentBug and the output will be, roughly:progress
{ progressPercent: 0,
startTime:
{ seconds: Long { low: 1481320685, high: 0, unsigned: false },
nanos: 843408000 },
lastUpdateTime:
{ seconds: Long { low: 1481320686, high: 0, unsigned: false },
nanos: 97801000 } }
progress
{ progressPercent: 0,
startTime:
{ seconds: Long { low: 1481320685, high: 0, unsigned: false },
nanos: 843408000 },
lastUpdateTime:
{ seconds: Long { low: 1481320686, high: 0, unsigned: false },
nanos: 97801000 } }
...
@landrito do you observe this behavior?
I'll look into this.
Found the problem. It seems the check to see if the metadata value has changed was using the wrong operation. With this change the progress will only be emitted on an update to the metadata.
This is fixed if you install @google-cloud/speech directly. The fix will be included in our next google-cloud release as well. Thanks for catching this!
Thanks for the quick fix!
NP!
I'm not getting duplicate progress messages anymore, per this fix, but I'm still not getting particularly useful progress information. When I add a log statement console.log(metadata) at longrunning.js:298 I see a bunch of metadata with progressPercent == 0 and then one final piece of metadata with progressPercent == 100. I don't know if this is a bug or if the Cloud Speech API simply doesn't give real progress updates. Any info on this, @landrito?
Actually, I'm seeing progress updates for longer files. For example, when I transcribe a fifteen minute long file, I'm getting progress updates roughly every 10-15% (0%, 11%, 23%, 41%, 53%, ...).