def transcribe(files=[], pre=10, post=50):
    '''Uses pocketsphinx to transcribe audio files'''

    total = len(files)

    for i, f in enumerate(files):
        filename = f.replace('.temp.wav', '') + '.transcription.txt'

        if os.path.exists(filename) is False:
            print(str(i+1) + '/' + str(total) + ' Transcribing ' + f)
            transcript = subprocess.check_output(['pocketsphinx_continuous', '-infile', f, '-time', 'yes', '-logfn', '/dev/null', '-vad_prespeech', str(pre), '-vad_postspeech', str(post)])

            with open(filename, 'w') as outfile:
                outfile.write(transcript.decode('utf8'))

            os.remove(f)
Uses pocketsphinx to transcribe audio files
audiogrep/audiogrep.py