title: How to convert audio inpustream from google translate to wav file?
body: <p>I'm taking a project to make the text to speech with Google API : <a href="https://code.google.com/p/java-google-translate-text-to-speech/" rel="nofollow">https://code.google.com/p/java-google-translate-text-to-speech/</a>. I used the code in the part "Playing a translated text". The project works well. Then I want to create a wav file from the inputstream received from google translate. I tried with this codes: </p>
  
  <pre><code>try {
          sound = audio.getAudio(text_, Language.FRENCH);
          AudioInputStream ais;
          ais = new AudioInputStream(sound,format,sound.available());
          //ais = AudioSystem.getAudioInputStream(sound);
          //AudioInputStream lowResAIS = AudioSystem.getAudioInputStream(format, ais);
          AudioFormat aisformat = ais.getFormat();
          System.out.println(aisformat.toString());
          AudioSystem.write(ais, Type.WAVE, NewfilePath);}
  } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  </code></pre>
  
  <p>But my wav file doesn't work, when I double-click to play it, it have no voice. Have anybody tried to convert an audio received from google translate to wav file in java? Could you please helps me to resolve this problem? Thanks</p>