googleSpeech_mic.py 文件源码

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

项目:googleSpeech_with_NaverTTS 作者: chandong83 项目源码 文件源码
def generator(self):
        while not self.closed:
            # Use a blocking get() to ensure there's at least one chunk of
            # data, and stop iteration if the chunk is None, indicating the
            # end of the audio stream.
            chunk = self._buff.get()
            if chunk is None:
                return

            if self.isPause:
                continue

            data = [chunk]

            # Now consume whatever other data's still buffered.
            while True:
                try:
                    chunk = self._buff.get(block=False)
                    if chunk is None:
                        return
                    data.append(chunk)
                except queue.Empty:
                    break

            yield b''.join(data)

    #?? ??
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号