예제 #1
0
    def run(self):
        """
        Start the thread that listen the microphone and then give the audio to the callback method
        """
        if self.audio_stream is None:
            Utils.print_success("Say something!")
            with self.microphone as source:
                self.audio_stream = self.recognizer.listen(source)

        self.callback(self.recognizer, self.audio_stream)
예제 #2
0
    def run(self):
        #responsive = OwnSpeech.ResponsiveRecognizer(multiplier=self.settings.options.ownspeech_energy_ratio,
        #                                            energy_ratio=self.settings.options.ownspeech_multiplier)
        responsive = OwnSpeech.ResponsiveRecognizer(multiplier=1.0,
                                                    energy_ratio=1.5)
        mic = OwnSpeech.MutableMicrophone()
        Utils.print_success("[SpeechRecorder] Listening...")
        self.write_status("is_recording")

        with mic as source:
            audio_data = responsive.listen(source)

        with open(OWN_AUDIO_FILE, 'wb') as file:
            file.write(audio_data.get_wav_data())

        self.write_status("record_finished")