RealtimeSTT icon indicating copy to clipboard operation
RealtimeSTT copied to clipboard

transcribing things I didn't say

Open HXSmc opened this issue 11 months ago • 1 comments

it thinks I'm saying "thank you" apparently when I talk it transcribes what I say but when I don't talk it transcribes endless "thank you"


    import Speech_rec as sr
    from RealtimeSTT import AudioToTextRecorder # has to be implemented in the main script

    if __name__ == '__main__':
        record = AudioToTextRecorder()
        wakeup = AudioToTextRecorder(wake_words="jarvis")
        listener = sr.listener(record, wakeup)
    
        listener.run()

    class listener:
        def __init__(self, recorder, wakeup):
            self.recorder = recorder
            self.recorder.stop()
            self.sleep = True    
            self.wakeup = wakeup

        def listen(self):
            rec = ""
            rec = self.recorder.text() 
            return rec
    
        def sleep_mode(self):
            self.sleep = True
            print("Sleep mode enabled")
            self.recorder.stop()

        def run(self):
            print("Wait until it says 'speak now'")
            if not self.sleep:
                self.recorder.start()
                command = self.listen()
                print(f"Command:. {command}")
                if'sleep' in command.lower():
                    self.sleep_mode()
                    return None
                else:
                    return command.lower()
            elif self.sleep:
                self.wakeup.start()
                print("Wake up command ('jarvis')")
                command = self.wakeup.text()
                if command != None:
                    self.wakeup.stop()
                    self.sleep = False
                    print(command)
                    print("good morning")
                   self.recorder.start()

this is my whole code (oh it also wakes up on it's own)

HXSmc avatar Nov 01 '24 22:11 HXSmc