Google Speech-to-Text:无效的识别'config':错误的采样率赫兹

问题描述 投票:0回答:1

我正在尝试使用REST全套服务将语音转换为文本。我正在使用.wav文件(PCM 16位Mono 16000 HZ)

URL:https://speech.googleapis.com/v1p1beta1/speech:recognize

JSON请求:

{
    "config": {
        "enableAutomaticPunctuation": "true",
        "encoding": "LINEAR16",
        "languageCode": "en-US",
        "model": "default"
    },
    "audio": {
        "content": "QzpcU3BlZWNoVG9UZXh0XGVuZ2xpc2hcUENNXEVORy1DUk0tRE9XTlRJTUUud2F2"
    }
}

错误:

"error": {
    "code": 400,
    "message": "Invalid recognition 'config': bad sample rate hertz.",
    "status": "INVALID_ARGUMENT"
}

请您帮忙解决此错误吗?

google-cloud-platform speech-to-text
1个回答
0
投票
在您的情况下为16000,因此您的请求应包括:

"config": { ..., "sampleRateHertz": 16000 }

© www.soinside.com 2019 - 2024. All rights reserved.