title: Google Speech to Text (Speech Recognition) is Only Recognizing the First Few Seconds of Audio
body: <p>I'm using Google's Speech-to-Text API in node js. It returns the recognition of the first few words, but then ignores the remainder of the audio file. The cut-off point is around 5-7 seconds into any uploaded file.</p>
  <p>I've tried <a href="https://cloud.google.com/speech-to-text/docs/sync-recognize" rel="nofollow noreferrer">synchronous speech recognition for shorter audio files</a>.
  (Example using an MP3 file shown below)</p>
  <pre><code>    filename = './TEST/test.mp3';
  
      const client = new speech.SpeechClient();
  
      //configure the request:
      const config = {
          enableWordTimeOffsets: true,
          sampleRateHertz: 44100,
          encoding: 'MP3',
          languageCode: 'en-US',
      };
      const audio = {
          content: fs.readFileSync(filename).toString('base64'),
      };
      const request = {
          config: config,
          audio: audio,
      };
      
      // Detects speech in the audio file
      const [response] = await client.recognize(request);
  </code></pre>
  <p>And I've also tried <a href="https://cloud.google.com/speech-to-text/docs/async-recognize" rel="nofollow noreferrer">asynchronous recognition for longer audio files</a>
  (Example using a WAV file shown below)</p>
  <pre><code>filename = './TEST/test.wav';
  
  const client = new speech.SpeechClient();
  
  //configure the request:
  const config = {
       enableWordTimeOffsets: true,
       languageCode: 'en-US',
  };
  const audio = {
       content: fs.readFileSync(filename).toString('base64'),
  };
  const request = {
       config: config,
       audio: audio,
  };
  
  //Do a longRunningRecognize request
  const [operation] = await client.longRunningRecognize(request);
  const [response] = await operation.promise();
  </code></pre>
  <p>I've tried each of these implementations with both WAV files and MP3. The result is always exactly the same: good recognition for the first 5 seconds, then nothing at all.</p>
  <p>Any help would be greatly appreciated!</p>