properties.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:Lab-Assistant 作者: SPARC-Auburn 项目源码 文件源码
def __init__(self, name, voice, purpose, location, input, output, microphone):
        """Initializes assistant, adjusts for ambient noise, and checks TTS"""
        self.name = name
        self.name = self.name.lower()
        self.purpose = purpose
        self.voice = voice
        self.location = location
        self.r = sr.Recognizer()
        self.mic = microphone
        self.input = input
        self.output = output

        with sr.Microphone(device_index=self.mic, chunk_size=1024, sample_rate=48000) as source:
            self.r.adjust_for_ambient_noise(source)  # Adjust for ambient noise by listening for 1 second
            # self.r.energy_threshold = 30 # Threshold offset
            print ("\tThreshold: " + str(self.r.energy_threshold))

        print("\tInitializing {}...".format(self.name))
        self.speak("My name is " + self.name + " and I am here " + self.purpose + ".  How may I help you?")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号