我正在研究谷歌流语音识别。
这是之前的代码:
await streamingCall.WriteAsync(
new StreamingRecognizeRequest()
{
StreamingConfig = new StreamingRecognitionConfig()
{
Config = new RecognitionConfig()
{
Encoding = RecognitionConfig.Types.AudioEncoding.Linear16,
SampleRateHertz = 32000,
LanguageCode = "en",
},
InterimResults = true,
}
});
这是我进行一些更改的代码:
RecognitionConfig config = new RecognitionConfig();
config.Encoding = RecognitionConfig.Types.AudioEncoding.Linear16;
config.SampleRateHertz = 32000;
config.LanguageCode = "en";
await streamingCall.WriteAsync(
new StreamingRecognizeRequest()
{
StreamingConfig = new StreamingRecognitionConfig()
{
InterimResults = true,
}
});
最佳答案
您没有使用RecognitionConfig
:
RecognitionConfig config = new RecognitionConfig();
config.Encoding = RecognitionConfig.Types.AudioEncoding.Linear16;
config.SampleRateHertz = 32000;
config.LanguageCode = "en";
await streamingCall.WriteAsync(
new StreamingRecognizeRequest()
{
StreamingConfig = new StreamingRecognitionConfig()
{
Config = config, // You are missing this line
InterimResults = true,
}
});
关于c# - 对Google流语音识别进行一些更改,但它不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48149836/