'Records until a second of silence or times out after 12 seconds
Returns a list of the matching options or None'

def activeListenToAllOptions(self, THRESHOLD=None, LISTEN=True, MUSIC=False):

    RATE = 16000
    CHUNK = 1024
    LISTEN_TIME = 12
    if (THRESHOLD is None):
        THRESHOLD = self.fetchThreshold()
    self.speaker.play(jasperpath.data('audio', 'beep_hi.wav'))
    stream = self._audio.open(format=pyaudio.paInt16, channels=1, rate=RATE, input=True, frames_per_buffer=CHUNK)
    frames = []
    lastN = [(THRESHOLD * 1.2) for i in range(30)]
    for i in range(0, ((RATE / CHUNK) * LISTEN_TIME)):
        data = stream.read(CHUNK)
        frames.append(data)
        score = self.getScore(data)
        lastN.pop(0)
        lastN.append(score)
        average = (sum(lastN) / float(len(lastN)))
        if (average < (THRESHOLD * 0.8)):
            break
    self.speaker.play(jasperpath.data('audio', 'beep_lo.wav'))
    stream.stop_stream()
    stream.close()
    with tempfile.SpooledTemporaryFile(mode='w+b') as f:
        wav_fp = wave.open(f, 'wb')
        wav_fp.setnchannels(1)
        wav_fp.setsampwidth(pyaudio.get_sample_size(pyaudio.paInt16))
        wav_fp.setframerate(RATE)
        wav_fp.writeframes(''.join(frames))
        wav_fp.close()
        f.seek(0)
        return self.active_stt_engine.transcribe(f)
