2016-10-23 2 views
0

Google 음성 API를 처음 사용했습니다. 내 응용 프로그램은 음성 인식을 위해 오디오 요청을 연속적으로 스트리밍하도록 요구합니다. 사용량은 1 분 이상 계속됩니다. 그러나 서비스는 Usage Limits에 따라 60 초 후에 중단됩니다. 이 문제를 해결할 방법이 있습니까?StreamingRecognize를 1 분 이상 사용하는 방법은 무엇입니까?

도움을 주시면 대단히 감사하겠습니다.

덕분에 구글 클라우드 콘솔에 깊이 묻혀

답변

0

는 한계의 일부 증가를 요청할 수있는 양식에 대한 링크입니다. 그러나 가능한 경우 비동기 인식을 사용하면 최대 80 분간 인식 할 수 있습니다.

가 한계 증가 양식에 도착하려면

  1. 이동을 API manager in the console
  2. 클릭으로 Google Cloud Speech API
  3. 의 "할당량"탭을 클릭 조정 할당량의에
  4. 아래로 스크롤, 등 as Discovery requests per 100 seconds
  5. 오른쪽에있는 "편집"아이콘을 클릭하십시오.
  6. 그 팝업에는 "더 높은 할당량을 신청하십시오"라는 제목의 링크가 있어야합니다.
0

나는이 문제를 Node.js 앱에서 일련의 스트리밍 인식 요청을 작성하여 해결했습니다.

코드는 여기 https://github.com/marciovm/Speech-Forever입니다.

트릭은 입력 스피킹에서 적절한 휴식 시간에 새로운 스트림 클라이언트 측 (사용자의 브라우저 또는 이에 상응하는 곳에서)을 요청하는 것입니다. app.js에

키 섹션 (노드 서버) demo.js에

var gstreams = []; // keeep track of speech streams 
    var activeStreamID = -1; // pointer to active speech stream 
    ws.on('message', function (data) {   
    if (typeof data == 'string') { 
     if (data.indexOf("info")>0) { // client sends an info string on connection that triggers server to start a speech stream    
     console.log('Start first stream'); 
     gstreams.push(startGoogleSpeechStream(ws)); 
     activeStreamID = activeStreamID + 1;   
     } 
     else { // client requested a new speech stream (client-side logic allows for triggering on a lull in input volume) 
     console.log('Start another stream'); 
     gstreams[activeStreamID].end(); 
     gstreams.push(startGoogleSpeechStream(ws)); 
     activeStreamID = activeStreamID + 1;        
     }  
    }  
    else { 
     gstreams[activeStreamID].write(data); // client sent audio, push it to active speech stream 
    }   
    }); 

키 섹션 (클라이언트 브라우저)

var handleSuccess = function(stream) { 
    setRecordingTrue(1000); // give socket 1 sec to open 
    audioInput = context.createMediaStreamSource(stream); 
    audioInput.connect(recorder);    
    recorder.onaudioprocess = function(stream){ 
     if(!recording) return; 
     var buf = stream.inputBuffer.getChannelData(0);    
     volume = detectVolume(buf, this);    
     $(".volume_meter")[0].value=volume * 100;  
     if (volume < 0.01 && (Date.now() > (streamStartTime + breakTime))) {  
     ws.send("restarting Google Stream"); 
     console.log("restarting Google Stream"); 
     streamStartTime = Date.now(); 
     writeToCaret(' '); 
     } 
     else { 
     ws.send(float32ToInt16(buf)); // send audio stream to Node server 
     }  
    }  
    } 
관련 문제