[英]Microsoft Translator Speech ,No return,I used C++ websocketpp
I try to use Microsoft Translator Speech API . 我尝试使用Microsoft Translator Speech API。 I am using c++ websocketpp
, I confirm that I have sent the audio data to server,but wait two minutes, the connection closed, because no audio is received from the client for an extended period of time. 我正在使用c ++ websocketpp
,确认已将音频数据发送到服务器,但是请等待两分钟,连接已关闭,因为在很长一段时间内都没有从客户端接收到音频。
void on_open(websocketpp::connection_hdl hdl) {
m_open = std::chrono::high_resolution_clock::now();
std::ifstream f("./HelloWorld.wav");
std::string str((std::istreambuf_iterator<char>(f)),std::istreambuf_iterator<char>())
m_endpoint.send(hdl,str,websocketpp::frame::opcode::BINARY);
}
Why? 为什么?
Who can help me? 谁能帮我?
Thank you and regards. 谢谢和问候。
Send data: 发送数据:
Wait two minutes: 等待两分钟:
emmmm,I solved the question,we need to add some silences at the end to tell the service that it is the end of the sentences.We make sure they are 0x00 byte,I made a mistake ,the data sent comes with additional information---pointer? 嗯,我解决了这个问题,我们需要在最后加上一些沉默,以告知服务这是句子的结尾。我们确保它们是0x00字节,我弄错了,发送的数据附带其他信息- - 指针? Modify this error,I got a correct return. 修改此错误,我得到了正确的回报。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.