gpt4 book ai didi

ibm-cloud - Watson Speech to Text 无法转码数据流音频/wav

转载 作者:行者123 更新时间:2023-12-03 17:16:42 31 4
gpt4 key购买 nike

我正在使用 IBM Watson Speech to Text API:

var SpeechToTextV1 = require('watson-developer-cloud/speech-to-text/v1');
var fs = require('fs');
var request = require('request');

var speech_to_text = new SpeechToTextV1({
"username": "<user name>",
"password": "<password>"
});

var recognizeStream = speech_to_text.createRecognizeStream();

// request(wavfileURL).pipe(recognizeStream);
// recognizeStream.on('results', function(err, res){
// console.dir(err)
// console.dir(res)
// if (res.results){
// console.dir(res.results)
// }
//
// });
request.get(wavfileURL, function (err, res, buffer) {
var streamer = require('streamifier');
var params = {
// From file
audio: streamer.createReadStream(buffer) ,
content_type: 'audio/wav; rate=44100'
};

speech_to_text.recognize(params, function(err, res) {
debugger;
if (err)
console.log("ERR:",err);
else {
console.log("NOT ERR");
console.log(JSON.stringify(res, null, 2));
console.dir(res);
}
});
});

我用下面的 WAV 文件来调用它 https://s3.amazonaws.com/buzzy-audio/adam.ginsburg%40gmail.com/vNixvnC4Xscu8yZ98

我收到以下错误:
> ERR: { [Error: unable to transcode data stream audio/wav ->
> audio/x-float-array ] I20170411-18:23:40.576(10)? code: 400,
> I20170411-18:23:40.576(10)? code_description: 'Bad Request',
> I20170411-18:23:40.577(10)? error: 'unable to transcode data stream
> audio/wav -> audio/x-float-array ' }

内容类型采样率似乎正确:

fileinfo

请问有什么想法吗?

最佳答案

这是因为 watson 认为您尝试上传的音频文件不是音频文件,因此为了保护自己免受恶意文件的侵害,它会引发异常
官方解释:link
损坏的文件:file byte code altered (下载前扫描)

关于ibm-cloud - Watson Speech to Text 无法转码数据流音频/wav,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43340717/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com