title: Speech to text with time stamps using google API
body: <p>I'm a developing a Java application to covert speech to text. I made speech to text work out using Java speech API, which records the audio file then covert it to a FLAC file, post it to Google, the response is taken to a string. The challenge before me is that, I need to time stamp each individual statement (assume the detection of fullstop) in the audio file.</p>
  
  <p>How can this be done? I'm new to Java.<br>
  My main file:</p>
  
  <pre><code>         import com.darkprograms.speech.microphone.Microphone;
           import com.darkprograms.speech.recognizer.Recognizer;
  
            import javax.sound.sampled.AudioFileFormat;
            import javax.swing.*;
            import java.awt.event.ActionEvent;
            import java.awt.event.ActionListener;
  
  
            public class DoItAll extends JFrame {
            JButton stop = new JButton("Stop");
            JButton run = new JButton("Run");
            JButton process = new JButton("Process");
            Microphone microphone = new Microphone(AudioFileFormat.Type.WAVE);
            Recognizer recognizer = new Recognizer();
            String audioFile = "c:/eclipse/f.wav";
  
            public DoItAll(){
            stop.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            microphone.close();
                   }
             });
             run.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
             try {
  
                       microphone.captureAudioToFile(audioFile);
              } catch (Exception e1) {
             e1.printStackTrace();  //To change body of catch statement use File 
            JOptionPane.showMessageDialog(null, e1.getMessage());
                   }
             }
            });
             process.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
             String response = "error";
              try {
            response = recognizer.getRecognizedDataForWave(audioFile).getResponse();
           } catch (Exception e1) {
             e1.printStackTrace(); 
            response = e1.getMessage();
             }
             JOptionPane.showMessageDialog(null, response);
              }
              });
           getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS));
            getContentPane().add(run);        
            getContentPane().add(stop);
            getContentPane().add(process);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            pack();
            show();
             }
  
            public static void main(String[] args) {
            new DoItAll();
             }
  
            }
  </code></pre>
  
  <p>My speech API is from this <a href="https://github.com/The-Shadow/java-speech-api" rel="nofollow">link</a>.</p>
  
  <p>Thanks for help.</p>